Loading... <div class="tip share">请注意,本文编写于 1782 天前,最后修改于 1782 天前,其中某些信息可能已经过时。</div> ``` LOG_FILE="/etc/openvpn/openvpn_pw.log" TIME_STAMP=`date "+%Y-%m-%d %T"` CORRECT_PASSWORD=`/usr/bin/mysql -uopenvpn -popenvpn -h10.10.10.10 openvpn -e "select password from user where username = '${username}' and enabled = true and expire_date > now();G" --skip-column-name |tail -1` MD5PASSWORD=`echo -n ${password}|md5sum|awk '{print $1}'` if [ "${CORRECT_PASSWORD}" = "" ]; then echo "${TIME_STAMP}: User does not exist: username="${username}", password="${password}"." >> ${LOG_FILE} exit 1 fi if [ "$MD5PASSWORD" = "${CORRECT_PASSWORD}" ]; then echo "${TIME_STAMP} Successful authentication username: ${username} IP: $ifconfig_pool_remote_ip RemoteIP: $trusted_ip" >> ${LOG_FILE} exit 0 fi echo "${TIME_STAMP}: Incorrect password: username="${username}", password="${password}"." >> ${LOG_FILE} exit 1 ``` 最后修改:2020 年 02 月 04 日 © 允许规范转载 打赏 赞赏作者 支付宝微信 赞 如果觉得我的文章对你有用,请随意赞赏