diff --git a/wireguard/deploy-wg-clients.sh b/wireguard/deploy-wg-clients.sh old mode 100644 new mode 100755 index 42de6ac..8a9d1ed --- a/wireguard/deploy-wg-clients.sh +++ b/wireguard/deploy-wg-clients.sh @@ -1,5 +1,12 @@ #!/bin/bash +#re='^[0-9]{1,3}$' +if ! [[ $IP =~ ^[0-9]{1,3}$ ]] ; then + echo "error: Please set IP variable (with IP=1-254. See https://phpipam.altinea.fr" >&2; exit 1 +fi + +exit 1; + mkdir -p /etc/wireguard/keys umask 077 && wg genkey > /etc/wireguard/keys/private.key && wg pubkey < /etc/wireguard/keys/private.key > /etc/wireguard/keys/public.key && umask 0022 @@ -21,3 +28,4 @@ systemctl enable wg-quick@wg0.service && systemctl daemon-reload && systemctl st echo -n "Clé publique : " cat /etc/wireguard/keys/public.key +exit 0; \ No newline at end of file