summaryrefslogtreecommitdiff
path: root/src/conf_mode
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2022-08-05 20:30:46 +0200
committerGitHub <noreply@github.com>2022-08-05 20:30:46 +0200
commit1b637f78b870f8ecc4971de5baf0a6fda54c40f7 (patch)
treefb77f3178c18a7bd61132257280a7d8a97bae79f /src/conf_mode
parent2a10ffa4b5074be27458159fa94d6227d0e5c7f7 (diff)
parente3209859935e5994a9767999fd78a9cece6566d4 (diff)
downloadvyos-1x-1b637f78b870f8ecc4971de5baf0a6fda54c40f7.tar.gz
vyos-1x-1b637f78b870f8ecc4971de5baf0a6fda54c40f7.zip
Merge pull request #1460 from sever-sever/T4597
ocserv: T4597: Check bind port before openconnect commit
Diffstat (limited to 'src/conf_mode')
-rwxr-xr-xsrc/conf_mode/vpn_openconnect.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/conf_mode/vpn_openconnect.py b/src/conf_mode/vpn_openconnect.py
index 8e0e30bbf..a3e774678 100755
--- a/src/conf_mode/vpn_openconnect.py
+++ b/src/conf_mode/vpn_openconnect.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python3
#
-# Copyright (C) 2018-2020 VyOS maintainers and contributors
+# Copyright (C) 2018-2022 VyOS maintainers and contributors
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 or later as
@@ -23,6 +23,7 @@ from vyos.pki import wrap_certificate
from vyos.pki import wrap_private_key
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 dict_search
from vyos.xml import defaults
@@ -75,6 +76,10 @@ def get_config():
def verify(ocserv):
if ocserv is None:
return None
+ # Check if listen-ports not binded other services
+ for proto, port in ocserv.get('listen_ports').items():
+ if check_port_availability('0.0.0.0', int(port), proto) is not True:
+ raise ConfigError(f'"{proto}" port "{port}" is used by another service')
# Check authentication
if "authentication" in ocserv:
if "mode" in ocserv["authentication"]: