You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

28 lines
704 B

#!/bin/sh
WGPORTAL_URL=http://185.123.84.125:8123/
WG_CONFFILE=/etc/wireguard/wg0.conf
trap 'stty echo' INT
if [ -f "$WG_CONFFILE" -a $OVERWRITE -ne 1 ]; then
printf "Wireguard config file already exists\n"
printf "Exiting now to prevent overrid of your actual parameters\n"
exit 1;
fi
printf "Username: "
IFS= read -r username
printf "Password: "
stty -echo
IFS= read -r password
stty echo
printf "\n"
HTTP_STATUS=$(curl -w "%{http_code}" -s -o $WG_CONFFILE --user $username:$password -X GET $WGPORTAL_URL"api/v1/provisioning/peer/mqQiS1kYWDoXlvhucqMIGkBeUjy7yppZ0eLLENsM5UU%3D" -H "accept: text/plain")
res=$?
if test "$res" != "0"; then
echo "the curl command failed with: $res"
fi