♻️: refactor allowlist
This commit is contained in:
@@ -42,10 +42,10 @@ frontend http
|
||||
acl letsencrypt path_beg /.well-known/acme-challenge
|
||||
redirect scheme https code 301 if !letsencrypt
|
||||
{% for server in groups['webservers'] | difference(groups['disabled_loadbalanced_webservers']) | sort %}
|
||||
{% for hostname in hostvars[server]['web_hostname'] | sort %}
|
||||
## {{ hostname }} configuration
|
||||
acl host_{{ hostname }} hdr(host) -i {{ hostname }}
|
||||
use_backend http_{{ server }} if letsencrypt host_{{ hostname }}
|
||||
{% for hostname in hostvars[server]['web_hostname'] | sort(attribute='host') %}
|
||||
## {{ hostname.host }} configuration
|
||||
acl host_{{ hostname.host }} hdr(host) -i {{ hostname.host }}
|
||||
use_backend http_{{ server }} if letsencrypt host_{{ hostname.host }}
|
||||
|
||||
{% endfor %}
|
||||
{% endfor %}
|
||||
@@ -57,13 +57,14 @@ frontend https
|
||||
tcp-request inspect-delay 3s
|
||||
tcp-request content accept if { req.ssl_hello_type 1 }
|
||||
{% for server in groups['webservers'] | difference(groups['disabled_loadbalanced_webservers']) | sort %}
|
||||
{% for hostname in hostvars[server]['web_hostname'] | sort %}
|
||||
## {{ hostname }} configuration
|
||||
acl host_{{ hostname }} req.ssl_sni -i {{ hostname }}
|
||||
{% if hostname == "btf.mateu.be" %}
|
||||
acl network_allowed_{{ hostname }} src 88.175.123.77
|
||||
{% for hostname in hostvars[server]['web_hostname'] | sort(attribute='host') %}
|
||||
## {{ hostname.host }} configuration
|
||||
acl host_{{ hostname.host }} req.ssl_sni -i {{ hostname.host }}
|
||||
{% if hostname.allowlistv4 is defined %}
|
||||
acl network_allowed_{{ hostname.host }} src {% for addrv4 in hostname.allowlistv4 %}{{ addrv4 }}{% endfor %}
|
||||
|
||||
{% endif %}
|
||||
use_backend https_{{ server }} if host_{{ hostname }}{% if hostname == "btf.mateu.be" %} network_allowed_{{ hostname }}{% endif %}
|
||||
use_backend https_{{ server }} if host_{{ hostname.host }}{% if hostname.allowlistv4 is defined %} network_allowed_{{ hostname.host }}{% endif %}
|
||||
|
||||
|
||||
{% endfor %}
|
||||
|
Reference in New Issue
Block a user