Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

webproxy: T7057: Fixed 'domain-nocache' command #4344

Merged
merged 1 commit into from
Feb 11, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions data/templates/squid/squid.conf.j2
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down
18 changes: 17 additions & 1 deletion smoketest/scripts/cli/test_service_webproxy.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -297,6 +297,22 @@ def test_05_basic_squidguard(self):
# 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)
Loading