mirror of
https://github.com/trailofbits/algo.git
synced 2025-06-07 15:43:54 +02:00
Extra line and better DNS configuration for WireGuard (#968)
- Adds an extra line after the if statement. Jinja2 trims such blocks by default in Ansible. Fixes #965 - More appropriate way to configure DNS servers - Removes `DNS` option from the wireguard server config - Fixes dnscrypt-proxy restart
This commit is contained in:
parent
b928e4ff06
commit
d56f50180b
6 changed files with 10 additions and 5 deletions
|
@ -89,7 +89,6 @@
|
||||||
- iptables-persistent
|
- iptables-persistent
|
||||||
- cgroup-tools
|
- cgroup-tools
|
||||||
- openssl
|
- openssl
|
||||||
- resolvconf
|
|
||||||
sysctl:
|
sysctl:
|
||||||
- item: net.ipv4.ip_forward
|
- item: net.ipv4.ip_forward
|
||||||
value: 1
|
value: 1
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
daemon_reload: true
|
daemon_reload: true
|
||||||
|
|
||||||
- name: restart dnscrypt-proxy
|
- name: restart dnscrypt-proxy
|
||||||
service:
|
systemd:
|
||||||
name: dnscrypt-proxy
|
name: dnscrypt-proxy
|
||||||
state: restarted
|
state: restarted
|
||||||
|
daemon_reload: true
|
||||||
|
|
|
@ -42,5 +42,4 @@
|
||||||
[Service]
|
[Service]
|
||||||
AmbientCapabilities=CAP_NET_BIND_SERVICE
|
AmbientCapabilities=CAP_NET_BIND_SERVICE
|
||||||
notify:
|
notify:
|
||||||
- daemon-reload
|
|
||||||
- restart dnscrypt-proxy
|
- restart dnscrypt-proxy
|
||||||
|
|
|
@ -16,3 +16,9 @@ wireguard_network_ipv6:
|
||||||
wireguard_vpn_network: "{{ wireguard_network_ipv4['subnet'] }}/{{ wireguard_network_ipv4['prefix'] }}"
|
wireguard_vpn_network: "{{ wireguard_network_ipv4['subnet'] }}/{{ wireguard_network_ipv4['prefix'] }}"
|
||||||
wireguard_vpn_network_ipv6: "{{ wireguard_network_ipv6['subnet'] }}/{{ wireguard_network_ipv6['prefix'] }}"
|
wireguard_vpn_network_ipv6: "{{ wireguard_network_ipv6['subnet'] }}/{{ wireguard_network_ipv6['prefix'] }}"
|
||||||
easyrsa_reinit_existent: false
|
easyrsa_reinit_existent: false
|
||||||
|
wireguard_dns_servers: >-
|
||||||
|
{% if local_dns|default(false)|bool or dns_encryption|default(false)|bool == true %}
|
||||||
|
{{ local_service_ip }}
|
||||||
|
{% else %}
|
||||||
|
{% for host in dns_servers.ipv4 %}{{ host }}{% if not loop.last %},{% endif %}{% endfor %}{% if ipv6_support %},{% for host in dns_servers.ipv6 %}{{ host }}{% if not loop.last %},{% endif %}{% endfor %}{% endif %}
|
||||||
|
{% endif %}
|
||||||
|
|
|
@ -2,7 +2,8 @@
|
||||||
PrivateKey = {{ lookup('file', wireguard_config_path + '/private/' + item.1) }}
|
PrivateKey = {{ lookup('file', wireguard_config_path + '/private/' + item.1) }}
|
||||||
Address = {{ wireguard_network_ipv4['clients_range'] }}.{{ wireguard_network_ipv4['clients_start'] + item.0 + 1 }}/32{% if ipv6_support %},{{ wireguard_network_ipv6['clients_range'] }}{{ wireguard_network_ipv6['clients_start'] + item.0 + 1 }}/{{ wireguard_network_ipv6['prefix'] }}
|
Address = {{ wireguard_network_ipv4['clients_range'] }}.{{ wireguard_network_ipv4['clients_start'] + item.0 + 1 }}/32{% if ipv6_support %},{{ wireguard_network_ipv6['clients_range'] }}{{ wireguard_network_ipv6['clients_start'] + item.0 + 1 }}/{{ wireguard_network_ipv6['prefix'] }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
DNS = {{ local_service_ip }}
|
|
||||||
|
DNS = {{ wireguard_dns_servers }}
|
||||||
|
|
||||||
[Peer]
|
[Peer]
|
||||||
PublicKey = {{ lookup('file', wireguard_config_path + '/public/' + IP_subject_alt_name) }}
|
PublicKey = {{ lookup('file', wireguard_config_path + '/public/' + IP_subject_alt_name) }}
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
Address = {{ wireguard_network_ipv4['subnet'] }}/{{ wireguard_network_ipv4['prefix'] }}{% if ipv6_support %},{{ wireguard_network_ipv6['gateway'] }}/{{ wireguard_network_ipv6['prefix'] }}
|
Address = {{ wireguard_network_ipv4['subnet'] }}/{{ wireguard_network_ipv4['prefix'] }}{% if ipv6_support %},{{ wireguard_network_ipv6['gateway'] }}/{{ wireguard_network_ipv6['prefix'] }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
DNS = {{ local_service_ip }}
|
|
||||||
ListenPort = {{ wireguard_port }}
|
ListenPort = {{ wireguard_port }}
|
||||||
PrivateKey = {{ lookup('file', wireguard_config_path + '/private/' + IP_subject_alt_name) }}
|
PrivateKey = {{ lookup('file', wireguard_config_path + '/private/' + IP_subject_alt_name) }}
|
||||||
SaveConfig = true
|
SaveConfig = true
|
||||||
|
|
Loading…
Add table
Reference in a new issue