Browse Source

populating server config with client values

aeth 9 months ago
parent
commit
54e749f3a2

+ 3 - 1
tasks/tasks_variable_validation/vpn/task_variable_validation.yml

@@ -4,4 +4,6 @@
     that:
       - machine_subtype is string
       - vpn_network_address is string
-      - vpn_server_port >= 1 and vpn_server_port <= 65535
+      - vpn_server_port >= 1 and vpn_server_port <= 65535
+      - client_public_key is string
+      - client_vpn_address is string

+ 4 - 0
templates/wg0.conf.j2

@@ -12,3 +12,7 @@ PreDown = iptables -t nat -D POSTROUTING -o eth0 -j MASQUERADE
 PostUp     = firewall-cmd --zone=public --add-port {{ vpn_server_port }}/udp && firewall-cmd --zone=public --add-masquerade
 PostDown   = firewall-cmd --zone=public --remove-port {{ vpn_server_port }}/udp && firewall-cmd --zone=public --remove-masquerade
 
+[Peer]
+PublicKey = {{ client_public_key }}
+AllowedIPs = {{ client_vpn_address }}
+