1
0
Fork 0
mirror of synced 2024-05-26 12:01:15 -04:00
ovpn-admin/setup/auth.sh
2022-12-30 17:25:21 +03:00

15 lines
336 B
Bash

#!/usr/bin/env sh
PATH=$PATH:/usr/local/bin
set -e
auth_usr=$(head -1 $1)
auth_secret=$(tail -1 $1)
if [ $common_name = $auth_usr ]; then
curl -s --fail --data-raw 'username='${auth_usr} --data-raw 'secret='${auth_secret} localhost:8080/api/auth/check
else
echo "$(date) Authorization for user $common_name failed"
exit 1
fi