个人日记
OPENVPN 笔记
[
2010/08/13 16:23 | by suibing ]
2010/08/13 16:23 | by suibing ]
[b]openvpn的使用场景很多,不同的使用场景,设置也有很大的不同,client to host 这应该是一种最简单的方式,对于个人用户来说,这应该是应用最多。
下面的图是从google找到的,文章地址。如果我们的服务器端,是放在公司的总部,需要和公司内网进行链接,那么就可以参考这个图来进行设置。

OPENVPN验证方式采用证书的方式,我们就需要创建CA,颁发客户端和服务器端的证书。
采用户名和密码的方式,那么用户和密码可以保存在数据库或者ldap上。
当然我们是可以把openvpn,配置成采用同时支持两种方式验证。也就是说服务器端支持两种方式的验证,采用哪种方式验证,由客户端设置来决定。

证书方式
只使用证书
证书+密码
USER/PASSWORD
mysql
ldap
一:实验环境在国外有一台xen的vps,装了centos5.3的系统,现在希望在服务器上安装openvpn,远程的客户端,可以通过连接vpn,直接访问国外的网站。
客户端一般都是在内网。假设内网的网段上192.168.1.0/24
vpn server
hostname mail.18demo.com
ip:66.160.197.199
由于我需要测试pop验证和ldap验证,所以我就安装iredmail的ldap版本(iredmail的脚本)。这样就可以测试pop验证和ldap验证。
二:初始化设置由于我的xen的vps,极度精简,下面安装的软件和设置,有些是个人偏好。
iptables是必须安装的。
客户端和vpn server时间最好同步
lrzsz 是用来ssh客户端可以直接上传,下载文件 ssh客户端设置
采用yum的方式安装openvpn,所以需要添加rpmforge,注意你的机器是32 还是64, 需要注意的是rpmforge 提供的是2.09版本,EPEL提供的是2.1版本,2.1的版本修复了一个注销证书的bug。别的没有发现有什么太大的不同。
#修改hostname
sed -i "s/HOSTNAME=eddie1/HOSTNAME=mail.18demo.com/" /etc/sysconfig/network
echo "127.0.0.1 mail.18demo.com mail localhost localhost.localdomain" > /etc/hosts
hostname mail.18demo.com
#安装必备软件
yum -y install wget gzip bzip2 lrzsz vixie-cron vim-enhanced tmpwatch unzip ntp mlocate zip ntp iptables mlocate
#设置vim
mv /bin/vi /bin/vi.save
ln -s /usr/bin/vim /bin/vi
cp /etc/vimrc /etc/vimrc.save
sed -i "39 s/^/ set number \n filetype on\n set history=1000\n syntax on\n set tabstop=4\n set showmatch\n set vb t_vb=\n set mouse=a\n set ignorecase\n set autowrite\n /" /etc/vimrc
#同步时间和时区
mv /etc/localtime /etc/localtime.save
cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
ntpdate cn.pool.ntp.org
#设置acl
sed -i "s/errors=remount-ro/acl,errors=remount-ro /" /etc/fstab
mount -o remount,rw,acl /
二:安装iredmail ldap安装iredmail,可以测试pop验证和ldap验证。
三:OPENVPN
安装openvpnrpmforge 提供的是2.09的版本,EPEL提供的是2.1的版本,我使用2.1的版本,2.1 修复注销证书的bug。另外EPEL的源里才有ldap验证的插件。
rpmforge
rpm -Uhv http://apt.sw.be/redhat/el5/en/i386/rpmforge/RPMS/rpmforge-release-0.3.6-1.el5.rf.i386.rpm #
rpm -Uhv http://apt.sw.be/redhat/el5/en/x86_64/rpmforge/RPMS//rpmforge-release-0.3.6-1.el5.rf.x86_64.rpm #
EPEL yum
#EPEL yum
rpm -Uhv http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-3.noarch.rpm #
rpm -Uhv http://download.fedora.redhat.com/pub/epel/5/x86_64/epel-release-5-3.noarch.rpm # openvpn
yum -y install openvpn
查看openvpn的安装位置
updatedb
locate openvpn
复制模板将模版中的easy-rsa的目录复制到/etc/openvpn/的路径下,这些都是创建证书的脚本。这些脚本有两个版本。2.0的目录是最新版本,建议大家使用这个。目录下有readme,大家可以看看。
注意,不同版本openvpn的easy-rsa的路径不太一样,通过上面locate命令,找出路径,下面是2.1版本的openvpn的路径。
cp -R /usr/share/doc/openvpn-2.0.9/easy-rsa/ /etc/openvpn/
cp -R /usr/share/openvpn/easy-rsa /etc/openvpn/
cd /etc/openvpn/easy-rsa/2.0/

编辑 vars脚本,
根据自己的情况来填写,其实这些内容,你不修改,也不会影响你使用。
vi vars
export KEY_COUNTRY="CN"
export KEY_PROVINCE="BJ"
export KEY_CITY="BeiJing"
export KEY_ORG="iredmail"
export KEY_EMAIL="shake.chen@gmail.com"
让脚本可运行
目录下的所有脚本目前都是不可运行,需要让脚本有可执行的权限
chmod +rwx *
将vars载入系统环境之中
source ./vars
执行clean-all脚本,
留意,这个时候,就会在目录下产生keys的文件夹。
./clean-all
# ll keys/
total 4
-rw-r--r-- 1 root root 0 Jul 26 02:16 index.txt
-rw-r--r-- 1 root root 3 Jul 26 02:16 serial
建立CA证书,
使用pkitool 命令,可以减少交互过程。产生 ca.crt 和 ca.key
./pkitool --initca
# ll keys/
total 12
-rw-r--r-- 1 root root 1212 Jul 26 02:17 ca.crt
-rw------- 1 root root 887 Jul 26 02:17 ca.key
-rw-r--r-- 1 root root 0 Jul 26 02:16 index.txt
-rw-r--r-- 1 root root 3 Jul 26 02:16 serial
建立DH参数文件会产生dh1024.pem文件
./build-dh
ll keys/
total 16
-rw-r--r-- 1 root root 1212 Jul 26 02:17 ca.crt
-rw------- 1 root root 887 Jul 26 02:17 ca.key
-rw-r--r-- 1 root root 245 Jul 26 02:18 dh1024.pem
-rw-r--r-- 1 root root 0 Jul 26 02:16 index.txt
-rw-r--r-- 1 root root 3 Jul 26 02:16 serial
防止恶意攻击(可选)
如DOS、UDP port flooding,生成一个"HMAC firewall", 这个功能可以不启用,减少麻烦。
openvpn --genkey --secret /etc/openvpn/easy-rsa/2.0/keys/ta.key
这个时候,在keys目录下,产生一个ta.key,同时也需要在server.conf 文件里添加一行
tls-auth /etc/openvpn/easy-rsa/2.0/keys/ta.key 0
要启用这个功能,你还需要把 ta.key 这个文件下载到客户端,并且客户端里的配置文件也需要添加一行
tls-auth ta.key 1
ll keys/
total 20
-rw-r--r-- 1 root root 1212 Jul 31 12:04 ca.crt
-rw------- 1 root root 887 Jul 31 12:04 ca.key
-rw-r--r-- 1 root root 245 Jul 31 12:08 dh1024.pem
-rw-r--r-- 1 root root 0 Jul 31 12:02 index.txt
-rw-r--r-- 1 root root 3 Jul 31 12:02 serial
-rw------- 1 root root 636 Jul 31 12:08 ta.key
四:OpenVPN Server 路由模式 +证书验证和证书+密码
建立OpenVPN Server端的证书和密钥
common name是 server
./pkitool --server server
# ll keys/
total 44
-rw-r--r-- 1 root root 3863 Jul 26 02:19 01.pem
-rw-r--r-- 1 root root 1212 Jul 26 02:17 ca.crt
-rw------- 1 root root 887 Jul 26 02:17 ca.key
-rw-r--r-- 1 root root 245 Jul 26 02:18 dh1024.pem
-rw-r--r-- 1 root root 105 Jul 26 02:19 index.txt
-rw-r--r-- 1 root root 21 Jul 26 02:19 index.txt.attr
-rw-r--r-- 1 root root 0 Jul 26 02:16 index.txt.old
-rw-r--r-- 1 root root 3 Jul 26 02:19 serial
-rw-r--r-- 1 root root 3 Jul 26 02:16 serial.old
-rw-r--r-- 1 root root 3863 Jul 26 02:19 server.crt
-rw-r--r-- 1 root root 668 Jul 26 02:19 server.csr
-rw------- 1 root root 887 Jul 26 02:19 server.key
建立OpenVPN Client端的证书和密钥
comon name 是 client1
./pkitool client1
# ll keys/
total 68
-rw-r--r-- 1 root root 3863 Jul 26 02:19 01.pem
-rw-r--r-- 1 root root 3747 Jul 26 02:20 02.pem
-rw-r--r-- 1 root root 1212 Jul 26 02:17 ca.crt
-rw------- 1 root root 887 Jul 26 02:17 ca.key
-rw-r--r-- 1 root root 3747 Jul 26 02:20 client1.crt
-rw-r--r-- 1 root root 672 Jul 26 02:20 client1.csr
-rw------- 1 root root 887 Jul 26 02:20 client1.key
-rw-r--r-- 1 root root 245 Jul 26 02:18 dh1024.pem
-rw-r--r-- 1 root root 211 Jul 26 02:20 index.txt
-rw-r--r-- 1 root root 20 Jul 26 02:20 index.txt.attr
-rw-r--r-- 1 root root 21 Jul 26 02:19 index.txt.attr.old
-rw-r--r-- 1 root root 105 Jul 26 02:19 index.txt.old
-rw-r--r-- 1 root root 3 Jul 26 02:20 serial
-rw-r--r-- 1 root root 3 Jul 26 02:19 serial.old
-rw-r--r-- 1 root root 3863 Jul 26 02:19 server.crt
-rw-r--r-- 1 root root 668 Jul 26 02:19 server.csr
-rw------- 1 root root 887 Jul 26 02:19 server.key
创建一个客户端需要输入密码的证书
客户端不但需要证书,还需要密码,而且这个密码,客户端可以自己进行修改。这个倒是非常不错。
-bash-3.2# ./pkitool --pass client2
Generating a 1024 bit RSA private key
......++++++
........++++++
writing new private key to 'client2.key'
Enter PEM pass phrase: 输入密码
Verifying - Enter PEM pass phrase:
-----
Using configuration from /etc/openvpn/easy-rsa/2.0/openssl.cnf
Check that the request matches the signature
Signature ok
The Subject's Distinguished Name is as follows
countryName :PRINTABLE:'CN'
stateOrProvinceName :PRINTABLE:'BJ'
localityName :PRINTABLE:'BeiJing'
organizationName :PRINTABLE:'iredmail'
commonName :PRINTABLE:'client2'
emailAddress :IA5STRING:'shake.chen@gmail.com'
Certificate is to be certified until Jul 19 12:32:20 2019 GMT (3650 days)
Write out database with 1 new entries
Data Base Updated
ll keys/
total 84
-rw-r--r-- 1 root root 3863 Jul 26 02:19 01.pem
-rw-r--r-- 1 root root 3747 Jul 26 02:20 02.pem
-rw-r--r-- 1 root root 3747 Jul 26 02:21 03.pem
-rw-r--r-- 1 root root 1212 Jul 26 02:17 ca.crt
-rw------- 1 root root 887 Jul 26 02:17 ca.key
-rw-r--r-- 1 root root 3747 Jul 26 02:20 client1.crt
-rw-r--r-- 1 root root 672 Jul 26 02:20 client1.csr
-rw------- 1 root root 887 Jul 26 02:20 client1.key
-rw-r--r-- 1 root root 3747 Jul 26 02:21 client2.crt
-rw-r--r-- 1 root root 672 Jul 26 02:21 client2.csr
-rw------- 1 root root 963 Jul 26 02:21 client2.key
-rw-r--r-- 1 root root 245 Jul 26 02:18 dh1024.pem
-rw-r--r-- 1 root root 317 Jul 26 02:21 index.txt
-rw-r--r-- 1 root root 20 Jul 26 02:21 index.txt.attr
-rw-r--r-- 1 root root 20 Jul 26 02:20 index.txt.attr.old
-rw-r--r-- 1 root root 211 Jul 26 02:20 index.txt.old
-rw-r--r-- 1 root root 3 Jul 26 02:21 serial
-rw-r--r-- 1 root root 3 Jul 26 02:20 serial.old
-rw-r--r-- 1 root root 3863 Jul 26 02:19 server.crt
-rw-r--r-- 1 root root 668 Jul 26 02:19 server.csr
-rw------- 1 root root 887 Jul 26 02:19 server.key
注销证书
这是一个bug,如果你直接注销证书,会出现一个报错,如果你是2.1的版本,就没有这个bug。如果你是使用epel的源,那么不会有这个问题。如果你是用epel,就可以忽略。
Using configuration from /etc/openvpn/easy-rsa/2.0/openssl.cnf
error on line 282 of config file '/etc/openvpn/easy-rsa/2.0/openssl.cnf'
所以需要编辑openssl.cnf 文件,把[ pkcs11_section ]注释掉,就可以了。
# [ pkcs11_section ]
# engine_id = pkcs11
# dynamic_path = /usr/lib/engines/engine_pkcs11.so
# MODULE_PATH = $ENV::PKCS11_MODULE_PATH
# PIN = $ENV::PKCS11_PIN
# init = 0
注销client2证书,
./revoke-full client2
-bash-3.2# ./revoke-full client2
Using configuration from /etc/openvpn/easy-rsa/2.0/openssl.cnf
Revoking Certificate 03.
Data Base Updated
Using configuration from /etc/openvpn/easy-rsa/2.0/openssl.cnf
client2.crt: /C=CN/ST=BJ/L=BeiJing/O=iredmail/CN=client2/emailAddress=shake.chen@gmail.com
error 23 at 0 depth lookup:certificate revoked
这就表示成功,这个时候,就会在keys目录下,产生一个文件crl.pem,这个文件就保存着注销掉客户端的名字,我们还需要在server.conf 文件里添加
crl-verify /etc/openvpn/crl.pem
这个时候,你的客户端就再也不能连接。
注意,如果你的证书是放在这个目录下/etc/openvpn/easy-rsa/2.0/keys/crl.pem,那么会出现没有权限读取的log报错,只能把这个文件放到 /etc/openvpn/crl.pem目录下就可以。
ll keys/
total 96
-rw-r--r-- 1 root root 3863 Jul 31 12:09 01.pem
-rw-r--r-- 1 root root 3747 Jul 31 12:09 02.pem
-rw-r--r-- 1 root root 3747 Jul 31 12:09 03.pem
-rw-r--r-- 1 root root 1212 Jul 31 12:04 ca.crt
-rw------- 1 root root 887 Jul 31 12:04 ca.key
-rw-r--r-- 1 root root 3747 Jul 31 12:09 client1.crt
-rw-r--r-- 1 root root 672 Jul 31 12:09 client1.csr
-rw------- 1 root root 887 Jul 31 12:09 client1.key
-rw-r--r-- 1 root root 3747 Jul 31 12:09 client2.crt
-rw-r--r-- 1 root root 672 Jul 31 12:09 client2.csr
-rw------- 1 root root 963 Jul 31 12:09 client2.key
-rw-r--r-- 1 root root 516 Jul 31 12:10 crl.pem
-rw-r--r-- 1 root root 245 Jul 31 12:08 dh1024.pem
-rw-r--r-- 1 root root 330 Jul 31 12:10 index.txt
-rw-r--r-- 1 root root 20 Jul 31 12:10 index.txt.attr
-rw-r--r-- 1 root root 20 Jul 31 12:09 index.txt.attr.old
-rw-r--r-- 1 root root 317 Jul 31 12:09 index.txt.old
-rw-r--r-- 1 root root 1728 Jul 31 12:10 revoke-test.pem
-rw-r--r-- 1 root root 3 Jul 31 12:09 serial
-rw-r--r-- 1 root root 3 Jul 31 12:09 serial.old
-rw-r--r-- 1 root root 3863 Jul 31 12:09 server.crt
-rw-r--r-- 1 root root 668 Jul 31 12:09 server.csr
-rw------- 1 root root 887 Jul 31 12:09 server.key
-rw------- 1 root root 636 Jul 31 12:08 ta.key
启用ip转发,并且配置iptable,实现NAT
假如iptables是刚装好,没有任何的规则。
iptables设置
vi /etc/sysconfig/iptables
#openvpn
-A INPUT -p udp -m multiport --dport 1194 -j ACCEPT
vi /etc/init.d/openvpn
#Uncomment this line (about line 134)
echo 1 > /proc/sys/net/ipv4/ip_forward
#Add these lines below it, changing 66.160.197.199to your public IP address,
iptables -t nat -A POSTROUTING -s 10.8.0.0/24 -j SNAT --to 66.160.197.199
service openvpn restart
service iptables restart
设置log
建立配置文件中指定的日志文件,并赋予正确的权限
touch /var/log/openvpn.log
touch /var/log/openvpn-status.log
chown nobody.nobody /var/log/openvpn.log
chown nobody.nobody /var/log/openvpn-status.log
设置client-config-dir ccd如果不进行这个设置,log会报错,
Thu Jul 30 09:04:02 2009 client1/61.49.255.21:2512 MULTI: bad source address from client [192.168.1.120], packet dropped
下面的route的网段,就是客户端所在网段。
cd /etc/openvpn
mkdir ccd
cd ccd
vi client1
iroute 192.168.1.0 255.255.255.0
OpnVPN Server端的主配置文件
openvpn 所有设置都在这个文件
cd /etc/openvpn/
cp /usr/share/doc/openvpn-2.1/sample-config-files/server.conf /etc/openvpn/
vi server.conf
看附录
客户端把证书压缩,下载到本地,可以使用sz来下载。
注意:如果启用防止dos攻击的功能,需要把ta.key 也下载,每个客户端都需要包含这个文件,并且客户端的配置文件也需要添加。
cp /usr/share/doc/openvpn-2.1.1/sample-config-files/client.conf /etc/openvpn/easy-rsa/2.0/keys/client.ovpn
cd /etc/openvpn/easy-rsa/2.0/keys
zip client1.zip ca.crt client1.crt client1.key client.ovpn
sz client1.zip
修改client.ovpn文件
remote mail.18demo.com 1194
cert client1.crt
key client1.key
#tls-auth ta.key 1
五:OpenVPN Server 路由模式 +mysql 验证OpenVPN的用户登录验证是这样的
OpenVPN--->openvpn-auth-pam.so--->PAM--->Mysql/LDAP
rpm -Uhv http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-3.noarch.rpm #
rpm -Uhv http://download.fedora.redhat.com/pub/epel/5/x86_64/epel-release-5-3.noarch.rpm #
安装软件需要让mysql支持pam的验证
检查saslauthd是否安装
rpm -qa | grep cyrus-sasl
yum install cyrus-sasl
安装pam_mysql 让mysql支持pam认证
目前pam_mysql 已经有rpm包,不过目前我只能添加http://rpm.pbone.net 通过这个源来安装,还没有找到合适的源。
yum install pam_mysql
service mysqld restart
安装pam-devel, 如果没有这个,log里会出现
AUTH-PAM: BACKGROUND: could not load PAM lib libpam.so: libpam.so: cannot open shared object file: No such file or directory
导致你无法启动openvpn
yum install pam-devel
创建数据库我们创建一个vpn的数据库,管理员的用户名:vpn,密码:vpn123
并且创建一个用户elm,密码也是elm,密码采用MD5加密。
mysql -uroot -p
create database vpn;
GRANT ALL ON vpn.* TO vpn@localhost IDENTIFIED BY 'vpn123';
flush privileges;
use vpn;
CREATE TABLE vpnuser (
name char(20) NOT NULL,
password char(128) default NULL,
active int(10) NOT NULL DEFAULT 1,
PRIMARY KEY (name)
);
INSERT INTO vpnuser( name,
PASSWORD )
VALUES (
'elm', md5('elm')
);
配置pam_mysql模块
需要注意到是crypt=3这个参数的设置,表示数据库密码是使用MD5加密。
这里如果你设置crypt=2,使用mysql的 password的函数来加密,会出现用户无法登陆。具体原因是Mysql 的 password 函数因为 mysql 的加密函数和 pam_mysql的加密函数不相同。
0 = 明文
1 = Use crypt
2 = Use MySQL PASSWORD() function
3 = md5
vi /etc/pam.d/openvpn
auth sufficient pam_mysql.so user=vpn passwd=vpn123 host=localhost db=vpn \
table=vpnuser usercolumn=name passwdcolumn=password \
where=active=1 sqllog=0 crypt=3
account required pam_mysql.so user=vpn passwd=vpn123 host=localhost db=vpn \
table=vpnuser usercolumn=name passwdcolumn=password \
where=active=1 sqllog=0 crypt=3
修改server和客户端文件
[b]server 文件
plugin /usr/share/openvpn/plugin/lib/openvpn-auth-pam.so openvpn
client-cert-not-required
username-as-common-name
[b]客户端
配置客户端配置文件
注释掉
;cert client1.crt
;key client1.key
增加
#询问用户名和密码
auth-user-pass
这个时候,你就可以用
user:elm
pass:elm
登录openvpn
六:OpenVPN Server 路由模式 + 文本口令认证
下载脚本
wget http://openvpn.se/files/other/checkpsw.sh -P /etc/openvpn
cd /etc/openvpn
chmod u+x checkpsw.sh
chown nobody.nobody checkpsw.sh
创建 /etc/openvpn/psw-file
格式:用户名Tab密码
user1 pass
user2 pass
在server.conf 配置文件里加上
auth-user-pass-verify /etc/openvpn/checkpsw.sh via-env
客户端的修改和上面一样。
注释掉
;cert client1.crt
;key client1.key
增加
#询问用户名和密码
auth-user-pass
这个时候就可以登录,不过注意,mysql和text方式的验证,好像只能选择一种。
七:OpenVPN Server 路由模式 + POP认证
原理和text基本一样。
vi /etc/openvpn/popauth.pl
chmod +x /etc/openvpn/popauth.pl
在server文件里,添加
auth-user-pass-verify /etc/openvpn/popauth.pl via-env
下面就是popauth.pl
#!/usr/bin/perl
# Write by ELM
# wzk [A|T] wenzk [D|O|T] net
# http://www.wenzk.net
#
# POP3 Auth script for OpenVPN
# Usage:
# save this file to /etc/openvpn/ as popauth.pl
# run: chmod +x /etc/openvpn/popauth.pl
# add the next line to you OpenVPN config file
# auth-user-pass-verify /etc/openvpn/popauth.pl via-env
# restart your OpenVPN Server
use Net::POP3;
# POP Server Address
$POPHOST = "localhost";
$USERNAME = $ENV{username};
$PASSWORD = $ENV{password};
# Constructors
$pop = Net::POP3->new($POPHOST);
$pop = Net::POP3->new($POPHOST, Timeout => 60);
if ( defined $pop->login($USERNAME, $PASSWORD) ) {
$result = 0;
} else {
$result = 1;
}
$pop->quit;
exit $result;
八:ldap验证
yum install openvpn-auth-ldap
# LDAP server URL
URL ldap://mail.18demo.com
# Bind DN (If your LDAP server doesn't support anonymous binds)
# BindDN uid=Manager,ou=People,dc=example,dc=com
BindDN cn=manager,dc=18demo,dc=com
# Bind Password
# Password SecretPassword
Password iredmail
# Network timeout (in seconds)
Timeout 15
# Enable Start TLS
#TLSEnable yes
TLSEnable no
# Follow LDAP Referrals (anonymously)
#FollowReferrals yes
# TLS CA Certificate File
#TLSCACertFile /usr/local/etc/ssl/ca.pem
# TLS CA Certificate Directory
#TLSCACertDir /etc/ssl/certs
# Client Certificate and key
# If TLS client authentication is required
#TLSCertFile /usr/local/etc/ssl/client-cert.pem
#TLSKeyFile /usr/local/etc/ssl/client-key.pem
# Cipher Suite
# The defaults are usually fine here
# TLSCipherSuite ALL:!ADH:@STRENGTH
# Base DN
#BaseDN "ou=People,dc=example,dc=com"
BaseDN "domainName=example.com,o=domains,dc=18demo,dc=com"
# User Search Filter
#SearchFilter "(&(uid=%u)(accountStatus=active))"
SearchFilter "(accountStatus=active)"
# Require Group Membership
RequireGroup false
# Add non-group members to a PF table (disabled)
# Add non-group members to a PF table (disabled)
#PFTable ips_vpn_users
BaseDN "ou=Groups,dc=example,dc=com"
SearchFilter "(|(cn=developers)(cn=artists))"
MemberAttribute uniqueMember
# Add group members to a PF table (disabled)
#PFTable ips_vpn_eng
需要pam-ldap.so模块,在centos下,我们需要安装nss_ldap
yum install nss_ldap
cp /usr/share/doc/nss_ldap-253/ldap.conf.pam_ldap /etc/pam_ldap.conf
create /etc/pam.d/openvpn
auth required /lib/security/pam_ldap.so
account required /lib/security/pam_ldap.so
http://www.nabble.com/openvpn-auth-pam.so,-pam_ldap-td9858335.html
http://www.allenzheng.com/read.php/8.htm
http://www.matthardy.info/2009/configure-openvpn-to-authenticate-against-active-directory-ldap-in-linux/
四:附录
server.conf配置文件
port 1194
proto udp
dev tun
ca /etc/openvpn/easy-rsa/2.0/keys/ca.crt
cert /etc/openvpn/easy-rsa/2.0/keys/server.crt
key /etc/openvpn/easy-rsa/2.0/keys/server.key # This file should be kept secret
dh /etc/openvpn/easy-rsa/2.0/keys/dh1024.pem
;crl-verify /etc/openvpn/easy-rsa/2.0/keys/crl.pem
server 10.8.0.0 255.255.255.0
ifconfig-pool-persist ipp.txt
client-config-dir ccd
route 192.168.1.0 255.255.255.0
push "redirect-gateway def1"
;push "dhcp-option DNS 10.8.0.1"
;push "dhcp-option WINS 10.8.0.1"
;client-to-client
;duplicate-cn
keepalive 10 120
;tls-auth /etc/openvpn/easy-rsa/2.0/keys/ta.key 0
comp-lzo
;max-clients 100
user nobody
group nobody
persist-key
persist-tun
status /var/log/openvpn-status.log
log-append /var/log/openvpn.log
verb 3
mute 20
#pop auth
#auth-user-pass-verify /etc/openvpn/popauth.pl via-env
#text auth
#auth-user-pass-verify /etc/openvpn/checkpsw.sh via-env
#pam auth
#plugin /usr/share/openvpn/plugin/lib/openvpn-auth-pam.so openvpn
client-cert-not-required
username-as-common-name
iptables设置
通过输入命令iptables-save >
通过输入iptables-restore
保存对防火墙的设置并重新启动防火墙
#service iptables save
#service iptables restart
/usr/lib64/openvpn/plugin/lib/openvpn-auth-ldap.so
参考文章
http://www.xiaohui.com/dev/server/20070514-install-openvpn.htm
http://forum.ebox-platform.com/index.php?topic=1646.0
plugin /usr/lib/openvpn/plugin/lib/openvpn-auth-ldap.so /etc/openvpn/auth/ldap.conf
下面的图是从google找到的,文章地址。如果我们的服务器端,是放在公司的总部,需要和公司内网进行链接,那么就可以参考这个图来进行设置。
OPENVPN验证方式采用证书的方式,我们就需要创建CA,颁发客户端和服务器端的证书。
采用户名和密码的方式,那么用户和密码可以保存在数据库或者ldap上。
当然我们是可以把openvpn,配置成采用同时支持两种方式验证。也就是说服务器端支持两种方式的验证,采用哪种方式验证,由客户端设置来决定。
证书方式
只使用证书
证书+密码
USER/PASSWORD
mysql
ldap
一:实验环境在国外有一台xen的vps,装了centos5.3的系统,现在希望在服务器上安装openvpn,远程的客户端,可以通过连接vpn,直接访问国外的网站。
客户端一般都是在内网。假设内网的网段上192.168.1.0/24
vpn server
hostname mail.18demo.com
ip:66.160.197.199
由于我需要测试pop验证和ldap验证,所以我就安装iredmail的ldap版本(iredmail的脚本)。这样就可以测试pop验证和ldap验证。
二:初始化设置由于我的xen的vps,极度精简,下面安装的软件和设置,有些是个人偏好。
iptables是必须安装的。
客户端和vpn server时间最好同步
lrzsz 是用来ssh客户端可以直接上传,下载文件 ssh客户端设置
采用yum的方式安装openvpn,所以需要添加rpmforge,注意你的机器是32 还是64, 需要注意的是rpmforge 提供的是2.09版本,EPEL提供的是2.1版本,2.1的版本修复了一个注销证书的bug。别的没有发现有什么太大的不同。
#修改hostname
sed -i "s/HOSTNAME=eddie1/HOSTNAME=mail.18demo.com/" /etc/sysconfig/network
echo "127.0.0.1 mail.18demo.com mail localhost localhost.localdomain" > /etc/hosts
hostname mail.18demo.com
#安装必备软件
yum -y install wget gzip bzip2 lrzsz vixie-cron vim-enhanced tmpwatch unzip ntp mlocate zip ntp iptables mlocate
#设置vim
mv /bin/vi /bin/vi.save
ln -s /usr/bin/vim /bin/vi
cp /etc/vimrc /etc/vimrc.save
sed -i "39 s/^/ set number \n filetype on\n set history=1000\n syntax on\n set tabstop=4\n set showmatch\n set vb t_vb=\n set mouse=a\n set ignorecase\n set autowrite\n /" /etc/vimrc
#同步时间和时区
mv /etc/localtime /etc/localtime.save
cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
ntpdate cn.pool.ntp.org
#设置acl
sed -i "s/errors=remount-ro/acl,errors=remount-ro /" /etc/fstab
mount -o remount,rw,acl /
二:安装iredmail ldap安装iredmail,可以测试pop验证和ldap验证。
三:OPENVPN
安装openvpnrpmforge 提供的是2.09的版本,EPEL提供的是2.1的版本,我使用2.1的版本,2.1 修复注销证书的bug。另外EPEL的源里才有ldap验证的插件。
rpmforge
rpm -Uhv http://apt.sw.be/redhat/el5/en/i386/rpmforge/RPMS/rpmforge-release-0.3.6-1.el5.rf.i386.rpm #
rpm -Uhv http://apt.sw.be/redhat/el5/en/x86_64/rpmforge/RPMS//rpmforge-release-0.3.6-1.el5.rf.x86_64.rpm #
EPEL yum
#EPEL yum
rpm -Uhv http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-3.noarch.rpm #
rpm -Uhv http://download.fedora.redhat.com/pub/epel/5/x86_64/epel-release-5-3.noarch.rpm # openvpn
yum -y install openvpn
查看openvpn的安装位置
updatedb
locate openvpn
复制模板将模版中的easy-rsa的目录复制到/etc/openvpn/的路径下,这些都是创建证书的脚本。这些脚本有两个版本。2.0的目录是最新版本,建议大家使用这个。目录下有readme,大家可以看看。
注意,不同版本openvpn的easy-rsa的路径不太一样,通过上面locate命令,找出路径,下面是2.1版本的openvpn的路径。
cp -R /usr/share/doc/openvpn-2.0.9/easy-rsa/ /etc/openvpn/
cp -R /usr/share/openvpn/easy-rsa /etc/openvpn/
cd /etc/openvpn/easy-rsa/2.0/
编辑 vars脚本,
根据自己的情况来填写,其实这些内容,你不修改,也不会影响你使用。
vi vars
export KEY_COUNTRY="CN"
export KEY_PROVINCE="BJ"
export KEY_CITY="BeiJing"
export KEY_ORG="iredmail"
export KEY_EMAIL="shake.chen@gmail.com"
让脚本可运行
目录下的所有脚本目前都是不可运行,需要让脚本有可执行的权限
chmod +rwx *
将vars载入系统环境之中
source ./vars
执行clean-all脚本,
留意,这个时候,就会在目录下产生keys的文件夹。
./clean-all
# ll keys/
total 4
-rw-r--r-- 1 root root 0 Jul 26 02:16 index.txt
-rw-r--r-- 1 root root 3 Jul 26 02:16 serial
建立CA证书,
使用pkitool 命令,可以减少交互过程。产生 ca.crt 和 ca.key
./pkitool --initca
# ll keys/
total 12
-rw-r--r-- 1 root root 1212 Jul 26 02:17 ca.crt
-rw------- 1 root root 887 Jul 26 02:17 ca.key
-rw-r--r-- 1 root root 0 Jul 26 02:16 index.txt
-rw-r--r-- 1 root root 3 Jul 26 02:16 serial
建立DH参数文件会产生dh1024.pem文件
./build-dh
ll keys/
total 16
-rw-r--r-- 1 root root 1212 Jul 26 02:17 ca.crt
-rw------- 1 root root 887 Jul 26 02:17 ca.key
-rw-r--r-- 1 root root 245 Jul 26 02:18 dh1024.pem
-rw-r--r-- 1 root root 0 Jul 26 02:16 index.txt
-rw-r--r-- 1 root root 3 Jul 26 02:16 serial
防止恶意攻击(可选)
如DOS、UDP port flooding,生成一个"HMAC firewall", 这个功能可以不启用,减少麻烦。
openvpn --genkey --secret /etc/openvpn/easy-rsa/2.0/keys/ta.key
这个时候,在keys目录下,产生一个ta.key,同时也需要在server.conf 文件里添加一行
tls-auth /etc/openvpn/easy-rsa/2.0/keys/ta.key 0
要启用这个功能,你还需要把 ta.key 这个文件下载到客户端,并且客户端里的配置文件也需要添加一行
tls-auth ta.key 1
ll keys/
total 20
-rw-r--r-- 1 root root 1212 Jul 31 12:04 ca.crt
-rw------- 1 root root 887 Jul 31 12:04 ca.key
-rw-r--r-- 1 root root 245 Jul 31 12:08 dh1024.pem
-rw-r--r-- 1 root root 0 Jul 31 12:02 index.txt
-rw-r--r-- 1 root root 3 Jul 31 12:02 serial
-rw------- 1 root root 636 Jul 31 12:08 ta.key
四:OpenVPN Server 路由模式 +证书验证和证书+密码
建立OpenVPN Server端的证书和密钥
common name是 server
./pkitool --server server
# ll keys/
total 44
-rw-r--r-- 1 root root 3863 Jul 26 02:19 01.pem
-rw-r--r-- 1 root root 1212 Jul 26 02:17 ca.crt
-rw------- 1 root root 887 Jul 26 02:17 ca.key
-rw-r--r-- 1 root root 245 Jul 26 02:18 dh1024.pem
-rw-r--r-- 1 root root 105 Jul 26 02:19 index.txt
-rw-r--r-- 1 root root 21 Jul 26 02:19 index.txt.attr
-rw-r--r-- 1 root root 0 Jul 26 02:16 index.txt.old
-rw-r--r-- 1 root root 3 Jul 26 02:19 serial
-rw-r--r-- 1 root root 3 Jul 26 02:16 serial.old
-rw-r--r-- 1 root root 3863 Jul 26 02:19 server.crt
-rw-r--r-- 1 root root 668 Jul 26 02:19 server.csr
-rw------- 1 root root 887 Jul 26 02:19 server.key
建立OpenVPN Client端的证书和密钥
comon name 是 client1
./pkitool client1
# ll keys/
total 68
-rw-r--r-- 1 root root 3863 Jul 26 02:19 01.pem
-rw-r--r-- 1 root root 3747 Jul 26 02:20 02.pem
-rw-r--r-- 1 root root 1212 Jul 26 02:17 ca.crt
-rw------- 1 root root 887 Jul 26 02:17 ca.key
-rw-r--r-- 1 root root 3747 Jul 26 02:20 client1.crt
-rw-r--r-- 1 root root 672 Jul 26 02:20 client1.csr
-rw------- 1 root root 887 Jul 26 02:20 client1.key
-rw-r--r-- 1 root root 245 Jul 26 02:18 dh1024.pem
-rw-r--r-- 1 root root 211 Jul 26 02:20 index.txt
-rw-r--r-- 1 root root 20 Jul 26 02:20 index.txt.attr
-rw-r--r-- 1 root root 21 Jul 26 02:19 index.txt.attr.old
-rw-r--r-- 1 root root 105 Jul 26 02:19 index.txt.old
-rw-r--r-- 1 root root 3 Jul 26 02:20 serial
-rw-r--r-- 1 root root 3 Jul 26 02:19 serial.old
-rw-r--r-- 1 root root 3863 Jul 26 02:19 server.crt
-rw-r--r-- 1 root root 668 Jul 26 02:19 server.csr
-rw------- 1 root root 887 Jul 26 02:19 server.key
创建一个客户端需要输入密码的证书
客户端不但需要证书,还需要密码,而且这个密码,客户端可以自己进行修改。这个倒是非常不错。
-bash-3.2# ./pkitool --pass client2
Generating a 1024 bit RSA private key
......++++++
........++++++
writing new private key to 'client2.key'
Enter PEM pass phrase: 输入密码
Verifying - Enter PEM pass phrase:
-----
Using configuration from /etc/openvpn/easy-rsa/2.0/openssl.cnf
Check that the request matches the signature
Signature ok
The Subject's Distinguished Name is as follows
countryName :PRINTABLE:'CN'
stateOrProvinceName :PRINTABLE:'BJ'
localityName :PRINTABLE:'BeiJing'
organizationName :PRINTABLE:'iredmail'
commonName :PRINTABLE:'client2'
emailAddress :IA5STRING:'shake.chen@gmail.com'
Certificate is to be certified until Jul 19 12:32:20 2019 GMT (3650 days)
Write out database with 1 new entries
Data Base Updated
ll keys/
total 84
-rw-r--r-- 1 root root 3863 Jul 26 02:19 01.pem
-rw-r--r-- 1 root root 3747 Jul 26 02:20 02.pem
-rw-r--r-- 1 root root 3747 Jul 26 02:21 03.pem
-rw-r--r-- 1 root root 1212 Jul 26 02:17 ca.crt
-rw------- 1 root root 887 Jul 26 02:17 ca.key
-rw-r--r-- 1 root root 3747 Jul 26 02:20 client1.crt
-rw-r--r-- 1 root root 672 Jul 26 02:20 client1.csr
-rw------- 1 root root 887 Jul 26 02:20 client1.key
-rw-r--r-- 1 root root 3747 Jul 26 02:21 client2.crt
-rw-r--r-- 1 root root 672 Jul 26 02:21 client2.csr
-rw------- 1 root root 963 Jul 26 02:21 client2.key
-rw-r--r-- 1 root root 245 Jul 26 02:18 dh1024.pem
-rw-r--r-- 1 root root 317 Jul 26 02:21 index.txt
-rw-r--r-- 1 root root 20 Jul 26 02:21 index.txt.attr
-rw-r--r-- 1 root root 20 Jul 26 02:20 index.txt.attr.old
-rw-r--r-- 1 root root 211 Jul 26 02:20 index.txt.old
-rw-r--r-- 1 root root 3 Jul 26 02:21 serial
-rw-r--r-- 1 root root 3 Jul 26 02:20 serial.old
-rw-r--r-- 1 root root 3863 Jul 26 02:19 server.crt
-rw-r--r-- 1 root root 668 Jul 26 02:19 server.csr
-rw------- 1 root root 887 Jul 26 02:19 server.key
注销证书
这是一个bug,如果你直接注销证书,会出现一个报错,如果你是2.1的版本,就没有这个bug。如果你是使用epel的源,那么不会有这个问题。如果你是用epel,就可以忽略。
Using configuration from /etc/openvpn/easy-rsa/2.0/openssl.cnf
error on line 282 of config file '/etc/openvpn/easy-rsa/2.0/openssl.cnf'
所以需要编辑openssl.cnf 文件,把[ pkcs11_section ]注释掉,就可以了。
# [ pkcs11_section ]
# engine_id = pkcs11
# dynamic_path = /usr/lib/engines/engine_pkcs11.so
# MODULE_PATH = $ENV::PKCS11_MODULE_PATH
# PIN = $ENV::PKCS11_PIN
# init = 0
注销client2证书,
./revoke-full client2
-bash-3.2# ./revoke-full client2
Using configuration from /etc/openvpn/easy-rsa/2.0/openssl.cnf
Revoking Certificate 03.
Data Base Updated
Using configuration from /etc/openvpn/easy-rsa/2.0/openssl.cnf
client2.crt: /C=CN/ST=BJ/L=BeiJing/O=iredmail/CN=client2/emailAddress=shake.chen@gmail.com
error 23 at 0 depth lookup:certificate revoked
这就表示成功,这个时候,就会在keys目录下,产生一个文件crl.pem,这个文件就保存着注销掉客户端的名字,我们还需要在server.conf 文件里添加
crl-verify /etc/openvpn/crl.pem
这个时候,你的客户端就再也不能连接。
注意,如果你的证书是放在这个目录下/etc/openvpn/easy-rsa/2.0/keys/crl.pem,那么会出现没有权限读取的log报错,只能把这个文件放到 /etc/openvpn/crl.pem目录下就可以。
ll keys/
total 96
-rw-r--r-- 1 root root 3863 Jul 31 12:09 01.pem
-rw-r--r-- 1 root root 3747 Jul 31 12:09 02.pem
-rw-r--r-- 1 root root 3747 Jul 31 12:09 03.pem
-rw-r--r-- 1 root root 1212 Jul 31 12:04 ca.crt
-rw------- 1 root root 887 Jul 31 12:04 ca.key
-rw-r--r-- 1 root root 3747 Jul 31 12:09 client1.crt
-rw-r--r-- 1 root root 672 Jul 31 12:09 client1.csr
-rw------- 1 root root 887 Jul 31 12:09 client1.key
-rw-r--r-- 1 root root 3747 Jul 31 12:09 client2.crt
-rw-r--r-- 1 root root 672 Jul 31 12:09 client2.csr
-rw------- 1 root root 963 Jul 31 12:09 client2.key
-rw-r--r-- 1 root root 516 Jul 31 12:10 crl.pem
-rw-r--r-- 1 root root 245 Jul 31 12:08 dh1024.pem
-rw-r--r-- 1 root root 330 Jul 31 12:10 index.txt
-rw-r--r-- 1 root root 20 Jul 31 12:10 index.txt.attr
-rw-r--r-- 1 root root 20 Jul 31 12:09 index.txt.attr.old
-rw-r--r-- 1 root root 317 Jul 31 12:09 index.txt.old
-rw-r--r-- 1 root root 1728 Jul 31 12:10 revoke-test.pem
-rw-r--r-- 1 root root 3 Jul 31 12:09 serial
-rw-r--r-- 1 root root 3 Jul 31 12:09 serial.old
-rw-r--r-- 1 root root 3863 Jul 31 12:09 server.crt
-rw-r--r-- 1 root root 668 Jul 31 12:09 server.csr
-rw------- 1 root root 887 Jul 31 12:09 server.key
-rw------- 1 root root 636 Jul 31 12:08 ta.key
启用ip转发,并且配置iptable,实现NAT
假如iptables是刚装好,没有任何的规则。
iptables设置
vi /etc/sysconfig/iptables
#openvpn
-A INPUT -p udp -m multiport --dport 1194 -j ACCEPT
vi /etc/init.d/openvpn
#Uncomment this line (about line 134)
echo 1 > /proc/sys/net/ipv4/ip_forward
#Add these lines below it, changing 66.160.197.199to your public IP address,
iptables -t nat -A POSTROUTING -s 10.8.0.0/24 -j SNAT --to 66.160.197.199
service openvpn restart
service iptables restart
设置log
建立配置文件中指定的日志文件,并赋予正确的权限
touch /var/log/openvpn.log
touch /var/log/openvpn-status.log
chown nobody.nobody /var/log/openvpn.log
chown nobody.nobody /var/log/openvpn-status.log
设置client-config-dir ccd如果不进行这个设置,log会报错,
Thu Jul 30 09:04:02 2009 client1/61.49.255.21:2512 MULTI: bad source address from client [192.168.1.120], packet dropped
下面的route的网段,就是客户端所在网段。
cd /etc/openvpn
mkdir ccd
cd ccd
vi client1
iroute 192.168.1.0 255.255.255.0
OpnVPN Server端的主配置文件
openvpn 所有设置都在这个文件
cd /etc/openvpn/
cp /usr/share/doc/openvpn-2.1/sample-config-files/server.conf /etc/openvpn/
vi server.conf
看附录
客户端把证书压缩,下载到本地,可以使用sz来下载。
注意:如果启用防止dos攻击的功能,需要把ta.key 也下载,每个客户端都需要包含这个文件,并且客户端的配置文件也需要添加。
cp /usr/share/doc/openvpn-2.1.1/sample-config-files/client.conf /etc/openvpn/easy-rsa/2.0/keys/client.ovpn
cd /etc/openvpn/easy-rsa/2.0/keys
zip client1.zip ca.crt client1.crt client1.key client.ovpn
sz client1.zip
修改client.ovpn文件
remote mail.18demo.com 1194
cert client1.crt
key client1.key
#tls-auth ta.key 1
五:OpenVPN Server 路由模式 +mysql 验证OpenVPN的用户登录验证是这样的
OpenVPN--->openvpn-auth-pam.so--->PAM--->Mysql/LDAP
rpm -Uhv http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-3.noarch.rpm #
rpm -Uhv http://download.fedora.redhat.com/pub/epel/5/x86_64/epel-release-5-3.noarch.rpm #
安装软件需要让mysql支持pam的验证
检查saslauthd是否安装
rpm -qa | grep cyrus-sasl
yum install cyrus-sasl
安装pam_mysql 让mysql支持pam认证
目前pam_mysql 已经有rpm包,不过目前我只能添加http://rpm.pbone.net 通过这个源来安装,还没有找到合适的源。
yum install pam_mysql
service mysqld restart
安装pam-devel, 如果没有这个,log里会出现
AUTH-PAM: BACKGROUND: could not load PAM lib libpam.so: libpam.so: cannot open shared object file: No such file or directory
导致你无法启动openvpn
yum install pam-devel
创建数据库我们创建一个vpn的数据库,管理员的用户名:vpn,密码:vpn123
并且创建一个用户elm,密码也是elm,密码采用MD5加密。
mysql -uroot -p
create database vpn;
GRANT ALL ON vpn.* TO vpn@localhost IDENTIFIED BY 'vpn123';
flush privileges;
use vpn;
CREATE TABLE vpnuser (
name char(20) NOT NULL,
password char(128) default NULL,
active int(10) NOT NULL DEFAULT 1,
PRIMARY KEY (name)
);
INSERT INTO vpnuser( name,
PASSWORD )
VALUES (
'elm', md5('elm')
);
配置pam_mysql模块
需要注意到是crypt=3这个参数的设置,表示数据库密码是使用MD5加密。
这里如果你设置crypt=2,使用mysql的 password的函数来加密,会出现用户无法登陆。具体原因是Mysql 的 password 函数因为 mysql 的加密函数和 pam_mysql的加密函数不相同。
0 = 明文
1 = Use crypt
2 = Use MySQL PASSWORD() function
3 = md5
vi /etc/pam.d/openvpn
auth sufficient pam_mysql.so user=vpn passwd=vpn123 host=localhost db=vpn \
table=vpnuser usercolumn=name passwdcolumn=password \
where=active=1 sqllog=0 crypt=3
account required pam_mysql.so user=vpn passwd=vpn123 host=localhost db=vpn \
table=vpnuser usercolumn=name passwdcolumn=password \
where=active=1 sqllog=0 crypt=3
修改server和客户端文件
[b]server 文件
plugin /usr/share/openvpn/plugin/lib/openvpn-auth-pam.so openvpn
client-cert-not-required
username-as-common-name
[b]客户端
配置客户端配置文件
注释掉
;cert client1.crt
;key client1.key
增加
#询问用户名和密码
auth-user-pass
这个时候,你就可以用
user:elm
pass:elm
登录openvpn
六:OpenVPN Server 路由模式 + 文本口令认证
下载脚本
wget http://openvpn.se/files/other/checkpsw.sh -P /etc/openvpn
cd /etc/openvpn
chmod u+x checkpsw.sh
chown nobody.nobody checkpsw.sh
创建 /etc/openvpn/psw-file
格式:用户名Tab密码
user1 pass
user2 pass
在server.conf 配置文件里加上
auth-user-pass-verify /etc/openvpn/checkpsw.sh via-env
客户端的修改和上面一样。
注释掉
;cert client1.crt
;key client1.key
增加
#询问用户名和密码
auth-user-pass
这个时候就可以登录,不过注意,mysql和text方式的验证,好像只能选择一种。
七:OpenVPN Server 路由模式 + POP认证
原理和text基本一样。
vi /etc/openvpn/popauth.pl
chmod +x /etc/openvpn/popauth.pl
在server文件里,添加
auth-user-pass-verify /etc/openvpn/popauth.pl via-env
下面就是popauth.pl
#!/usr/bin/perl
# Write by ELM
# wzk [A|T] wenzk [D|O|T] net
# http://www.wenzk.net
#
# POP3 Auth script for OpenVPN
# Usage:
# save this file to /etc/openvpn/ as popauth.pl
# run: chmod +x /etc/openvpn/popauth.pl
# add the next line to you OpenVPN config file
# auth-user-pass-verify /etc/openvpn/popauth.pl via-env
# restart your OpenVPN Server
use Net::POP3;
# POP Server Address
$POPHOST = "localhost";
$USERNAME = $ENV{username};
$PASSWORD = $ENV{password};
# Constructors
$pop = Net::POP3->new($POPHOST);
$pop = Net::POP3->new($POPHOST, Timeout => 60);
if ( defined $pop->login($USERNAME, $PASSWORD) ) {
$result = 0;
} else {
$result = 1;
}
$pop->quit;
exit $result;
八:ldap验证
yum install openvpn-auth-ldap
# LDAP server URL
URL ldap://mail.18demo.com
# Bind DN (If your LDAP server doesn't support anonymous binds)
# BindDN uid=Manager,ou=People,dc=example,dc=com
BindDN cn=manager,dc=18demo,dc=com
# Bind Password
# Password SecretPassword
Password iredmail
# Network timeout (in seconds)
Timeout 15
# Enable Start TLS
#TLSEnable yes
TLSEnable no
# Follow LDAP Referrals (anonymously)
#FollowReferrals yes
# TLS CA Certificate File
#TLSCACertFile /usr/local/etc/ssl/ca.pem
# TLS CA Certificate Directory
#TLSCACertDir /etc/ssl/certs
# Client Certificate and key
# If TLS client authentication is required
#TLSCertFile /usr/local/etc/ssl/client-cert.pem
#TLSKeyFile /usr/local/etc/ssl/client-key.pem
# Cipher Suite
# The defaults are usually fine here
# TLSCipherSuite ALL:!ADH:@STRENGTH
# Base DN
#BaseDN "ou=People,dc=example,dc=com"
BaseDN "domainName=example.com,o=domains,dc=18demo,dc=com"
# User Search Filter
#SearchFilter "(&(uid=%u)(accountStatus=active))"
SearchFilter "(accountStatus=active)"
# Require Group Membership
RequireGroup false
# Add non-group members to a PF table (disabled)
# Add non-group members to a PF table (disabled)
#PFTable ips_vpn_users
BaseDN "ou=Groups,dc=example,dc=com"
SearchFilter "(|(cn=developers)(cn=artists))"
MemberAttribute uniqueMember
# Add group members to a PF table (disabled)
#PFTable ips_vpn_eng
需要pam-ldap.so模块,在centos下,我们需要安装nss_ldap
yum install nss_ldap
cp /usr/share/doc/nss_ldap-253/ldap.conf.pam_ldap /etc/pam_ldap.conf
create /etc/pam.d/openvpn
auth required /lib/security/pam_ldap.so
account required /lib/security/pam_ldap.so
http://www.nabble.com/openvpn-auth-pam.so,-pam_ldap-td9858335.html
http://www.allenzheng.com/read.php/8.htm
http://www.matthardy.info/2009/configure-openvpn-to-authenticate-against-active-directory-ldap-in-linux/
四:附录
server.conf配置文件
port 1194
proto udp
dev tun
ca /etc/openvpn/easy-rsa/2.0/keys/ca.crt
cert /etc/openvpn/easy-rsa/2.0/keys/server.crt
key /etc/openvpn/easy-rsa/2.0/keys/server.key # This file should be kept secret
dh /etc/openvpn/easy-rsa/2.0/keys/dh1024.pem
;crl-verify /etc/openvpn/easy-rsa/2.0/keys/crl.pem
server 10.8.0.0 255.255.255.0
ifconfig-pool-persist ipp.txt
client-config-dir ccd
route 192.168.1.0 255.255.255.0
push "redirect-gateway def1"
;push "dhcp-option DNS 10.8.0.1"
;push "dhcp-option WINS 10.8.0.1"
;client-to-client
;duplicate-cn
keepalive 10 120
;tls-auth /etc/openvpn/easy-rsa/2.0/keys/ta.key 0
comp-lzo
;max-clients 100
user nobody
group nobody
persist-key
persist-tun
status /var/log/openvpn-status.log
log-append /var/log/openvpn.log
verb 3
mute 20
#pop auth
#auth-user-pass-verify /etc/openvpn/popauth.pl via-env
#text auth
#auth-user-pass-verify /etc/openvpn/checkpsw.sh via-env
#pam auth
#plugin /usr/share/openvpn/plugin/lib/openvpn-auth-pam.so openvpn
client-cert-not-required
username-as-common-name
iptables设置
通过输入命令iptables-save >
通过输入iptables-restore
保存对防火墙的设置并重新启动防火墙
#service iptables save
#service iptables restart
/usr/lib64/openvpn/plugin/lib/openvpn-auth-ldap.so
参考文章
http://www.xiaohui.com/dev/server/20070514-install-openvpn.htm
http://forum.ebox-platform.com/index.php?topic=1646.0
plugin /usr/lib/openvpn/plugin/lib/openvpn-auth-ldap.so /etc/openvpn/auth/ldap.conf
vmview4发生错误Desktop Composer Fault: Virtual Machine with input specifications already exists 的解决方案
[
2010/05/20 09:42 | by suibing ]
2010/05/20 09:42 | by suibing ]
删除以下表的内容即可
#
delete from SVI_SC_BASE_DISK_KEYS
where PARENT_ID = (SELECT ID FROM SVI_SIM_CLONE
WHERE (VM_NAME = ‘’))
delete from SVI_SC_PDISK_INFO
where PARENT_ID = (SELECT ID FROM SVI_SIM_CLONE
WHERE (VM_NAME = ‘’))
delete FROM SVI_SIM_CLONE
WHERE (VM_NAME = ‘’)
You cannot provision a linked clone desktop pool
You see the error:
Desktop Composer Fault: 'Virtual Machine with Input Specification already exists
Provisioning a linked clone desktop pool fails with the error:
Virtual machine with Input Specification already exists
The Connection Server shows that linked clone virtual machines are stuck in a Deleting state
Resolution
This issue occurs if a table in the database has incorrect data. You must delete the pae-VM object from the ADAM database and from the View Composer database so the tables regenerate properly.
Removing the virtual machine from the ADAM database
Find the virtual machine's GUID stored in ADAM:
Log in to the culprit virtual machine using the VMware Infrastructure (VI) Client Console or directly using Windows RDP.
Open the Windows registry, go to HKEY_LOCAL_MACHINE\SOFTWARE\VMware, Inc.\VMware VDM\Node Manager\Server DN.
Record the cn=.
To delete the pae-VM object from the ADAM database:
Click Start > Programs > ADAM > ADAM ADSI Edit to open the ADAM Active Directory Service Interfaces Editor.
Right-click ADAM ADSI Edit and click Connect to.
Choose Distinguished name (DN) or naming context and type dc=vdi, dc=vmware, dc=int.
Note: For more information about ADSI Edit, see http://technet.microsoft.com/en-us/library/cc773354%28WS.10%29.aspx.
The preceding link was correct as of July 15, 2009. If you find the link is broken, provide feedback and a VMware employee will update the link.
Locate the OU=SERVERS container.
Locate the corresponding virtual machine's GUID (from above) in the list which can be sorted in ascending or descending order, choose Properties and check the pae-DisplayName Attribute to verify the corresponding linked clone virtual machine object.
Delete the pae-VM object.
Removing the linked clone references from the View Composer database
To remove the linked clone references from the View Composer database:
Open SQL Manager > Databases > View Composer database > Tables.
Open dbo.SVI_VM_NAME table and delete the entire row where the virtual machine is referenced under column NAME.
Open dbo.SVI_COMPUTER_NAME table and delete the entire row where the virtual machine is referenced under column NAME.
Open dbo.SVI_SIM_CLONE table, find the virtual machine reference under column VM_NAME and note the ID. If you try to delete this row it complains about other table dependencies.
Open dbo.SVI_SC_PDISK_INFO table and delete the entire row where dbo.SVI_SIM_CLONE ID is referenced under column PARENT_ID.
Open dbo.SVI_SC_BASE_DISK_KEYS table and delete the entire row where dbo.SVI_SIM_CLONE ID is referenced under column PARENT_ID.
If the linked clone was in the process of being deployed when a problem occurred, there may be additional references to the clone left around in the dbo.SVI_TASK_STATE table and dbo.SVI_REQUEST table.
Open dbo.SVI_TASK_STATE table and find the row where dbo.SVI_SIM_CLONE ID is referenced under column SIM_CLONE_ID. Note the REQUEST_ID in that row.
Open dbo.SVI_REQUEST table and delete the entire row where dbo.SVI_TASK_STATE REQUEST_ID is referenced ID.
Delete the entire row from dbo.SVI_TASK_STATE table.
In dbo.SVI_SIM_CLONE table, delete the entire row where the virtual machine is referenced.
Remove the virtual machine from Active Directory Users and Computers.
Deleting the virtual machine from VirtualCenter
To delete the virtual machine from VirtualCenter:
Log in to VirtualCenter using the VI Client.
Right-click the linked clone virtual machine and click Delete from Disk.
#
delete from SVI_SC_BASE_DISK_KEYS
where PARENT_ID = (SELECT ID FROM SVI_SIM_CLONE
WHERE (VM_NAME = ‘
delete from SVI_SC_PDISK_INFO
where PARENT_ID = (SELECT ID FROM SVI_SIM_CLONE
WHERE (VM_NAME = ‘
delete FROM SVI_SIM_CLONE
WHERE (VM_NAME = ‘
You cannot provision a linked clone desktop pool
You see the error:
Desktop Composer Fault: 'Virtual Machine with Input Specification already exists
Provisioning a linked clone desktop pool fails with the error:
Virtual machine with Input Specification already exists
The Connection Server shows that linked clone virtual machines are stuck in a Deleting state
Resolution
This issue occurs if a table in the database has incorrect data. You must delete the pae-VM object from the ADAM database and from the View Composer database so the tables regenerate properly.
Removing the virtual machine from the ADAM database
Find the virtual machine's GUID stored in ADAM:
Log in to the culprit virtual machine using the VMware Infrastructure (VI) Client Console or directly using Windows RDP.
Open the Windows registry, go to HKEY_LOCAL_MACHINE\SOFTWARE\VMware, Inc.\VMware VDM\Node Manager\Server DN.
Record the cn=
To delete the pae-VM object from the ADAM database:
Click Start > Programs > ADAM > ADAM ADSI Edit to open the ADAM Active Directory Service Interfaces Editor.
Right-click ADAM ADSI Edit and click Connect to.
Choose Distinguished name (DN) or naming context and type dc=vdi, dc=vmware, dc=int.
Note: For more information about ADSI Edit, see http://technet.microsoft.com/en-us/library/cc773354%28WS.10%29.aspx.
The preceding link was correct as of July 15, 2009. If you find the link is broken, provide feedback and a VMware employee will update the link.
Locate the OU=SERVERS container.
Locate the corresponding virtual machine's GUID (from above) in the list which can be sorted in ascending or descending order, choose Properties and check the pae-DisplayName Attribute to verify the corresponding linked clone virtual machine object.
Delete the pae-VM object.
Removing the linked clone references from the View Composer database
To remove the linked clone references from the View Composer database:
Open SQL Manager > Databases > View Composer database > Tables.
Open dbo.SVI_VM_NAME table and delete the entire row where the virtual machine is referenced under column NAME.
Open dbo.SVI_COMPUTER_NAME table and delete the entire row where the virtual machine is referenced under column NAME.
Open dbo.SVI_SIM_CLONE table, find the virtual machine reference under column VM_NAME and note the ID. If you try to delete this row it complains about other table dependencies.
Open dbo.SVI_SC_PDISK_INFO table and delete the entire row where dbo.SVI_SIM_CLONE ID is referenced under column PARENT_ID.
Open dbo.SVI_SC_BASE_DISK_KEYS table and delete the entire row where dbo.SVI_SIM_CLONE ID is referenced under column PARENT_ID.
If the linked clone was in the process of being deployed when a problem occurred, there may be additional references to the clone left around in the dbo.SVI_TASK_STATE table and dbo.SVI_REQUEST table.
Open dbo.SVI_TASK_STATE table and find the row where dbo.SVI_SIM_CLONE ID is referenced under column SIM_CLONE_ID. Note the REQUEST_ID in that row.
Open dbo.SVI_REQUEST table and delete the entire row where dbo.SVI_TASK_STATE REQUEST_ID is referenced ID.
Delete the entire row from dbo.SVI_TASK_STATE table.
In dbo.SVI_SIM_CLONE table, delete the entire row where the virtual machine is referenced.
Remove the virtual machine from Active Directory Users and Computers.
Deleting the virtual machine from VirtualCenter
To delete the virtual machine from VirtualCenter:
Log in to VirtualCenter using the VI Client.
Right-click the linked clone virtual machine and click Delete from Disk.
OpenVZ型VPS安装Teredo接入IPv6
[
2010/04/23 23:35 | by suibing ]
2010/04/23 23:35 | by suibing ]
没有原生提供IPv6的XEN型VPS可以在Hurricane Electric申请一个TunnelBroker接入IPv6,对OpenVZ型VPS,由于目前绝大多数VPS的提供的OpenVZ内核没有打上虚拟sit0设备的补丁,所以不能使用TunnelBroker(已经可用,参阅http://www.lostriver.net/linux-userspace-6to4-tun/)。但如果VPS提供TUN/TAP设备,可以通过Teredo接入IPv6。
Linux上的开源Teredo客户端叫Miredo。对于Ubuntu/Debian,Miredo已经有了deb安装包,开启TUN/TAP后运行apt-get install miredo,再次用ifconfig查看时,名为teredo的TUN/TAP接口已经配置完成,IPv6前缀为2001:0:53aa:64c:。惟一一点遗憾是Miredo占用了约30M内存(是在保存peer list么?),对于小内存VPS有些压力。另外注意每次reboot或者重启Miredo进程后,IPv6地址将会改变。
Teredo也可以为位于IPv4 NAT内的主机提供IPv6接入(6to4必须要客户端有public IPv4 address),完整的Teredo接入需要客户端、Teredo Server和Teredo Relay。(Wiki在此)。由于需要bubble packet,国内又没有Teredo Relay(中国CERNET2内,可见的Teredo Relay位于欧洲),第一个IPv6数据包往返可能长达1000ms,后续数据包往返大约在300ms+。
Teredo接入与6to4类似,对于不同的IPv6地址使用不同的中继;不同之处是Teredo Relay在IPv6网络anycast 2001::/32前缀,而6to4 Relay除在IPv6网anycast 2002::/16,还在IPv4网络anycast 192.88.99.1。
CERNET2有线路tein3至欧洲,目前到本站IPv6的Teredo中继是funet.fi(芬兰),延时200ms+,再从芬兰到美国的VPS又加上100ms延时。带宽十分充裕,但在高峰时段丢包率达到25%,v4和v6线路都有丢包。
一般来说同时具有IPv4与IPv6地址的域名,将优先使用IPv6访问。但对于Teredo接入IPv6,系统会优先使用IPv4访问以获得更好的接入质量。所以添加IPv6域名应慎重,对于CERNET用户,系统会优先使用IPv4访问,经过几十秒超时后才使用IPv6,体验极差。
6to4可以在没有原生IPv6接入时构建IPv6 over IPv4隧道。该协议已经被linux内核所支持,内核提供了虚拟设备sit自动配置IPv6隧道。很多ISP也提供免费的TunnelBroker。但如果内核没有支持sit设备(比如现在大多数OpenVZ的VPS的内核时都没有支持sit),则在运行
# ip tunnel add 6to4 mode sit
会出现
ioctl: No such device
搜索了一下,似乎还没有运行于linux的第三方程序能建立6to4隧道,于是只好自己写一个。程序放在了
Please visit http://code.google.com/p/tb-tun/。
RFC3056包含了6to4隧道大多数细节,我只看了数据包封装,十分简单,把IPv6数据包(包括header和payload)直接作为IP数据包的packet body。注意IPv4数据包的协议类型为41(C语言里面定义常数IPPROTO_IPV6)。
程序首先创建TUN设备,并开启SOCK_RAW监听协议41(由于用了原始套接字,运行时必须要有root权限)。然后创建两个线程s2t和t2s,s2t把sock上监听到源地址正确、协议类型为41的IP包去掉包头写入TUN设备,t2s读取TUN设备上的数据并封入IP数据包作为内容发送给Relay Server。
t2s比较容易,惟一疑惑是使用sendto()函数时,远端地址结构体remoteaddr.sin_port不知道如何填写,因为封装的不是TCP或者UDP,没有端口号。填写为htons(IPPROTO_IPV6)没有出现问题。
s2t则出现了一些问题,明明向TUN设备写入了正确的数据包,却无法正确被应用程序识别,tcpdump返回wrong link-layer encapsulationbad-hlen。
重新查看了内核TUN/TAP设备的文档,原来TUN设备模拟点对点链路,也存在链路数据包头。通常创建TUN/TAP设备时使用了flag IFF_NO_PI缺省了链路层包头,内核自动把协议字填写为IP数据包。与实际的IPv6不符导致错误。
flag IFF_NO_PI没有设置时,链路附加包头为:
struct tun_pi {
unsigned short flags;
unsigned short proto;
};
flag仅在接收数据包时有效,这里向TUN设备写入,即发送数据包,这一字可以置0,proto应该填写htons(ETH_P_IPV6)。
向TUN写入时,需要在从sock读取的IPv6数据包前加入4个字节的上述结构体。t2s函数也要进行相应修改,除去上述的4个字节链路包头。
如何配置6to4 tunnel参阅Google Code上的HOWTO。试验了一下资源占用,内存占用约0.5M,CPU使用为wget的2倍。没有测试过兼容性,代码也显然还有很大改进空间
Linux上的开源Teredo客户端叫Miredo。对于Ubuntu/Debian,Miredo已经有了deb安装包,开启TUN/TAP后运行apt-get install miredo,再次用ifconfig查看时,名为teredo的TUN/TAP接口已经配置完成,IPv6前缀为2001:0:53aa:64c:。惟一一点遗憾是Miredo占用了约30M内存(是在保存peer list么?),对于小内存VPS有些压力。另外注意每次reboot或者重启Miredo进程后,IPv6地址将会改变。
Teredo也可以为位于IPv4 NAT内的主机提供IPv6接入(6to4必须要客户端有public IPv4 address),完整的Teredo接入需要客户端、Teredo Server和Teredo Relay。(Wiki在此)。由于需要bubble packet,国内又没有Teredo Relay(中国CERNET2内,可见的Teredo Relay位于欧洲),第一个IPv6数据包往返可能长达1000ms,后续数据包往返大约在300ms+。
Teredo接入与6to4类似,对于不同的IPv6地址使用不同的中继;不同之处是Teredo Relay在IPv6网络anycast 2001::/32前缀,而6to4 Relay除在IPv6网anycast 2002::/16,还在IPv4网络anycast 192.88.99.1。
CERNET2有线路tein3至欧洲,目前到本站IPv6的Teredo中继是funet.fi(芬兰),延时200ms+,再从芬兰到美国的VPS又加上100ms延时。带宽十分充裕,但在高峰时段丢包率达到25%,v4和v6线路都有丢包。
一般来说同时具有IPv4与IPv6地址的域名,将优先使用IPv6访问。但对于Teredo接入IPv6,系统会优先使用IPv4访问以获得更好的接入质量。所以添加IPv6域名应慎重,对于CERNET用户,系统会优先使用IPv4访问,经过几十秒超时后才使用IPv6,体验极差。
6to4可以在没有原生IPv6接入时构建IPv6 over IPv4隧道。该协议已经被linux内核所支持,内核提供了虚拟设备sit自动配置IPv6隧道。很多ISP也提供免费的TunnelBroker。但如果内核没有支持sit设备(比如现在大多数OpenVZ的VPS的内核时都没有支持sit),则在运行
# ip tunnel add 6to4 mode sit
会出现
ioctl: No such device
搜索了一下,似乎还没有运行于linux的第三方程序能建立6to4隧道,于是只好自己写一个。程序放在了
Please visit http://code.google.com/p/tb-tun/。
RFC3056包含了6to4隧道大多数细节,我只看了数据包封装,十分简单,把IPv6数据包(包括header和payload)直接作为IP数据包的packet body。注意IPv4数据包的协议类型为41(C语言里面定义常数IPPROTO_IPV6)。
程序首先创建TUN设备,并开启SOCK_RAW监听协议41(由于用了原始套接字,运行时必须要有root权限)。然后创建两个线程s2t和t2s,s2t把sock上监听到源地址正确、协议类型为41的IP包去掉包头写入TUN设备,t2s读取TUN设备上的数据并封入IP数据包作为内容发送给Relay Server。
t2s比较容易,惟一疑惑是使用sendto()函数时,远端地址结构体remoteaddr.sin_port不知道如何填写,因为封装的不是TCP或者UDP,没有端口号。填写为htons(IPPROTO_IPV6)没有出现问题。
s2t则出现了一些问题,明明向TUN设备写入了正确的数据包,却无法正确被应用程序识别,tcpdump返回wrong link-layer encapsulationbad-hlen。
重新查看了内核TUN/TAP设备的文档,原来TUN设备模拟点对点链路,也存在链路数据包头。通常创建TUN/TAP设备时使用了flag IFF_NO_PI缺省了链路层包头,内核自动把协议字填写为IP数据包。与实际的IPv6不符导致错误。
flag IFF_NO_PI没有设置时,链路附加包头为:
struct tun_pi {
unsigned short flags;
unsigned short proto;
};
flag仅在接收数据包时有效,这里向TUN设备写入,即发送数据包,这一字可以置0,proto应该填写htons(ETH_P_IPV6)。
向TUN写入时,需要在从sock读取的IPv6数据包前加入4个字节的上述结构体。t2s函数也要进行相应修改,除去上述的4个字节链路包头。
如何配置6to4 tunnel参阅Google Code上的HOWTO。试验了一下资源占用,内存占用约0.5M,CPU使用为wget的2倍。没有测试过兼容性,代码也显然还有很大改进空间
这几天很不爽,去年一个高中同学(住在山东)要求帮他转一下钱(就是那种他公司转给我,我帮忙转给他,他再给客户那种,赚点差价那种)。其实我挺懒得去银行的,上海的银行排队很厉害的。既然他信任咱,咱当然会去做了,互相帮助嘛。于是在他打款第3天(可能是,好像也隔了个周末),刚好比较空,就早早去建行汇款了。这次顺利的完成了,也没什么问题。这次是3万多。
春节回来以后,也就是上上周四或者周五,13或者12号吧,具体记不清了,再次打了一次款,那天我好像在电信机房被放了一天鸽子,火死了,可恶的电信,正在策划新的合作idc,跑题了。。。。反正很忙,于是想反正也没多少钱,迟一点也没关系。于是就到了周末。周末在加班的时候,同学发短信来说,让我今天转给他。我很无语,周末这边的建行根本不营业,如果营业的话我也不至于非要工作日的时候去银行,那样就方便多了。于是我就会周末不营业,工作日吧。他说,银行营业的,可以办私人业务的,你打车去吧。非常无语,不说我在加班,就是不在加班,难道我就要周末专门跑到总行那里去汇款?而且我在加班。。。。。。本来想周一-周五中午利用休息时间去打款,不料这一周忙的不可开交,由于更换了两台服务器,里面有N多需要重新配置的东西,还要上传近300G的文件,然后重新配置。而且发现KVM做的虚拟机性能很差,下载上传速度只有几百K,而且会卡住!!!早知道就不升级了,老版本还有几M的读写速度。反正就是很郁闷,再加上电信还是没把ip地址的问题搞定,于是又去了两次电信机房,重装了系统,,回来以后就开始重新配置xen的虚拟机,经过两天两夜的研究终于搞定了hypervm跟新建的网桥的关系,于是就到周五了。这一个星期,这位老同学,经常短信或者电话催我把钱打给他,几乎每天都会催一下,我已经逐渐开始反感了。我好几天中午连吃饭的时间都没有,都是快一点了到外面随便买得吃的又回来工作,哪里有时间去给汇钱!即使这样,我们的好几个服务也因此停止服务了一周,周五下午才全部部署好,两个网站恢复正常,其他的虚拟机也开始正常工作,文件基本上传完毕。周六中午在休息的时候又打了好久个电话过来,发了N条短信说周日要过来了,要来上海开会,同时来拿现金,由于周六在外面购物,没听见手机铃声,看到7-8个未接来电,4条短信,主要是想讲一下要过来拿现金的,我已经很反感了,如果你不信任的话就不要找我帮你转钱,我又不是闲着没事情做,而且又不要你的任何好处!
周末晚上7点同学终于打车过来拿钱了,不过我也犯了个错误,好久没用这张卡,记错了密码,又很自信的输了密码(主要是招行的atm机只有在取款的时候才验证密码,前面不验证密码),结果发现卡被锁了,我承认这是我的过失,我发誓我不是故意的,我把不得赶快把钱给他,不想他再烦我了。结果同学说了一句,你是不是把那笔钱用了?我当时就火了,你如果不信任我就不要转钱到我这里,而且也就一万七千块钱,就是十万块钱我也不稀罕!于是我跟同学讲,既然你不相信,以后就不要转了,钱我明天去柜台转账给你,反正我也要去解锁。同学不干了,执意要晚上拿到钱,要求我回家找其他卡,取钱给我,我非常的不爽,也非常反感,于是直接将没有,只带了这一张卡,只能明天中午转账!中间同学还讲了很多需要这笔钱的理由。最后没办法,同学只能回去,临走的时候说不要为了这么万把块钱上了兄弟感情之类的话。真实搞笑啊。
同学回去的路上还发短信提醒明天不要忘记了。当时自己以为招行ATM机的问题,导致提示密码错误,于是赶紧回来电话修改密码,原来3次错误以后会自动锁定的,要柜台解锁,那就放心了,还以为被“钓鱼”了呢。当时我已经非常非常气愤加反感了,直接回复“明天一定打给你,以后也不要再通过我转钱了!”
我真是搞不懂,既然不信任我就不要找我帮你!!我又不是欠你钱,是你自愿的,不至于跟催命一样每天催债吧,我还没欠你钱!即使催债的也没这么紧吧。还说都拖了很久了所以才不放心的,我也就是因为这个星期事情多,没去打款,本来就打算周一去转账了。即使我欠你钱,拖了一两个星期也不用急成这样吧。真实可笑。我还真没看上那万把块钱,况且我又不会要这种钱。还说什么非常急用什么的,既然想通过这种方式赚公司的钱,就是做好准备的。我又不是帮你打工的,不是你呼来唤去的人,没有义务帮你去转钱,只是帮你个忙,却赶不上个欠债的,真可笑。主动权在我这,不是在你那里的,我什么时候有空什么时候去帮你转账的,不会因为要给你转钱就旷班的,还要我去帮个网银帮你转账,其实网银我是开通的,但是我不喜欢用网银进行大额交易的,最近陷入一个误区,越是对计算机了解的多了,越是不信任计算机的安全性,所以宁愿多跑电路。这点钱还不如我多做几个网站呢。只是晚转了几天就急成这样了,不过这样也好,刚好以后也不用在去转账了,建行离我们也不近大约2公里吧,还要骑自行车过去,领号排队,免费劳动力,浪费时间又不被信任,干嘛还要去做。
太太不爽了,真不爽,气死我了,今天上午溜出去解除密码锁定加转账,还是领导电话找,郁闷。不过终于转给他了,一身轻,以后也不会再来烦我了,这样也挺好的,免得经常跑建行,也挺累的。这张卡始终保持1000元左右,出去玩的时候带着也很好。
春节回来以后,也就是上上周四或者周五,13或者12号吧,具体记不清了,再次打了一次款,那天我好像在电信机房被放了一天鸽子,火死了,可恶的电信,正在策划新的合作idc,跑题了。。。。反正很忙,于是想反正也没多少钱,迟一点也没关系。于是就到了周末。周末在加班的时候,同学发短信来说,让我今天转给他。我很无语,周末这边的建行根本不营业,如果营业的话我也不至于非要工作日的时候去银行,那样就方便多了。于是我就会周末不营业,工作日吧。他说,银行营业的,可以办私人业务的,你打车去吧。非常无语,不说我在加班,就是不在加班,难道我就要周末专门跑到总行那里去汇款?而且我在加班。。。。。。本来想周一-周五中午利用休息时间去打款,不料这一周忙的不可开交,由于更换了两台服务器,里面有N多需要重新配置的东西,还要上传近300G的文件,然后重新配置。而且发现KVM做的虚拟机性能很差,下载上传速度只有几百K,而且会卡住!!!早知道就不升级了,老版本还有几M的读写速度。反正就是很郁闷,再加上电信还是没把ip地址的问题搞定,于是又去了两次电信机房,重装了系统,,回来以后就开始重新配置xen的虚拟机,经过两天两夜的研究终于搞定了hypervm跟新建的网桥的关系,于是就到周五了。这一个星期,这位老同学,经常短信或者电话催我把钱打给他,几乎每天都会催一下,我已经逐渐开始反感了。我好几天中午连吃饭的时间都没有,都是快一点了到外面随便买得吃的又回来工作,哪里有时间去给汇钱!即使这样,我们的好几个服务也因此停止服务了一周,周五下午才全部部署好,两个网站恢复正常,其他的虚拟机也开始正常工作,文件基本上传完毕。周六中午在休息的时候又打了好久个电话过来,发了N条短信说周日要过来了,要来上海开会,同时来拿现金,由于周六在外面购物,没听见手机铃声,看到7-8个未接来电,4条短信,主要是想讲一下要过来拿现金的,我已经很反感了,如果你不信任的话就不要找我帮你转钱,我又不是闲着没事情做,而且又不要你的任何好处!
周末晚上7点同学终于打车过来拿钱了,不过我也犯了个错误,好久没用这张卡,记错了密码,又很自信的输了密码(主要是招行的atm机只有在取款的时候才验证密码,前面不验证密码),结果发现卡被锁了,我承认这是我的过失,我发誓我不是故意的,我把不得赶快把钱给他,不想他再烦我了。结果同学说了一句,你是不是把那笔钱用了?我当时就火了,你如果不信任我就不要转钱到我这里,而且也就一万七千块钱,就是十万块钱我也不稀罕!于是我跟同学讲,既然你不相信,以后就不要转了,钱我明天去柜台转账给你,反正我也要去解锁。同学不干了,执意要晚上拿到钱,要求我回家找其他卡,取钱给我,我非常的不爽,也非常反感,于是直接将没有,只带了这一张卡,只能明天中午转账!中间同学还讲了很多需要这笔钱的理由。最后没办法,同学只能回去,临走的时候说不要为了这么万把块钱上了兄弟感情之类的话。真实搞笑啊。
同学回去的路上还发短信提醒明天不要忘记了。当时自己以为招行ATM机的问题,导致提示密码错误,于是赶紧回来电话修改密码,原来3次错误以后会自动锁定的,要柜台解锁,那就放心了,还以为被“钓鱼”了呢。当时我已经非常非常气愤加反感了,直接回复“明天一定打给你,以后也不要再通过我转钱了!”
我真是搞不懂,既然不信任我就不要找我帮你!!我又不是欠你钱,是你自愿的,不至于跟催命一样每天催债吧,我还没欠你钱!即使催债的也没这么紧吧。还说都拖了很久了所以才不放心的,我也就是因为这个星期事情多,没去打款,本来就打算周一去转账了。即使我欠你钱,拖了一两个星期也不用急成这样吧。真实可笑。我还真没看上那万把块钱,况且我又不会要这种钱。还说什么非常急用什么的,既然想通过这种方式赚公司的钱,就是做好准备的。我又不是帮你打工的,不是你呼来唤去的人,没有义务帮你去转钱,只是帮你个忙,却赶不上个欠债的,真可笑。主动权在我这,不是在你那里的,我什么时候有空什么时候去帮你转账的,不会因为要给你转钱就旷班的,还要我去帮个网银帮你转账,其实网银我是开通的,但是我不喜欢用网银进行大额交易的,最近陷入一个误区,越是对计算机了解的多了,越是不信任计算机的安全性,所以宁愿多跑电路。这点钱还不如我多做几个网站呢。只是晚转了几天就急成这样了,不过这样也好,刚好以后也不用在去转账了,建行离我们也不近大约2公里吧,还要骑自行车过去,领号排队,免费劳动力,浪费时间又不被信任,干嘛还要去做。
太太不爽了,真不爽,气死我了,今天上午溜出去解除密码锁定加转账,还是领导电话找,郁闷。不过终于转给他了,一身轻,以后也不会再来烦我了,这样也挺好的,免得经常跑建行,也挺累的。这张卡始终保持1000元左右,出去玩的时候带着也很好。
debian中科大源
[
2010/03/08 10:03 | by suibing ]
2010/03/08 10:03 | by suibing ]
deb http://debian.ustc.edu.cn/debian stable main non-free contrib
deb-src http://debian.ustc.edu.cn/debian stable main non-free contrib
deb http://debian.ustc.edu.cn/debian proposed-updates main contrib non-free
deb-src http://debian.ustc.edu.cn/debian proposed-updates main contrib non-free
deb http://debian.ustc.edu.cn/debian-security stable/updates main
deb-src http://debian.ustc.edu.cn/debian stable main non-free contrib
deb http://debian.ustc.edu.cn/debian proposed-updates main contrib non-free
deb-src http://debian.ustc.edu.cn/debian proposed-updates main contrib non-free
deb http://debian.ustc.edu.cn/debian-security stable/updates main




