2022-12-09 22:45:58 +01:00
|
|
|
[Interface]
|
|
|
|
PrivateKey = {{ vpn_wireguard_interface_private_key }}
|
|
|
|
{% if vpn_wireguard_role == "server" %}
|
|
|
|
ListenPort = {{ vpn_wireguard_port }}
|
|
|
|
{% endif %}
|
|
|
|
|
|
|
|
{% if vpn_wireguard_role == "server" %}
|
|
|
|
{% for client in vpn_wireguard_clients %}
|
|
|
|
[Peer]
|
|
|
|
PublicKey = {{ client.public_key }}
|
2022-12-10 01:03:32 +01:00
|
|
|
PresharedKey = {{ client.preshared_key }}
|
|
|
|
{% if 'subnet' in client %}
|
2022-12-09 22:45:58 +01:00
|
|
|
AllowedIPs = {{ vpn_wireguard_subnet }},{{ client.subnet }}
|
|
|
|
{% else %}
|
2022-12-10 01:03:32 +01:00
|
|
|
AllowedIPs = {{ vpn_wireguard_subnet }}
|
2022-12-09 22:45:58 +01:00
|
|
|
{% endif %}
|
|
|
|
|
|
|
|
{% endfor %}
|
|
|
|
{% elif vpn_wireguard_role == "client" %}
|
|
|
|
[Peer]
|
|
|
|
PublicKey = {{ vpn_wireguard_server_public_key }}
|
2022-12-10 01:03:32 +01:00
|
|
|
PresharedKey = {{ vpn_wireguard_server_preshared_key }}
|
2022-12-09 22:45:58 +01:00
|
|
|
Endpoint = {{ vpn_wireguard_server_address }}:{{ vpn_wireguard_port }}
|
|
|
|
AllowedIPs = 0.0.0.0/0
|
|
|
|
PersistentKeepalive = 15
|
|
|
|
|
|
|
|
{% endif %}
|