Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion scripts/prepare-wireguard-configuration.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,14 @@ if [[ -e /home/dragon/wg0-dragon.conf ]]; then
mv /home/dragon/wg0-dragon.conf /home/dragon/wireguard-client.conf
fi

sed -i -e s/WIREGUARD_PUBLIC_IP_ADDRESS/$(curl my.ip.fi)/ /home/dragon/wireguard-client.conf
# The public address only ends up in the client configuration that
# users fetch for a VPN connection; nothing in the deployment reads it.
# A failed lookup therefore leaves the placeholder in place instead of
# failing the deployment.
public_ip_address=$(curl -fsS --retry 3 --max-time 10 my.ip.fi || true)
if [[ $public_ip_address =~ ^[0-9a-fA-F.:]+$ ]]; then
sed -i -e "s/WIREGUARD_PUBLIC_IP_ADDRESS/$public_ip_address/" /home/dragon/wireguard-client.conf
else
echo "WARNING: public IP address lookup failed, WIREGUARD_PUBLIC_IP_ADDRESS in /home/dragon/wireguard-client.conf must be set manually" >&2
fi
sed -i -e "s/CHANGEME.*/GEQ5eWshKW+4ZhXMcWkAAbqzj7QA9G64oBFB3CbrR0w=/" /home/dragon/wireguard-client.conf
Loading