openvpn-user/auth.sh

13 lines
253 B
Bash
Raw Normal View History

2021-02-05 01:37:12 -05:00
#!/usr/bin/env sh
2021-02-08 04:53:09 -05:00
PATH=$PATH:/usr/local/bin
2021-02-05 01:37:12 -05:00
set -e
2021-02-08 04:53:09 -05:00
auth_usr=$(head -1 $1)
auth_passwd=$(tail -1 $1)
2021-02-05 01:37:12 -05:00
2021-02-08 04:53:09 -05:00
if [ $common_name = ${auth_usr} ]; then
openvpn-user auth --user ${auth_usr} --password ${auth_passwd}
else
echo "Authorization failed"
exit 1
fi