ubuntu下搭建进行pam认证的open***
一.搭建环境
1.服务端ubuntu10.10
2.客户端win7
二.open***的搭建
1.在ubuntu上安装open***
apt-get install open***
2.拷贝文件
cp -R /usr/share/doc/open***/examples/easy-rsa /etc/open***
3.生成服务器端和客户端密钥及证书文件
cd /etc/open***/easy-rsa/2.0
. ./vars(注意中间有个空格哈)
./clean-all
./build-ca
./build-key-server server
./build-key client
./build-dh
(在以上操作中可以随时回车,但是别忘记了在按y的地方也按回车,不然生成的文件是空的)
4.打开转发以及iptables
(1)修改/etc/sysctl.conf文件 将ip_forward的那一项注释取消,看看值是不是1,然后sysctl -p
(2)iptables进行数据转换iptables -t nat -A  POSTROUTING -s 192.168.1.0/24 -j MASQUERADE
(注:可以在/etc/rc.local上面加入/etc/init.d/open*** start 和上面(2))
5.设置pam.d认证
(1).安装libpam-pwdfile  apache2-utils
apt-get install libpam-pwdfile  apache2-utils
(2).生成用户密码认证文件
htpasswd -c auth.txt luoguoling
后面加入名单不需要加参数-c
(3).配置pam服务文件
进入/etc/pam.d/建立vuser文件输入:
auth required pam_pwdfile.so pwdfile /etc/open***/auth.txt
account required pam_permit.so
具体可参考:http://www.kuqin.com/linux/20070907/920.html对于pam有非常详细的介绍
过程中注意检查pam_pwdfile.so和open***-auth-pam.so这2个模块是否存在
6./etc/open***/下server.conf文件的配置
dev tun
proto udp
port 1194

ca /etc/open***/easy-rsa/2.0/keys/ca.crt
cert /etc/open***/easy-rsa/2.0/keys/server.crt
key /etc/open***/easy-rsa/2.0/keys/server.key
dh /etc/open***/easy-rsa/2.0/keys/dh1024.pem

user nobody
group nogroup
server 192.168.1.0 255.255.255.0
persist-key
persist-tun
#status open***-status.log
#verb 3
client-to-client
log /var/log/open***.log
push "redirect-gateway def1"
push "dhcp-option DNS 8.8.8.8"
push "dhcp-option DNS 8.8.4.4"
plugin /usr/lib/open***/open***-auth-pam.so "/etc/pam.d/vuser"
status /var/log/open***-status.log
comp-lzo
大家看参考做相应的改变
7.客户端的配置
(1).下载安装客户端软件,地址(http://open***.net/release/open***-2.1.0-install.exe
在服务端下载ca.crt client.key client.crt dh1024.pem到安装文件config下面,然后建立配置文件10.0.2.232.o***,具体配置内容如下:
client
dev tun
proto udp
# The hostname/IP and port of the server.
# CHANGE THIS TO YOUR VPS IP ADDRESS
remote 10.0.2.232 1194
resolv-retry infinite
nobind
persist-key
persist-tun
ca key/ca.crt
cert key/client.crt
key key/client.key
comp-lzo
verb 3
auth-user-pass

后面就可以直接连接上网了:联系luoguoling@smalltreemedia.com
三.常见故障处理
1.奇葩问题:能够拨进***,但是不能够连接内网的机子,如果是win7机子,注意使用管理员权限运行机子。
2.老是提示重启,用wireshark抓下包,估计gfw把你干掉了,然后才去相应办法。

待续。。。。