diff options
Diffstat (limited to 'python')
-rw-r--r-- | python/vyos/firewall.py | 5 | ||||
-rw-r--r-- | python/vyos/template.py | 3 |
2 files changed, 5 insertions, 3 deletions
diff --git a/python/vyos/firewall.py b/python/vyos/firewall.py index 04fd44173..0c6811d72 100644 --- a/python/vyos/firewall.py +++ b/python/vyos/firewall.py @@ -146,9 +146,10 @@ def parse_rule(rule_conf, fw_name, rule_id, ip_name): output.append(f'{proto} {prefix}port {operator} $P_{group_name}') - if 'log' in rule_conf and rule_conf['log'] == 'enable': + if 'log' in rule_conf: action = rule_conf['action'] if 'action' in rule_conf else 'accept' - output.append(f'log prefix "[{fw_name[:19]}-{rule_id}-{action[:1].upper()}] "') + log_level = rule_conf['log'] + output.append(f'log prefix "[{fw_name[:19]}-{rule_id}-{action[:1].upper()}]" level {log_level}') if 'hop_limit' in rule_conf: operators = {'eq': '==', 'gt': '>', 'lt': '<'} diff --git a/python/vyos/template.py b/python/vyos/template.py index 132f5ddde..b41525421 100644 --- a/python/vyos/template.py +++ b/python/vyos/template.py @@ -554,7 +554,8 @@ def nft_default_rule(fw_conf, fw_name): if 'enable_default_log' in fw_conf: action_suffix = default_action[:1].upper() - output.append(f'log prefix "[{fw_name[:19]}-default-{action_suffix}] "') + log_level = fw_conf['enable_default_log'] + output.append(f'log prefix "[{fw_name[:19]}-default-{action_suffix}]" level {log_level}') output.append(nft_action(default_action)) output.append(f'comment "{fw_name} default-action {default_action}"') |