Harden metadata heal across nft table variants and non-fatal flush errors
This commit is contained in:
1 parent
aae920fb73
commit
716468901c
2 files changed
+48
-7
No files matched your search
+14
-7
@@ -217,7 +217,7 @@ class FirewallAuditor:
|
||||
return False
|
||||
|
||||
def _flush_crowdsec_sets(self):
|
||||
for family, table in (("ip", "crowdsec"), ("ip6", "crowdsec6")):
|
||||
for family, table in (("ip", "crowdsec"), ("ip6", "crowdsec6"), ("inet", "crowdsec")):
|
||||
try:
|
||||
res = subprocess.run(
|
||||
["/usr/sbin/nft", "-j", "list", "table", family, table],
|
||||
@@ -240,12 +240,19 @@ class FirewallAuditor:
|
||||
set_names.append(set_name)
|
||||
|
||||
for set_name in set_names:
|
||||
subprocess.run(
|
||||
["/usr/sbin/nft", "flush", "set", family, table, set_name],
|
||||
check=True,
|
||||
capture_output=True,
|
||||
text=True,
|
||||
)
|
||||
try:
|
||||
subprocess.run(
|
||||
["/usr/sbin/nft", "flush", "set", family, table, set_name],
|
||||
check=True,
|
||||
capture_output=True,
|
||||
text=True,
|
||||
)
|
||||
except subprocess.CalledProcessError as e:
|
||||
stderr = (e.stderr or "").strip()
|
||||
logging.warning(
|
||||
"Heal: Failed to flush set "
|
||||
f"({family} {table} {set_name}): {stderr or e}"
|
||||
)
|
||||
|
||||
def reconcile(self):
|
||||
truth_map = self.get_remote_lapi_truth()
|
||||
|
||||
Reference in new issue
Block a user