Open***配置密码方式验证

    open***提供了证书验证和密码验证两种验证方式,这里来具体描述下密码验证的配置方法。

    一:修改open***服务端配置,在文件末尾添加如下配置:

# 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文件,并配置相关权限:

         下载地址:http://open***.se/files/other/checkpsw.sh

         内容如下:(注意指定PASSFILE,LOG_FILE的路径)

# 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


    三:创建密码文件,在里面添加账户和密码:

# vim /opt/apps/open***/etc/psw-file 
username  password

 四:客户端配置密码验证,删除相关证书配置:

auth-user-pass
#cert xxx.crt
#key xxx.key


 五:重启open***服务,验证客户端密码登录:

1.PNG?version=1&modificationDate=1477639

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值