【发布时间】:2014-04-05 20:53:31
【问题描述】:
我整天都在尝试让运行 Debian-7-Wheezy 的 OpenVPN 服务器通过 mySQL 进行身份验证。我将 mySQL 托管在另一台运行 WHM 和 cPanel 的服务器上。我将 OpenVPN 服务器的 IP 添加到数据库连接的白名单中,检查了我的所有凭据并仔细检查了配置文件。当我运行时:/etc/openvpn/script/test_connect_db.sh test 1234 我收到此错误:
/etc/openvpn/script/test_connect_db.sh: line 6: mysql: command not found
身份验证失败。
位于:/etc/openvpn/script/test_connect_db.sh 的文件看起来完全像这样:
#!/bin/bash
. /etc/openvpn/script/config.sh
##Test Authentication
username=$1
password=$2
user_id=$(mysql -h$HOST -P$PORT -u$USER -p$PASS $DB -sN -e "select user_id from user where user_id = '$username' AND user_pass = '$password' AND user_enable=1 AND user_start_date != user_end_date AND TO_DAYS(now()) >= TO_DAYS(user_start_date) AND (TO_DAYS(now()) <= TO_DAYS(user_end_date) OR user_end_date='0000-00-00')")
##Check user
[ "$user_id" != '' ] && [ "$user_id" = "$username" ] && echo "user : $username" && echo 'authentication ok.' && exit 0 || echo 'authentication failed.'; exit 1
知道有什么问题吗?
【问题讨论】:
标签: mysql authentication debian openvpn