下载软件:
www.openvpn.net 和 http://www.oberhumer.com/opensource/lzo/download/
lzo-1.08-4.0.i386.rpm 或 lzo-2.01.tar.gz ./configure 、make 、make install 然后lzo-devel-1.08-fr2.i386.rpm
openvpn-
rpm位于:/usr/src/redhat/RPMS/i386/openvpn-
另:在ipcop安装为:tar zxvf ZERINA-
1、 复制sample配置文件到/etc/openvpn
2、 ovpnconfig配置:
1,on,jiang,jiangdaoyou,host,cert,,,,,,,,,,,,,,,,,,,,,,,,,,,
2,on,test01,test01,host,cert,,,,,,,,,,,,,,,,,,,,,,,,,,,
3、 server.conf内容
#OpenVPN Server conf
daemon openvpnserver
writepid /var/run/openvpn.pid
;local 192.168.2.229
dev tun
tun-mtu 1400
proto udp
port 1194
tls-server
ca /etc/openvpn/ca/cacert.pem
cert /etc/openvpn/certs/servercert.pem
key /etc/openvpn/certs/serverkey.pem
dh /etc/openvpn/ca/dh1024.pem
server 192.168.60.0 255.255.255.0
push "route 192.168.219.0 255.255.255.0"
push "route 192.168.34.0 255.255.255.0"
push "route 192.168.50.0 255.255.255.0"
client-config-dir /var/ipcop/ovpn/ccd
route 192.168.60.9 255.255.255.252
route 192.168.60.17 255.255.255.252
client-to-client
keepalive 10 120
status-version 1
status /var/log/server.log 30
cipher BF-CBC
comp-lzo
max-clients 100
tls-verify /etc/openvpn/verify
user nobody
group nobody
persist-key
persist-tun
4、 指定客户端IP
server.conf文件中增加:
#client-config-dir /var/ipcop/ovpn/ccd
#route 192.168.60.9 255.255.255.252
建立/var/ipcop/ovpn/ccd/jiangdaoyou文件,内容如下:
ifconfig-push 192.168.60.9 192.168.60.10
5、 文件说明:
ca目录下是ca证书 cert目录是证书库 crls为吊销列表 openssl目录中为openssl.cnf配置文件
5、启动服务
openvpn --daemon --config server.conf或/etc/init.d/openvpn start
1、申请证书: openssl req -config openssl.cnf -new -keyout jiang.key -out jiang.req
Generating a 1024 bit RSA private key
..................................................................++++++
..............++++++
writing new private key to 'jiang.key'
Enter PEM pass phrase:
Verifying - Enter PEM pass phrase:
-----
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [GB]:CN
State or Province Name (full name) []:
Locality Name (eg, city) []:DongGuan
Organization Name (eg, company) [My Company Ltd]:DH
Organizational Unit Name (eg, section) []:IMC
Common Name (eg, your name or your server's hostname) []:jiangdaoyou
Email Address []:jdaoyou@xxx.xxx
Please enter the following 'extra' attributes
to be sent with your certificate request
A challenge password []:
An optional company name []:
2、使用CA签名证书:openssl ca -config openssl.cnf -out jiang.pem -notext -infiles jiang.req
Using configuration from ../openssl/ovpn.cnf
DEBUG[load_index]: unique_subject = "yes"
Check that the request matches the signature
Signature ok
The Subject's Distinguished Name is as follows
countryName :PRINTABLE:'CN'
stateOrProvinceName :PRINTABLE:'
localityName :PRINTABLE:'DongGuan'
organizationName :PRINTABLE:'DH'
organizationalUnitName:PRINTABLE:'IMC'
commonName :PRINTABLE:'jiangdaoyou'
Certificate is to be certified until Jul 22 03:41:46 2021 GMT (999999 days)
Sign the certificate? [y/n]:y
1 out of 1 certificate requests certified, commit? [y/n]y
Write out database with 1 new entries
Data Base Updated
3、导出p12证书文件
openssl pkcs12 -export -in jiang.pem -inkey jiang.key -certfile ../ca/cacert.pem -out jiang.p12
Enter pass phrase for jiang.key:
Enter Export Password:
Verifying - Enter Export Password:
查看证书:openssl x509 -in jiang.pem -noout –subject
4、证书的导出
从p12格式中导出CA证书, 则输入下列命令:
openssl pkcs12 -nomacver -cacerts -nokeys -in pkcs12_file -out ca_certificate.pem
从p12格式中导出xxx.com.pem和xxx.com.key 则输入下列命令:
openssl pkcs12 -nomacver -clcerts -nokeys -in pkcs12_file -out xxx.certificate.pem
openssl pkcs12 -nomacver -nocerts -in pkcs12_file -out xxx.private_key.pem
如果不对密钥加密(也即不需要输入pem密码):openssl pkcs12 -nomacver -nocerts -nodes -in pkcs12_file -out xxx.private_key.pem
注:暂时决定不对证书密钥进行加密
GUI程序中"change password"可以改变私钥的加密密码,等同在产生key时去掉-nodes参数
修改client.ovpn文件,输入:cryptoapicert "SUBJ: abc" 即可使用windows中存储的证书 abc指common name
1. 无法获得IP:重新启动客户端电脑的dhcp client服务
2.