security/tinc - subnet-down script was added to tinc plugin (#3591)

This commit is contained in:
Andrew 2023-09-18 14:35:13 +02:00 committed by GitHub
parent bea60a2883
commit dd073fd6a6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 1 deletions

View File

@ -1,5 +1,6 @@
PLUGIN_NAME= tinc
PLUGIN_VERSION= 1.7
PLUGIN_REVISION= 1
PLUGIN_COMMENT= Tinc VPN
PLUGIN_DEPENDS= tinc
PLUGIN_MAINTAINER= ad@opnsense.org

View File

@ -96,7 +96,7 @@ def deploy(config_filename):
if_up.append("configctl interface %s %s" % (interface_configd, interface_name))
write_file("%s/tinc-up" % network.get_basepath(), '\n'.join(if_up) + "\n", 0o700)
# write subnet-up file and ship required binaries into the chroot
# write subnet-{up|down} scripts and ship required binaries into the chroot
chroot_needs = set(['/bin/sh', '/sbin/route', '/libexec/ld-elf.so.1'])
for item in list(chroot_needs):
for line in subprocess.run(['/usr/bin/ldd', item], capture_output=True, text=True).stdout.split('\n'):
@ -109,6 +109,10 @@ def deploy(config_filename):
"#!/bin/sh",
"route add $SUBNET -iface %s\n" % interface_name
]), 0o700)
write_file("%s/subnet-down" % network.get_basepath(), '\n'.join([
"#!/bin/sh",
"route delete $SUBNET -iface %s\n" % interface_name
]), 0o700)
# configure and rename new tun device, place all in group "tinc" symlink associated tun device
if interface_name not in interfaces: