From 81381d2f25ed2cd2bd376d23fa5de074b7306ea8 Mon Sep 17 00:00:00 2001 From: aptalca Date: Tue, 26 Oct 2021 15:15:50 -0400 Subject: [PATCH] fix peer name --- README.md | 2 +- readme-vars.yml | 2 +- root/etc/cont-init.d/30-config | 3 ++- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 321fbe5..0cb6585 100644 --- a/README.md +++ b/README.md @@ -84,7 +84,7 @@ In order to customize the `AllowedIPs` statement for a specific peer in `wg0.con `SERVER_ALLOWEDIPS_PEER_laptop="192.168.1.0/24,192.168.2.0/24"` will result in the wg0.conf entry `AllowedIPs = 10.13.13.2,192.168.1.0/24,192.168.2.0/24` for the peer named `laptop`. -Keep in mind that this var will only be considered when the confs are regenerated. Adding this var for an existing peer won't force a regeneration. You can remove and readd a peer to force regeneration if necessary. +Keep in mind that this var will only be considered when the confs are regenerated. Adding this var for an existing peer won't force a regeneration. You can delete wg0.conf and restart the container to force regeneration if necessary. ## Client Mode Do not set the `PEERS` environment variable. Drop your client conf into the config folder as `/config/wg0.conf` and start the container. diff --git a/readme-vars.yml b/readme-vars.yml index 9c171d6..1a39b12 100644 --- a/readme-vars.yml +++ b/readme-vars.yml @@ -81,7 +81,7 @@ app_setup_block: | `SERVER_ALLOWEDIPS_PEER_laptop="192.168.1.0/24,192.168.2.0/24"` will result in the wg0.conf entry `AllowedIPs = 10.13.13.2,192.168.1.0/24,192.168.2.0/24` for the peer named `laptop`. - Keep in mind that this var will only be considered when the confs are regenerated. Adding this var for an existing peer won't force a regeneration. You can remove and readd a peer to force regeneration if necessary. + Keep in mind that this var will only be considered when the confs are regenerated. Adding this var for an existing peer won't force a regeneration. You can delete wg0.conf and restart the container to force regeneration if necessary. ## Client Mode Do not set the `PEERS` environment variable. Drop your client conf into the config folder as `/config/wg0.conf` and start the container. diff --git a/root/etc/cont-init.d/30-config b/root/etc/cont-init.d/30-config index 22ddec1..0ad49c7 100644 --- a/root/etc/cont-init.d/30-config +++ b/root/etc/cont-init.d/30-config @@ -201,8 +201,9 @@ DUDE" cat < /config/${PEER_ID}/${PEER_ID}.conf `cat /config/templates/peer.conf` DUDE" - SERVER_ALLOWEDIPS=SERVER_ALLOWEDIPS_PEER_${PEER_ID} + SERVER_ALLOWEDIPS=SERVER_ALLOWEDIPS_PEER_${i} if [ -n "${!SERVER_ALLOWEDIPS}" ]; then + echo "Adding ${!SERVER_ALLOWEDIPS} to wg0.conf's AllowedIPs for peer ${i}" cat <> /config/wg0.conf [Peer] # ${PEER_ID}