summaryrefslogtreecommitdiff
path: root/data/templates/squid/squidGuard.conf.tmpl
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2022-04-13 22:52:06 +0200
committerChristian Poessinger <christian@poessinger.com>2022-04-13 22:52:06 +0200
commit681b9448ba24a68f436655aad99f690bfdac6339 (patch)
treeb307f252ed74932c6c19ae5ff21e8d39e5524ad2 /data/templates/squid/squidGuard.conf.tmpl
parentfe7f40b6ee4f09bb204952bd051dfb64ca145152 (diff)
downloadvyos-1x-681b9448ba24a68f436655aad99f690bfdac6339.tar.gz
vyos-1x-681b9448ba24a68f436655aad99f690bfdac6339.zip
squid: T4333: migrate to new vyos_defined Jinja2 test
Diffstat (limited to 'data/templates/squid/squidGuard.conf.tmpl')
-rw-r--r--data/templates/squid/squidGuard.conf.tmpl34
1 files changed, 17 insertions, 17 deletions
diff --git a/data/templates/squid/squidGuard.conf.tmpl b/data/templates/squid/squidGuard.conf.tmpl
index c59dc901e..5e877f01f 100644
--- a/data/templates/squid/squidGuard.conf.tmpl
+++ b/data/templates/squid/squidGuard.conf.tmpl
@@ -8,14 +8,14 @@ dest {{ category }}-default {
{% if expressions | is_file %}
expressionlist {{ category }}/expressions
{% endif %}
-{% if log is defined %}
+{% if log is vyos_defined %}
log blacklist.log
{% endif %}
}
{% endmacro %}
-{% if url_filtering is defined and url_filtering.disable is not defined %}
-{% if url_filtering.squidguard is defined and url_filtering.squidguard is not none %}
+{% if url_filtering is vyos_defined and url_filtering.disable is not vyos_defined %}
+{% if url_filtering.squidguard is vyos_defined %}
{% set sg_config = url_filtering.squidguard %}
{% set acl = namespace(value='local-ok-default') %}
{% set acl.value = acl.value + ' !in-addr' if sg_config.allow_ipaddr_url is not defined else acl.value %}
@@ -32,52 +32,52 @@ rewrite safesearch {
log rewrite.log
}
-{% if sg_config.local_ok is defined and sg_config.local_ok is not none %}
+{% if sg_config.local_ok is vyos_defined %}
{% set acl.value = acl.value + ' local-ok-default' %}
dest local-ok-default {
domainlist local-ok-default/domains
}
{% endif %}
-{% if sg_config.local_ok_url is defined and sg_config.local_ok_url is not none %}
+{% if sg_config.local_ok_url is vyos_defined %}
{% set acl.value = acl.value + ' local-ok-url-default' %}
dest local-ok-url-default {
urllist local-ok-url-default/urls
}
{% endif %}
-{% if sg_config.local_block is defined and sg_config.local_block is not none %}
+{% if sg_config.local_block is vyos_defined %}
{% set acl.value = acl.value + ' !local-block-default' %}
dest local-block-default {
domainlist local-block-default/domains
}
{% endif %}
-{% if sg_config.local_block_url is defined and sg_config.local_block_url is not none %}
+{% if sg_config.local_block_url is vyos_defined %}
{% set acl.value = acl.value + ' !local-block-url-default' %}
dest local-block-url-default {
urllist local-block-url-default/urls
}
{% endif %}
-{% if sg_config.local_block_keyword is defined and sg_config.local_block_keyword is not none %}
+{% if sg_config.local_block_keyword is vyos_defined %}
{% set acl.value = acl.value + ' !local-block-keyword-default' %}
dest local-block-keyword-default {
expressionlist local-block-keyword-default/expressions
}
{% endif %}
-{% if sg_config.block_category is defined and sg_config.block_category is not none %}
+{% if sg_config.block_category is vyos_defined %}
{% for category in sg_config.block_category %}
{{ sg_rule(category, sg_config.log, squidguard_db_dir) }}
{% set acl.value = acl.value + ' !' + category + '-default' %}
{% endfor %}
{% endif %}
-{% if sg_config.allow_category is defined and sg_config.allow_category is not none %}
+{% if sg_config.allow_category is vyos_defined %}
{% for category in sg_config.allow_category %}
{{ sg_rule(category, False, squidguard_db_dir) }}
{% set acl.value = acl.value + ' ' + category + '-default' %}
{% endfor %}
{% endif %}
-{% if sg_config.source_group is defined and sg_config.source_group is not none %}
+{% if sg_config.source_group is vyos_defined %}
{% for sgroup, sg_config in sg_config.source_group.items() %}
-{% if sg_config.address is defined and sg_config.address is not none %}
+{% if sg_config.address is vyos_defined %}
src {{ sgroup }} {
{% for address in sg_config.address %}
ip {{ address }}
@@ -87,7 +87,7 @@ src {{ sgroup }} {
{% endif %}
{% endfor %}
{% endif %}
-{% if sg_config.rule is defined and sg_config.rule is not none %}
+{% if sg_config.rule is vyos_defined %}
{% for rule, rule_config in sg_config.rule.items() %}
{% for b_category in rule_config.block_category%}
dest {{ b_category }} {
@@ -99,7 +99,7 @@ dest {{ b_category }} {
{% endfor %}
{% endif %}
acl {
-{% if sg_config.rule is defined and sg_config.rule is not none %}
+{% if sg_config.rule is vyos_defined %}
{% for rule, rule_config in sg_config.rule.items() %}
{{ rule_config.source_group }} {
{% for b_category in rule_config.block_category%}
@@ -110,12 +110,12 @@ acl {
{% endif %}
default {
-{% if sg_config.enable_safe_search is defined %}
+{% if sg_config.enable_safe_search is vyos_defined %}
rewrite safesearch
{% endif %}
- pass {{ acl.value }} {{ 'none' if sg_config.default_action is defined and sg_config.default_action == 'block' else 'allow' }}
+ pass {{ acl.value }} {{ 'none' if sg_config.default_action is vyos_defined('block') else 'allow' }}
redirect 302:http://{{ sg_config.redirect_url }}
-{% if sg_config.log is defined and sg_config.log is not none %}
+{% if sg_config.log is vyos_defined %}
log blacklist.log
{% endif %}
}