summaryrefslogtreecommitdiff
path: root/src/conf_mode/flow_accounting_conf.py
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2020-07-04 20:53:30 +0200
committerChristian Poessinger <christian@poessinger.com>2020-07-04 21:36:51 +0200
commitc8c42db4cc644cdec43d4d1cc8dd2905bad42df6 (patch)
tree5e57c5507cdbd4f052a6bab6f807acacf10f83f7 /src/conf_mode/flow_accounting_conf.py
parentb5ac2b136c57d0cb2be7648df5b6fcf3204bca88 (diff)
downloadvyos-1x-c8c42db4cc644cdec43d4d1cc8dd2905bad42df6.tar.gz
vyos-1x-c8c42db4cc644cdec43d4d1cc8dd2905bad42df6.zip
cleanup: no need to call sudo for configuration mode scripts
Diffstat (limited to 'src/conf_mode/flow_accounting_conf.py')
-rwxr-xr-xsrc/conf_mode/flow_accounting_conf.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/conf_mode/flow_accounting_conf.py b/src/conf_mode/flow_accounting_conf.py
index a9ebab53e..b7e73eaeb 100755
--- a/src/conf_mode/flow_accounting_conf.py
+++ b/src/conf_mode/flow_accounting_conf.py
@@ -84,7 +84,7 @@ def _iptables_get_nflog():
for iptables_variant in ['iptables', 'ip6tables']:
# run iptables, save output and split it by lines
- iptables_command = "sudo {0} -t {1} -S {2}".format(iptables_variant, iptables_nflog_table, iptables_nflog_chain)
+ iptables_command = f'{iptables_variant} -t {iptables_nflog_table} -S {iptables_nflog_chain}'
tmp = cmd(iptables_command, message='Failed to get flows list')
# parse each line and add information to list
@@ -118,7 +118,7 @@ def _iptables_config(configured_ifaces):
if interface not in configured_ifaces:
table = rule['table']
rule = rule['rule_definition']
- iptable_commands.append(f'sudo {iptables} -t {table} -D {rule}')
+ iptable_commands.append(f'{iptables} -t {table} -D {rule}')
else:
active_nflog_ifaces.append({
'iface': interface,
@@ -135,7 +135,7 @@ def _iptables_config(configured_ifaces):
iface = iface_extended['iface']
iptables = iface_extended['iptables_variant']
rule_definition = f'{iptables_nflog_chain} -i {iface} -m comment --comment FLOW_ACCOUNTING_RULE -j NFLOG --nflog-group 2 --nflog-size {default_captured_packet_size} --nflog-threshold 100'
- iptable_commands.append(f'sudo {iptables} -t {iptables_nflog_table} -I {rule_definition}')
+ iptable_commands.append(f'{iptables} -t {iptables_nflog_table} -I {rule_definition}')
# change iptables
for command in iptable_commands: