diff options
author | Christian Breunig <christian@breunig.cc> | 2024-04-01 21:46:13 +0200 |
---|---|---|
committer | Mergify <37929162+mergify[bot]@users.noreply.github.com> | 2024-04-02 16:33:03 +0000 |
commit | 33cb8f4f9665c8b634d998e39354d00d6bf31855 (patch) | |
tree | d8c2a75d980260aa44edb324aa49fc2c451555db /python/vyos | |
parent | 0cb21915164551b3d2eaab79ed6339184957c326 (diff) | |
download | vyos-1x-33cb8f4f9665c8b634d998e39354d00d6bf31855.tar.gz vyos-1x-33cb8f4f9665c8b634d998e39354d00d6bf31855.zip |
firewall: T2199: always use full nft command name (e.g. --file over -f)
(cherry picked from commit 6e0fdbcbba39691461f791c7a68a2c6c5091d2c1)
Diffstat (limited to 'python/vyos')
-rw-r--r-- | python/vyos/firewall.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/python/vyos/firewall.py b/python/vyos/firewall.py index e70b4f0d9..e29aeb0c6 100644 --- a/python/vyos/firewall.py +++ b/python/vyos/firewall.py @@ -66,7 +66,7 @@ def fqdn_config_parse(firewall): rule = path[4] suffix = path[5][0] set_name = f'{hook_name}_{priority}_{rule}_{suffix}' - + if (path[0] == 'ipv4') and (path[1] == 'forward' or path[1] == 'input' or path[1] == 'output' or path[1] == 'name'): firewall['ip_fqdn'][set_name] = domain elif (path[0] == 'ipv6') and (path[1] == 'forward' or path[1] == 'input' or path[1] == 'output' or path[1] == 'name'): @@ -85,7 +85,7 @@ def fqdn_resolve(fqdn, ipv6=False): def find_nftables_rule(table, chain, rule_matches=[]): # Find rule in table/chain that matches all criteria and return the handle - results = cmd(f'sudo nft -a list chain {table} {chain}').split("\n") + results = cmd(f'sudo nft --handle list chain {table} {chain}').split("\n") for line in results: if all(rule_match in line for rule_match in rule_matches): handle_search = re.search('handle (\d+)', line) @@ -655,7 +655,7 @@ def geoip_update(firewall, force=False): 'ipv6_sets': ipv6_sets }) - result = run(f'nft -f {nftables_geoip_conf}') + result = run(f'nft --file {nftables_geoip_conf}') if result != 0: print('Error: GeoIP failed to update firewall') return False |