open***提供了證書驗證和密碼驗證兩種驗證方式,這裏來具體描述下密碼驗證的配置方法。vim
一:修改open×××服務端配置,在文件末尾添加以下配置:bash
# vim /opt/apps/open***/etc/server.conf auth-user-pass-verify /opt/apps/open***/etc/checkpsw.sh via-env client-cert-not-required username-as-common-name
二:下載checkpsw.sh文件,並配置相關權限:app
下載地址:http://open***.se/files/other/checkpsw.sh運維
內容以下:(注意指定PASSFILE,LOG_FILE的路徑)ide
# vim /opt/apps/open***/etc/checkpsw.sh #!/bin/sh ########################################################### # checkpsw.sh (C) 2004 Mathias Sundman <mathias@open***.se> # # This script will authenticate Open××× users against # a plain text file. The passfile should simply contain # one row per user with the username first followed by # one or more space(s) or tab(s) and then the password. PASSFILE="/opt/apps/open***/etc/psw-file" LOG_FILE="/opt/apps/open***/var/open***-password.log" TIME_STAMP=`date "+%Y-%m-%d %T"` ########################################################### if [ ! -r "${PASSFILE}" ]; then echo "${TIME_STAMP}: Could not open password file \"${PASSFILE}\" for reading." >> ${LOG_FILE} exit 1 fi CORRECT_PASSWORD=`awk '!/^;/&&!/^#/&&$1=="'${username}'"{print $2;exit}' ${PASSFILE}` if [ "${CORRECT_PASSWORD}" = "" ]; then echo "${TIME_STAMP}: User does not exist: username=\"${username}\", password=\"${password}\"." >> ${LOG_FILE} exit 1 fi if [ "${password}" = "${CORRECT_PASSWORD}" ]; then echo "${TIME_STAMP}: Successful authentication: username=\"${username}\"." >> ${LOG_FILE} exit 0 fi echo "${TIME_STAMP}: Incorrect password: username=\"${username}\", password=\"${password}\"." >> ${LOG_FILE} exit 1 # chmod a+x /opt/apps/open***/etc/checkpsw.sh
三:建立密碼文件,在裏面添加帳戶和密碼:ui
# vim /opt/apps/open***/etc/psw-file username password
四:客戶端配置密碼驗證,刪除相關證書配置:spa
auth-user-pass #cert xxx.crt #key xxx.key
五:重啓open***服務,驗證客戶端密碼登陸:orm