Browse Source

listening to god rn

aeth 9 months ago
parent
commit
89005ea577

+ 2 - 0
tasks/tasks_variable_validation/vpn/task_variable_validation.yml

@@ -5,5 +5,7 @@
       - machine_subtype is string
       - vpn_network_address is string
       - vpn_server_port >= 1 and vpn_server_port <= 65535
+      - vpn_netmaks is number
+      - peers is list
       - client_public_key is string
       - client_vpn_address is string

+ 4 - 4
templates/wg0.conf.j2

@@ -1,5 +1,5 @@
 [Interface]
-Address = {{ vpn_network_address }}
+Address = {{ vpn_network_address }}/{{ vpn_netmask}}
 SaveConfig = true
 ListenPort = {{ vpn_server_port }}
 PrivateKey = {{ vpn_private_key_content }}
@@ -11,8 +11,8 @@ 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
-
+{% for peer in peers}
 [Peer]
 PublicKey = {{ client_public_key }}
-AllowedIPs = {{ client_vpn_address }}
-
+AllowedIPs = {{ client_vpn_address }}/{{ vpn_netmask }}
+{% endfor %}