fix: add cscli decision list check for LAPI threat-agent
This commit is contained in:
1 parent
6f180753f2
commit
6e98117126
1 file changed
+16
+16
@@ -14,6 +14,22 @@ class FirewallAuditor:
|
||||
self.table = "crowdsec"
|
||||
self.set_name = "0.0.0.0/0-cscli"
|
||||
|
||||
def get_remote_lapi_truth(self):
|
||||
"""Triton-only: Queries local DB via cscli"""
|
||||
try:
|
||||
cmd = ["/usr/bin/cscli", "decisions", "list", "-a", "-o", "json"]
|
||||
res = subprocess.run(cmd, capture_output=True, text=True, check=True)
|
||||
data = json.loads(res.stdout) or []
|
||||
|
||||
return {
|
||||
d["value"]: d.get("duration")
|
||||
for d in data
|
||||
if isinstance(d, dict) and d.get("origin") != "CAPI"
|
||||
}
|
||||
except Exception as e:
|
||||
logging.error(f"Failed to get LAPI truth: {e}")
|
||||
return {}
|
||||
|
||||
def get_kernel_state(self):
|
||||
"""Scans BOTH IPv4 and IPv6 sets in the crowdsec tables."""
|
||||
all_ips = {} # Changed from set() to {}
|
||||
|
||||
Reference in new issue
Block a user