summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristian Breunig <christian@breunig.cc>2024-05-23 21:54:41 +0200
committerChristian Breunig <christian@breunig.cc>2024-05-23 21:54:41 +0200
commit01464a6069fa7cf02d5545c02ed03fa69679c32c (patch)
tree8abff24b247a53a5a1c5b3222f74846b0f35c1d5 /src
parent2af04a53a4c1aa30118f4c799eb7d1c4cd63be66 (diff)
downloadvyos-1x-01464a6069fa7cf02d5545c02ed03fa69679c32c.tar.gz
vyos-1x-01464a6069fa7cf02d5545c02ed03fa69679c32c.zip
suricata: T751: use key_mangling in get_config_dict()
Diffstat (limited to 'src')
-rwxr-xr-xsrc/conf_mode/service_suricata.py18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/conf_mode/service_suricata.py b/src/conf_mode/service_suricata.py
index 06d68a637..69b369e0b 100755
--- a/src/conf_mode/service_suricata.py
+++ b/src/conf_mode/service_suricata.py
@@ -39,7 +39,7 @@ def get_config(config=None):
if not conf.exists(base):
return None
- suricata = conf.get_config_dict(base,
+ suricata = conf.get_config_dict(base, key_mangling=('-', '_'),
get_first_key=True, with_recursive_defaults=True)
return suricata
@@ -81,19 +81,19 @@ def verify(suricata):
if 'interface' not in suricata:
raise ConfigError('No interfaces configured!')
- if 'address-group' not in suricata:
+ if 'address_group' not in suricata:
raise ConfigError('No address-group configured!')
- if 'port-group' not in suricata:
+ if 'port_group' not in suricata:
raise ConfigError('No port-group configured!')
try:
- topological_sort(suricata['address-group'])
+ topological_sort(suricata['address_group'])
except (ConfigError,StopIteration) as e:
raise ConfigError(f'Invalid address-group: {e}')
try:
- topological_sort(suricata['port-group'])
+ topological_sort(suricata['port_group'])
except (ConfigError,StopIteration) as e:
raise ConfigError(f'Invalid port-group: {e}')
@@ -126,12 +126,12 @@ def generate(suricata):
return format_group
# Format the address group
- suricata['address-group'] = map(to_config('address'),
- topological_sort(suricata['address-group']))
+ suricata['address_group'] = map(to_config('address'),
+ topological_sort(suricata['address_group']))
# Format the port group
- suricata['port-group'] = map(to_config('port'),
- topological_sort(suricata['port-group']))
+ suricata['port_group'] = map(to_config('port'),
+ topological_sort(suricata['port_group']))
render(config_file, 'ids/suricata.j2', {'suricata': suricata})
render(rotate_file, 'ids/suricata_logrotate.j2', suricata)