adc/ansible/roles/wg_vpn/templates/wg0.conf
jowj e40b68e623 Fix the idiot mistakes i made in postup/down rules.
- you'll note i fucked up interface name
- and missing an argument :(
2020-01-13 16:27:33 -06:00

34 lines
1.4 KiB
Plaintext

[Interface]
PrivateKey = {{ wireguard_server_privkey }}
{#
We want the Address field here to be an IP address
with the whole network in CIDR notation, like 10.0.0.1/24.
If wireguard_vpn_network is a CIDR network like 10.0.0.0/24,
and wireguard_server_offset is an integer like 1,
this will produce an offset of the start of the network + CIDR prefix,
which in this case will be the desired 10.0.0.1/24.
#}
Address = {{ wireguard_vpn_network | ipaddr(wireguard_server_offset) }}
ListenPort = {{ wireguard_server_listen_port }}
PostUp = iptables -A FORWARD -i %i -j ACCEPT; iptables -A FORWARD -o %i -j ACCEPT; iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
PostDown = iptables -D FORWARD -i %i -j ACCEPT; iptables -D FORWARD -o %i -j ACCEPT; iptables -t nat -D POSTROUTING -o eth0 -j MASQUERADE
{% for client in wireguard_clients %}
[Peer]
# {{ client.name }}
PublicKey = {{ client.pubkey }}
{#
We want the Address field here to be an IP address
withOUT the whole network in CIDR notation, like 10.0.0.15/32.
If wireguard_vpn_network is a CIDR network like 10.0.0.0/24,
and client.offset is an integer like 15,
this will produce an offset of the start of the network with a /32 CIDR prefix
which in this case will be the desired 10.0.0.15/32.
#}
AllowedIPs = {{ wireguard_vpn_network | ipsubnet(32, client.offset) }}
{% endfor %}