diff options
author | Christian Breunig <christian@breunig.cc> | 2025-02-11 19:34:12 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-02-11 19:34:12 +0100 |
commit | fba59f9e19679764e41cde045fb572291e9fb25f (patch) | |
tree | 65ce8223a374fe80b18d5df044bf497871b8abd2 | |
parent | 9c9bb35f414242ddd729de063de468a543b2d7c8 (diff) | |
parent | 43ecb3c9ac1e7d7a22a91ab4fe6d419f75d6ba96 (diff) | |
download | vyos-1x-fba59f9e19679764e41cde045fb572291e9fb25f.tar.gz vyos-1x-fba59f9e19679764e41cde045fb572291e9fb25f.zip |
Merge pull request #4344 from aapostoliuk/T7057-circinus
webproxy: T7057: Fixed 'domain-nocache' command
-rw-r--r-- | data/templates/squid/squid.conf.j2 | 8 | ||||
-rwxr-xr-x | smoketest/scripts/cli/test_service_webproxy.py | 18 |
2 files changed, 25 insertions, 1 deletions
diff --git a/data/templates/squid/squid.conf.j2 b/data/templates/squid/squid.conf.j2 index b953c8b18..4e3d702a8 100644 --- a/data/templates/squid/squid.conf.j2 +++ b/data/templates/squid/squid.conf.j2 @@ -30,6 +30,14 @@ acl BLOCKDOMAIN dstdomain {{ domain }} {% endfor %} http_access deny BLOCKDOMAIN {% endif %} + +{% if domain_noncache is vyos_defined %} +{% for domain in domain_noncache %} +acl NOCACHE dstdomain {{ domain }} +{% endfor %} +no_cache deny NOCACHE +{% endif %} + {% if authentication is vyos_defined %} {% if authentication.children is vyos_defined %} auth_param basic children {{ authentication.children }} diff --git a/smoketest/scripts/cli/test_service_webproxy.py b/smoketest/scripts/cli/test_service_webproxy.py index 2b3f6d21c..ab4707a61 100755 --- a/smoketest/scripts/cli/test_service_webproxy.py +++ b/smoketest/scripts/cli/test_service_webproxy.py @@ -1,6 +1,6 @@ #!/usr/bin/env python3 # -# Copyright (C) 2020-2022 VyOS maintainers and contributors +# Copyright (C) 2020-2025 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 @@ -297,6 +297,22 @@ class TestServiceWebProxy(VyOSUnitTestSHIM.TestCase): # Check for running process self.assertTrue(process_named_running(PROCESS_NAME)) + def test_06_nocache_domain_proxy(self): + domains_nocache = ['test1.net', 'test2.net'] + self.cli_set(base_path + ['listen-address', listen_ip]) + for domain in domains_nocache: + self.cli_set(base_path + ['domain-noncache', domain]) + # commit changes + self.cli_commit() + + config = read_file(PROXY_CONF) + + for domain in domains_nocache: + self.assertIn(f'acl NOCACHE dstdomain {domain}', config) + self.assertIn(f'no_cache deny NOCACHE', config) + + # Check for running process + self.assertTrue(process_named_running(PROCESS_NAME)) if __name__ == '__main__': unittest.main(verbosity=2) |