소스 검색

populating server config with client values

aeth 9 달 전
부모
커밋
54e749f3a2
2개의 변경된 파일7개의 추가작업 그리고 1개의 파일을 삭제
  1. 3 1
      tasks/tasks_variable_validation/vpn/task_variable_validation.yml
  2. 4 0
      templates/wg0.conf.j2

+ 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 }}
+