auth.sh 301 B

12345678910111213141516
  1. #!/usr/bin/env sh
  2. PATH=$PATH:/usr/local/bin
  3. set -e
  4. env
  5. auth_usr=$(head -1 $1)
  6. auth_passwd=$(tail -1 $1)
  7. if [ $common_name = $username ]; then
  8. openvpn-user auth --db.path /etc/openvpn/easyrsa/pki/users.db --user ${auth_usr} --password ${auth_passwd}
  9. else
  10. echo "Authorization failed"
  11. exit 1
  12. fi