dnf install -y wireguard-tools
# store secretkey cd /etc/wireguard/ # set permission for root only umask 077
wg genkey | tee client.key | wg pubkey > client.pub
[Interface] Address = ServerのVPN IP/24 ListenPort = 任意のポート PrivateKey = Serverの秘密鍵 # 起動時にFW設定 PostUp = firewall-cmd --add-port=任意のポート/udp PostDown = firewall-cmd --remove-port=任意のポート/udp [Peer] PublicKey = Clientの公開鍵 AllowedIPs = ClientのVPN IP/32
アプリ立ち上げて、設定ファイルを読み込む
/etc/wireguard/wg0.conf #ansibleでserver側に.sshに生成してあるのでそれを上記にコピー wg-quick up wg0