mirror of
https://github.com/opnsense/plugins.git
synced 2026-05-28 04:34:15 -04:00
security/tinc: merge 1.2_2 from master
This commit is contained in:
parent
ca78d18e97
commit
f61cb01fef
3 changed files with 10 additions and 2 deletions
|
|
@ -1,6 +1,6 @@
|
|||
PLUGIN_NAME= tinc
|
||||
PLUGIN_VERSION= 1.2
|
||||
PLUGIN_REVISION= 1
|
||||
PLUGIN_REVISION= 2
|
||||
PLUGIN_COMMENT= Tinc VPN
|
||||
PLUGIN_DEPENDS= tinc
|
||||
PLUGIN_MAINTAINER= ad@opnsense.org
|
||||
|
|
|
|||
|
|
@ -71,6 +71,9 @@ class Network(NetwConfObject):
|
|||
def get_local_address(self):
|
||||
return self._payload['intaddress']
|
||||
|
||||
def get_mode(self):
|
||||
return self._payload['mode']
|
||||
|
||||
def get_debuglevel(self):
|
||||
if len(self._payload['debuglevel']) > 1:
|
||||
return self._payload['debuglevel'][1]
|
||||
|
|
|
|||
|
|
@ -67,6 +67,11 @@ def deploy(config_filename):
|
|||
# interface name to use
|
||||
interface_name = 'tinc%s' % network.get_id()
|
||||
|
||||
# type of interface to use
|
||||
interface_type = 'tun'
|
||||
if network.get_mode() == 'switch':
|
||||
interface_type = 'tap'
|
||||
|
||||
# dump Network and host config
|
||||
for conf_obj in network.all():
|
||||
if conf_obj.is_valid():
|
||||
|
|
@ -84,7 +89,7 @@ def deploy(config_filename):
|
|||
|
||||
# configure and rename new tun device, place all in group "tinc" symlink associated tun device
|
||||
if interface_name not in interfaces:
|
||||
tundev = subprocess.check_output(['/sbin/ifconfig','tun','create']).split()[0]
|
||||
tundev = subprocess.check_output(['/sbin/ifconfig',interface_type,'create']).split()[0]
|
||||
subprocess.call(['/sbin/ifconfig',tundev,'name',interface_name])
|
||||
subprocess.call(['/sbin/ifconfig',interface_name,'group','tinc'])
|
||||
if os.path.islink('/dev/%s' % interface_name):
|
||||
|
|
|
|||
Loading…
Reference in a new issue