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

  1. #!/bin/sh
  2. WGPORTAL_URL=http://185.123.84.125:8123/
  3. WG_CONFFILE=/etc/wireguard/wg0.conf
  4. trap 'stty echo' INT
  5. if [ -f "$WG_CONFFILE" -a $OVERWRITE -ne 1 ]; then
  6. printf "Wireguard config file already exists\n"
  7. printf "Exiting now to prevent overrid of your actual parameters\n"
  8. exit 1;
  9. fi
  10. printf "Username: "
  11. IFS= read -r username
  12. printf "Password: "
  13. stty -echo
  14. IFS= read -r password
  15. stty echo
  16. printf "\n"
  17. 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")
  18. res=$?
  19. if test "$res" != "0"; then
  20. echo "the curl command failed with: $res"
  21. fi