vlanm script improved

This commit is contained in:
Dirk Alders 2023-10-02 23:02:56 +02:00
parent d7e8e5fa90
commit dd58a6905e

4
vlanm
View File

@ -62,7 +62,7 @@ if __name__ == "__main__":
print("Remove rule:", UID_O)
if getpass('Proceed? [Y/n]') in ['', 'y', 'Y']:
if rn is None:
my_cmd = ['sudo', '-S', 'iptables', '-A', 'FORWARD', '-j', 'ACCEPT', '-i', device_by_vlan(args.vlan_number), '-o', 'eth0', '!', '-d', '192.168.0.0/16', '-m', 'comment', '--comment', UID_O]
my_cmd = ['sudo', '-S', 'iptables', '-A', 'FORWARD', '-j', 'ACCEPT', '-i', device_by_vlan(args.vlan_number), '-o', device_by_vlan(10), '!', '-d', '192.168.0.0/16', '-m', 'comment', '--comment', UID_O]
cmd = subprocess.run(my_cmd, stdout=subprocess.PIPE, input=password, encoding="ascii",)
print(cmd.stdout)
else:
@ -79,7 +79,7 @@ if __name__ == "__main__":
print("Remove rule:", UID_L)
if getpass('Proceed? [Y/n]') in ['', 'y', 'Y']:
if rn is None:
my_cmd = ['sudo', '-S', 'iptables', '-A', 'FORWARD', '-j', 'LOG', '-i', device_by_vlan(args.vlan_number), '-o', 'eth0', '!', '-d', '192.168.0.0/16', '-m', 'comment', '--comment', UID_L]
my_cmd = ['sudo', '-S', 'iptables', '-A', 'FORWARD', '-j', 'LOG', '-i', device_by_vlan(args.vlan_number), '-o', device_by_vlan(10), '!', '-d', '192.168.0.0/16', '-m', 'comment', '--comment', UID_L]
cmd = subprocess.run(my_cmd, stdout=subprocess.PIPE, input=password, encoding="ascii",)
print(cmd.stdout)
print("Use 'sudo ~/bin/ftail /var/log/kern.log' to view the logs.")