From 3f7901d2db7255ee9ef1e72c40ef9600b97718d2 Mon Sep 17 00:00:00 2001 From: Max Erenberg <> Date: Sat, 18 Dec 2021 12:59:48 -0500 Subject: [PATCH] update proxy_pass regex --- ceod/model/VHostManager.py | 2 +- tests/ceod/model/test_vhosts.py | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/ceod/model/VHostManager.py b/ceod/model/VHostManager.py index 2c50a21..c3f052b 100644 --- a/ceod/model/VHostManager.py +++ b/ceod/model/VHostManager.py @@ -16,7 +16,7 @@ from ceo_common.logger_factory import logger_factory from ceo_common.interfaces import IVHostManager, IConfig PROXY_PASS_IP_RE = re.compile( - r'^\s+proxy_pass\s+http://(?P[\d.]+(:\d{2,5})?);$' + r'^\s+proxy_pass\s+http://(?P[\w.:-]+);$' ) VHOST_FILENAME_RE = re.compile(r'^(?P[0-9a-z-]+)_(?P[0-9a-z.-]+)$') VALID_DOMAIN_RE = re.compile(r'^(?:[0-9a-z-]+\.)+[a-z]+$') diff --git a/tests/ceod/model/test_vhosts.py b/tests/ceod/model/test_vhosts.py index a4e0ad0..a646f1f 100644 --- a/tests/ceod/model/test_vhosts.py +++ b/tests/ceod/model/test_vhosts.py @@ -36,6 +36,17 @@ def test_vhost_mgr(vhost_mgr): assert vhost_mgr.get_num_vhosts(username) == 0 os.unlink(rate_limit_file) + vhost_mgr.create_vhost(username, domain, ip_address + ':8000') + os.unlink(rate_limit_file) + domain3 = username + '.k8s.csclub.cloud' + vhost_mgr.create_vhost(username, domain3, 'k8s') + assert vhost_mgr.get_vhosts(username) == [ + {'domain': domain, 'ip_address': ip_address + ':8000'}, + {'domain': domain3, 'ip_address': 'k8s'}, + ] + + vhost_mgr.delete_all_vhosts_for_user(username) + os.unlink(rate_limit_file) @pytest.mark.parametrize('suffix', ['csclub.cloud', 'k8s.csclub.cloud'])