|
目的:客户端还是连接到公司局域网中,但为了用户管理方便,认证数据从 TEXT 数
据库中提取。
OpenVPN Server 基本设定:连接方式采用路由,认证方式采用 TEXT/POP3 认证,虚
拟设备使用 tun
1. 下载 TEXT 认证脚本 checkpsw.sh ,并且复制到 /usr/local/etc/ 目录中同时 chmod u+x 。
http://openvpn.se/files/other/
注意: 1.脚本保存到 windows 中再上传导 linux 有问题,最好在那个目录新建一个同名
文件再从控制台粘贴进去。
2.脚本的开始不是 #! 要改正。
2.配置服务器配置文件, 在(一)的基础上
添加如下几行:
# auth-user-pass-verify cmd method: Query client for username/password and
# run scrip{过滤}t cmd to verify. If method=’via-env’, pass
# user/pass via environment, if method=’via-file’, pass
# user/pass via temporary file.
auth-user-pass-verify /usr/local/etcfile:///C:\Users\lenovo\AppData\Local\Temp\)QN1UH78VKP2T7)IA]ZM(FW.gifeckpsw.sh via-env
#不请求客户的CA证书,使用User/Pass验证
client-cert-not-required
#使用客户提供的UserName作为Common Name
username-as-common-name
3..配置客户端配置文件
注释掉
;cert client1.crt
;key client1.key
增加
#询问用户名和密码
auth-user-pass
4.更改 checkpsw.sh 中的 PASSFILE 变量为。
PASSFILE=”/usr/local/etc/psw-file”
5. 创建 /usr/local/etc/psw-file 内容如下:
格式:用户名 Tab 密码
User1 pass
User2 pass
注:实验成功后我自己仿照 checkpsw.sh 用 perl 重写了一遍(目录中的 checkpsw.pl),也
可以使用。
6.同样的原理我们还可以使用 POP3 认证(^_^ 其他的当然也可以)
脚本见目录中的 popauth.pl
(五) 搭建 OpenVPN Server 路由模式 + 口令认证+RADIUS
网络环境:在(一)的基础上添加一台 win2003 服务器 ip 为 192.168.80.130
^_^ 不好意思,我把服务器给放到了公网上了。不过还好是测试。
目的:客户端还是连接到公司局域网中,但为了用户管理方便,认证数据从 radius 数
据库中提取。
OpenVPN Server 基本设定:连接方式采用路由,认证方式采用 radius 认证,虚拟设备
使用 tun
1. 搭建 Radius 服务器
见附录 搭建 win2003 下的 IAS 服务
2. 配置 radiusplugin
1.radiusplugin_v2.0.tar.gz: 可以编译得到 radiusplugin.so
到 http://www.nongnu.org/radiusplugin/下载
2.libgcrypt 支持库: 可以编译得到/usr[img]file:///C:\Users\lenovo\AppData\Local\Temp\)A[Y)I~](ZC9Z[3Y)IDK7LK.gif[/img]b[img]file:///C:\Users\lenovo\AppData\Local\Temp\)A[Y)I~](ZC9Z[3Y)IDK7LK.gif[/img]bgcrypt.so.11
到 ftp://ftp.gnupg.org/gcrypt/libgcrypt/libgcrypt-1.2.4.tar.gz 下载
3.libgpg-error 支持库: 可以编译得到/usr/local[img]file:///C:\Users\lenovo\AppData\Local\Temp\)A[Y)I~](ZC9Z[3Y)IDK7LK.gif[/img]b[img]file:///C:\Users\lenovo\AppData\Local\Temp\)A[Y)I~](ZC9Z[3Y)IDK7LK.gif[/img]bgpg-error.so.0
到 ftp://ftp.gnupg.org/gcrypt/libgpg-error/libgpg-error-1.5.tar.gz 下载
简单的编译以上 3 个支持库,configure;make;make install。
我们要用到 radiusplugin.so,其他是 radiusplugin.so 的支持库。
好了如果能够得到 radiusplugin.so,已经成功了 80%,其他的就是配置了。
把 radiusplugin.so 拷贝到/usr/local/etc[img]file:///C:\Users\lenovo\AppData\Local\Temp\)A[Y)I~](ZC9Z[3Y)IDK7LK.gif[/img]b 下,并配置其配置文件 radiusplugin.conf
内容如下:
# The NAS identifier which is sent to the RADIUS server
NAS-Identifier=OpenVpn
# The service type which is sent to the RADIUS server
Service-Type=5
# The framed protocol which is sent to the RADIUS server
Framed-Protocol=1
# The NAS port type which is sent to the RADIUS server
NAS-Port-Type=5
# 这是运行 openvpn 服务器的 ip,作为 radius 客户端
NAS-IP-Address=192.168.80.129
#这里指明 openvpn 的配置位置
OpenVPNConfig=/usr/local/etcfile:///C:\Users\lenovo\AppData\Local\Temp\V7(XMWRN]{G8~CI}BCCR3QC.gifrver.conf
# 这里定义 radius server 参数可以超过 1 个作为备份
server
{
# The UDP port for radius accounting.
acctport=1813
# The UDP port for radius authentication.
authport=1812
# 这是我 radius 服务器的 ip,并添加了用户。
name=192.168.80.130
# How many times should the plugin send the if there is no response?
retry=1
# How long should the plugin wait for a response?
wait=1
# The shared secret.共享密钥,在 winradius 里配置,设置-系统-NAS 密钥
sharedsecret=123456
}
3.配置服务器配置文件, 在(一)的基础上
添加如下几行:
#说明使用的插件
plugin /usr/local/etc[img]file:///C:\Users\lenovo\AppData\Local\Temp\)A[Y)I~](ZC9Z[3Y)IDK7LK.gif[/img]b/radiusplugin.so /usr/local/etc/radius.conf
#不请求客户的CA证书,使用User/Pass验证
client-cert-not-required
#使用客户提供的UserName作为Common Name
username-as-common-name
4.配置客户端配置文件
注释掉
;cert client1.crt
;key client1.key
增加
#询问用户名和密码
auth-user-pass
|
上一篇:无题下一篇:【原创】”\u"开头的Unicode加密解密工具
|