2020-12-02 18:11:18 +01:00
|
|
|
[Interface]
|
|
|
|
Address = {{ vpn_network }}.1/24
|
2020-12-02 22:10:02 +01:00
|
|
|
SaveConfig = false
|
2020-12-02 18:11:18 +01:00
|
|
|
ListenPort = {{ vpn_port }}
|
2020-12-27 14:25:20 +01:00
|
|
|
PrivateKey = {{ vpn_server_private_key.stdout }}
|
2020-12-02 22:10:02 +01:00
|
|
|
PostUp = iptables -A FORWARD -i wg0 -j ACCEPT; iptables -t nat -A POSTROUTING -o ens5 -j MASQUERADE; ip6tables -A FORWARD -i wg0 -j ACCEPT; ip6tables -t nat -A POSTROUTING -o ens5 -j MASQUERADE
|
|
|
|
PostDown = iptables -D FORWARD -i wg0 -j ACCEPT; iptables -t nat -D POSTROUTING -o ens5 -j MASQUERADE; ip6tables -D FORWARD -i wg0 -j ACCEPT; ip6tables -t nat -D POSTROUTING -o ens5 -j MASQUERADE
|
2020-12-02 18:11:18 +01:00
|
|
|
|
2020-12-27 14:25:20 +01:00
|
|
|
{% for i in range(vpn_client_public_keys.results|int) %}
|
2020-12-02 18:11:18 +01:00
|
|
|
[Peer]
|
2020-12-27 14:25:20 +01:00
|
|
|
PublicKey = {{ vpn_client_public_keys.results[i].stdout }}
|
2020-12-02 18:11:18 +01:00
|
|
|
AllowedIPs = {{ vpn_network }}.{{ i + 2 }}/32
|
|
|
|
|
|
|
|
{% endfor %}
|