diff options
| author | Kumar <kumar@kumardamani.xyz> | 2021-11-23 14:59:08 +0000 |
|---|---|---|
| committer | Kumar Damani <me@kumardamani.net> | 2022-03-25 19:45:25 +0000 |
| commit | a857eb82ec9c4a79ad5e41462e2ab82c2660982e (patch) | |
| tree | 9ca51ddfb551322bd4d2fa3f949fa8898032632d /roles/wireguard_client/templates | |
initial commit
Diffstat (limited to 'roles/wireguard_client/templates')
| -rw-r--r-- | roles/wireguard_client/templates/wg0.conf.j2 | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/roles/wireguard_client/templates/wg0.conf.j2 b/roles/wireguard_client/templates/wg0.conf.j2 new file mode 100644 index 0000000..d667d8a --- /dev/null +++ b/roles/wireguard_client/templates/wg0.conf.j2 @@ -0,0 +1,16 @@ +# {{ ansible_managed }} + +[Interface] +Address = {{ wireguard_client_peer_ip }} +PostUp = wg set %i private-key /etc/wireguard/privatekey +PostUp = ping -c1 192.168.10.1 +{% for port in wireguard_client_port_forwards %} +PostUp = iptables -t nat -A PREROUTING -p tcp --dport {{ port }} -j DNAT --to-destination 192.168.10.1:{{ port }} +{% endfor %} +PostUp = iptables -t nat -A POSTROUTING -j MASQUERADE + +[Peer] +PublicKey = {{ wireguard_client_server_pub_key }} +AllowedIPs = {{ wireguard_client_server_allowed_ips }} +Endpoint = {{ wireguard_client_server_endpoint }}:{{ wireguard_client_server_listen_port }} +PersistentKeepalive = 20 |
