博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
搭建基于用户密码认证的Open***
阅读量:7115 次
发布时间:2019-06-28

本文共 2322 字,大约阅读时间需要 7 分钟。

一、部署准备

部署情况请查看我上一篇文章,我们这里只是针对上一篇文章进行简单的修改

 

二、修改服务端

# vim /etc/open***/server.conf

在配置文件最后面添加如下几行数据

script-security 3 system     #允许通过环境变量将密码传递给脚本   auth-user-pass-verify /etc/open***/checkpsw.sh via-env   #提供一个用户名密码对client-cert-not-required             #不使用客户端证书,使用密码对username-as-common-name              #使用认证用户名,不使用证书的common name

创建checkpsw.sh脚本:可以去官网下载也可以在我的附件里面下载

# cd /etc/open***

# vim checkpsw.sh

#!/bin/sh############################################################ checkpsw.sh (C) 2004 Mathias Sundman 
## 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="/etc/open***/psw-file"LOG_FILE="/var/log/open***/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 1fi 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 1fi if [ "${password}" = "${CORRECT_PASSWORD}" ]; then  echo "${TIME_STAMP}: Successful authentication: username=\"${username}\"." >> ${LOG_FILE}  exit 0fi echo "${TIME_STAMP}: Incorrect password: username=\"${username}\", password=\"${password}\"." >> ${LOG_FILE}exit 1
chmod +x checkpsw.sh

创建psw-file文件:

cd /etc/open***echo "test1 test1" > psw-file        #创建账号密码,可以多行,每行一组chmod 400 psw-file                   #修改文件权限,我是用root权限执行的

加入开机启动项:

chkconfig open*** on

重启open***服务端:

service open*** start

三、修改客户端

客户端以windows为例:

客户端操作步骤,具体可以查看我上一篇文章里面的安装步骤。

下载windows客户端:

http://open***.ustc.edu.cn/open***-install-2.3.6-I603-x86_64.exe

安装好客户端软件之后,把之前从服务端打包的客户端需要的证书解压到客户端安装目录下的config目录中。

并且创建客户端配置文件:

打开client.o***

clientdev tunproto tcpremote 211.152.x.x 1194nobinduser nobodygroup nobodypersist-keypersist-tunca ca.crt;cert client.crt;key client.keycomp-lzoverb 3auth-user-pass             #客户端使用账号密码登录reneg-sec 360000

    直接输入帐号test1,test1登录就可以了。

    可以去/var/log/open***目录下面去查看运行日志等等信息,默认open***-password.log记录用户的登录信息,用户登录失败会记录下登录失败的密码。

转载地址:http://wmyel.baihongyu.com/

你可能感兴趣的文章
JPush删除别名及回调函数(SWIFT)
查看>>
silverlight 跨域socket
查看>>
编程不是功能实现了就可以了
查看>>
利用Dockerfile构建一个nginx容器
查看>>
Linux/Freebsd下时间转化
查看>>
VMware vSphere 5.1 群集深入解析(十五)-DRS推荐向导
查看>>
sklearn.metrics.auc
查看>>
Context Switch Definition(译文)
查看>>
Linux中通过/proc/stat等文件计算Cpu使用率(一)
查看>>
微软MED-V虚拟化实战教程之一部署
查看>>
linux 下用python 遍历文件夹
查看>>
chmod和permission
查看>>
一个奇怪的问题的解决方法
查看>>
组策略应用之二:重定向文件夹
查看>>
Linux下建立静态库的实例讲解
查看>>
mac显示隐藏文件
查看>>
4-2 ADO.NET-查询和检索数据7
查看>>
组策略设置IE 11的Compatible View
查看>>
调研分享:Flipboard的使用特点和页面信息抽取机制
查看>>
TextMate Footnotes
查看>>