From d77f68ef3198cff019e1e2d74dfe2290800a1ea6 Mon Sep 17 00:00:00 2001 From: Christian Poessinger Date: Tue, 24 Sep 2019 18:04:17 +0200 Subject: Python/ifconfig: T1557: refactor 'mtu' property to get_mtu()/set_mtu() --- src/conf_mode/interface-openvpn.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'src/conf_mode/interface-openvpn.py') diff --git a/src/conf_mode/interface-openvpn.py b/src/conf_mode/interface-openvpn.py index 35e7928c2..fa01f7fc5 100755 --- a/src/conf_mode/interface-openvpn.py +++ b/src/conf_mode/interface-openvpn.py @@ -13,8 +13,6 @@ # # You should have received a copy of the GNU General Public License # along with this program. If not, see . -# -# import os import re @@ -580,7 +578,7 @@ def get_config(): # Minimum required TLS version if conf.exists('tls tls-version-min'): openvpn['tls_version_min'] = conf.return_value('tls tls-version-min') - + if conf.exists('shared-secret-key-file'): openvpn['shared_secret_file'] = conf.return_value('shared-secret-key-file') @@ -736,7 +734,7 @@ def verify(openvpn): if openvpn['tls_auth']: if not checkCertHeader('-----BEGIN OpenVPN Static key V1-----', openvpn['tls_auth']): raise ConfigError('Specified auth-file "{}" is invalid'.format(openvpn['tls_auth'])) - + if openvpn['tls_cert']: if not checkCertHeader('-----BEGIN CERTIFICATE-----', openvpn['tls_cert']): raise ConfigError('Specified cert-file "{}" is invalid'.format(openvpn['tls_cert'])) -- cgit v1.2.3 From 3aed7f2dad9326ae094edc94b996db4fce2e0b18 Mon Sep 17 00:00:00 2001 From: Christian Poessinger Date: Tue, 24 Sep 2019 21:01:42 +0200 Subject: openvpn: T1548: setup interface alias --- src/conf_mode/interface-openvpn.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src/conf_mode/interface-openvpn.py') diff --git a/src/conf_mode/interface-openvpn.py b/src/conf_mode/interface-openvpn.py index fa01f7fc5..57d565749 100755 --- a/src/conf_mode/interface-openvpn.py +++ b/src/conf_mode/interface-openvpn.py @@ -29,8 +29,9 @@ from pwd import getpwnam from subprocess import Popen, PIPE from time import sleep -from vyos.config import Config from vyos import ConfigError +from vyos.config import Config +from vyos.ifconfig import Interface from vyos.validate import is_addr_assigned user = 'openvpn' @@ -899,6 +900,13 @@ def apply(openvpn): # execute assembled command subprocess_cmd(cmd) + + # better late then sorry ... but we can only set interface alias after + # OpenVPN has been launched and created the interface + while openvpn['intf'] not in interfaces(): + sleep(0.250) # 250ms + Interface(openvpn['intf']).set_alias(openvpn['description']) + return None -- cgit v1.2.3