diff options
author | Christian Poessinger <christian@poessinger.com> | 2020-12-26 16:42:44 +0100 |
---|---|---|
committer | Christian Poessinger <christian@poessinger.com> | 2020-12-28 19:42:50 +0100 |
commit | b9a2312f02e40b16d5b85454eadd84dc3cb7bea8 (patch) | |
tree | ed114ee4619cb210a92d02416f3554531f393304 /src/conf_mode/service_webproxy.py | |
parent | e7649f9cf4f6beda6adb50998db3e57964bd5010 (diff) | |
download | vyos-1x-b9a2312f02e40b16d5b85454eadd84dc3cb7bea8.tar.gz vyos-1x-b9a2312f02e40b16d5b85454eadd84dc3cb7bea8.zip |
webproxy: T563: add squidguard body
Diffstat (limited to 'src/conf_mode/service_webproxy.py')
-rwxr-xr-x | src/conf_mode/service_webproxy.py | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/src/conf_mode/service_webproxy.py b/src/conf_mode/service_webproxy.py index 332e10329..76b72ad48 100755 --- a/src/conf_mode/service_webproxy.py +++ b/src/conf_mode/service_webproxy.py @@ -29,7 +29,8 @@ from vyos import ConfigError from vyos import airbag airbag.enable() -config_file = '/etc/squid/squid.conf' +squid_config_file = '/etc/squid/squid.conf' +squidguard_config_file = '/etc/squidguard/squidGuard.conf' def get_config(config=None): if config: @@ -45,9 +46,15 @@ def get_config(config=None): # options which we need to update into the dictionary retrived. default_values = defaults(base) - # if no authentication method is supplid, no need to add defaults + # if no authentication method is supplied, no need to add defaults if not dict_search('authentication.method', proxy): default_values.pop('authentication') + # if no url_filteringurl-filtering method is supplied, no need to add defaults + if 'url_filtering' not in proxy: + default_values.pop('url_filtering') + else: + # store path to squidGuard config, used when generating Squid config + proxy['squidguard_conf'] = squidguard_config_file # XXX: T2665: blend in proper cache-peer default values later default_values.pop('cache_peer') @@ -118,15 +125,21 @@ def generate(proxy): if not proxy: return None - render(config_file, 'squid/squid.conf.tmpl', proxy) + render(squid_config_file, 'squid/squid.conf.tmpl', proxy) + render(squidguard_config_file, 'squid/squidGuard.conf.tmpl', proxy) + return None def apply(proxy): if not proxy: # proxy is removed in the commit call('systemctl stop squid.service') - if os.path.exists(config_file): - os.unlink(config_file) + + if os.path.exists(squid_config_file): + os.unlink(squid_config_file) + if os.path.exists(squidguard_config_file): + os.unlink(squidguard_config_file) + return None call('systemctl restart squid.service') |