[root@ios*** ~]# saslauthd -a pam
[root@ios*** ~]# testsaslauthd -u test1 -p test1 -s open***
0: OK "Success." 5、安装Open***服务器auth-pam插件
本来我们rpm包安装的Open***里面是带有我们需要的模块open***-auth-pam.so,但是我试过了,有问题,认证无法通过,因为2.1以上的Open***的open***-auth-pam.so都会出现验证错误的问题,这里需要我们重新编译一个低版本的,我这里用2.0.7的,我附近里面有,编译依赖pam_devel包。
yum install pam_devel -y
wget http://pkgs.fedoraproject.org/repo/pkgs/open***/open***-2.0.7.tar.gz/93528233f1f6d02fc18e2c00f82e0aca/open***-2.0.7.tar.gz
tar xf open***-2.0.7.tar.gz
cd open***-2.0.7/plugin/auth-pam/
make 把模块拷贝到Open***的配置目录下
cp open***-auth-pam.so /etc/open***/ 6、Open***服务端配置文件
配置好之后我们要使用这个模块,加到服务器端的配置文件最后,最后的配置文件是:
# cat /etc/open***/server.conf
port 1194
proto tcp
dev tun
ca /usr/share/doc/open***-2.3.7/sample/sample-keys/ca.crt
cert /usr/share/doc/open***-2.3.7/sample/sample-keys/server.crt
key /usr/share/doc/open***-2.3.7/sample/sample-keys/server.key
dh /usr/share/doc/open***-2.3.7/sample/sample-keys/dh2048.pem
server 10.8.0.0 255.255.255.0
ifconfig-pool-persist ipp.txt
push "route 10.0.0.0 255.255.255.0"
push "redirect-gateway def1 bypass-dhcp"
push "dhcp-option DNS 114.114.114.114"
topology subnet
client-to-client
duplicate-cn
keepalive 10 120
comp-lzo
persist-key
persist-tun
status /var/log/open***/open***-status.log
log-append /var/log/open***/open***.log
verb 3
script-security 3 system
plugin /etc/open***/open***-auth-pam.so open***
client-cert-not-required
username-as-common-name 7、客户端配置文件
这里以windows客户端为例。
client
dev tun
proto tcp
remote 211.152.x.x 1194
nobind
user nobody
group nobody
persist-key
persist-tun
ca ca.crt
;cert client.crt
;key client.key
comp-lzo
verb 3
auth-user-pass #客户端使用账号密码登录
reneg-sec 360000 三、启动测试 1、客户端登陆
2、查看日志
登录成功之后我们查看服务器的日志,日志如下,里面有连接的过程信息。
# more /var/log/open***/open***.log
3、查看***用户登录表
可见登录成功,每登录成功一次记录三条信息,如果嫌里面记录的信息过多,可以修改/etc/pam.d/open***来设定里面的信息。 4、禁用某个用户登录
我们只要把用户表里面的对应用户的active改为0,用户就无法登录,我们这里禁用test1的登录。
mysql> update ***user set active = '0' where name = 'test1';