summaryrefslogtreecommitdiff
path: root/src/conf_mode/vpn_openconnect.py
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2022-08-20 16:15:37 +0200
committerGitHub <noreply@github.com>2022-08-20 16:15:37 +0200
commit26361076d2b4136dae9ba426c486430002b6e9ac (patch)
treefcc5be19c276aaadb6e306589eaa65cb15e60027 /src/conf_mode/vpn_openconnect.py
parentd247bc04b765a92c973ef93d94f8955312fdc13c (diff)
parentc0f5d00d92667f2a45896180cd05747c3ba82782 (diff)
downloadvyos-1x-26361076d2b4136dae9ba426c486430002b6e9ac.tar.gz
vyos-1x-26361076d2b4136dae9ba426c486430002b6e9ac.zip
Merge pull request #1481 from sever-sever/T4597
ocserv: T4597: Fix check bounded port by service itself
Diffstat (limited to 'src/conf_mode/vpn_openconnect.py')
-rwxr-xr-xsrc/conf_mode/vpn_openconnect.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/conf_mode/vpn_openconnect.py b/src/conf_mode/vpn_openconnect.py
index a3e774678..240546817 100755
--- a/src/conf_mode/vpn_openconnect.py
+++ b/src/conf_mode/vpn_openconnect.py
@@ -25,6 +25,7 @@ from vyos.template import render
from vyos.util import call
from vyos.util import check_port_availability
from vyos.util import is_systemd_service_running
+from vyos.util import is_listen_port_bind_service
from vyos.util import dict_search
from vyos.xml import defaults
from vyos import ConfigError
@@ -77,8 +78,10 @@ def verify(ocserv):
if ocserv is None:
return None
# Check if listen-ports not binded other services
+ # It can be only listen by 'ocserv-main'
for proto, port in ocserv.get('listen_ports').items():
- if check_port_availability('0.0.0.0', int(port), proto) is not True:
+ if check_port_availability('0.0.0.0', int(port), proto) is not True and \
+ not is_listen_port_bind_service(int(port), 'ocserv-main'):
raise ConfigError(f'"{proto}" port "{port}" is used by another service')
# Check authentication
if "authentication" in ocserv: