# yum -y install openvpn openssl openssl-devel
# cp -R /usr/share/doc/openvpn-2.2.2/easy-rsa/ /etc/openvpn/
# chmod u+x /etc/openvpn/easy-rsa/2.0/*
export KEY_PROVINCE="HaiNan"
export KEY_CITY="WenChang"
export KEY_ORG="Groad"
export KEY_EMAIL="vpnmaster@groad.net"
#export KEY_EMAIL=mail@host.domain
export KEY_CN=ca.qunet.info
export KEY_NAME=ca.qunet.info
export KEY_OU=Dev
export PKCS11_MODULE_PATH=changeme
export PKCS11_PIN=1234
# source ./vars
-bash: /etc/openvpn/easy-rsa/2.0/whichopensslcnf: Permission denied
NOTE: If you run ./clean-all, I will be doing a rm -rf on /etc/openvpn/easy-rsa/2.0/keys
# ./clean-all
# ./build-ca
Generating a 1024 bit RSA private key
.....++++++
..................++++++
writing new private key to 'ca.key'
-----
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) [CN]:
State or Province Name (full name) [HaiNan]:
Locality Name (eg, city) [WenChang]:
Organization Name (eg, company) [Groad]:
Organizational Unit Name (eg, section) [Dev]:
Common Name (eg, your name or your server's hostname) [ca.qunet.info]:
Name [ca.qunet.info]:
Email Address [vpnmaster@groad.net]:
# ./build-key-server server
Generating a 1024 bit RSA private key
....++++++
.......................++++++
writing new private key to 'server.key'
-----
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) [CN]:
State or Province Name (full name) [HaiNan]:
Locality Name (eg, city) [WenChang]:
Organization Name (eg, company) [Groad]:
Organizational Unit Name (eg, section) [Dev]:
Common Name (eg, your name or your server's hostname) [server]:ca.qunet.info
Name [ca.qunet.info]:
Email Address [vpnmaster@groad.net]:
Please enter the following 'extra' attributes
to be sent with your certificate request
A challenge password []:
An optional company name []:
Using configuration from /etc/openvpn/easy-rsa/2.0/openssl-0.9.8.cnf
Check that the request matches the signature
Signature ok
The Subject's Distinguished Name is as follows
countryName :PRINTABLE:'CN'
stateOrProvinceName :PRINTABLE:'HaiNan'
localityName :PRINTABLE:'WenChang'
organizationName :PRINTABLE:'Groad'
organizationalUnitName:PRINTABLE:'Dev'
commonName :PRINTABLE:'ca.qunet.info'
name :PRINTABLE:'ca.qunet.info'
emailAddress :IA5STRING:'vpnmaster@groad.net'
Certificate is to be certified until May 1 05:39:04 2022 GMT (3650 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
# ./build-key WIN-AFDEJ8TS1B0
Generating a 1024 bit RSA private key
....................++++++
.............++++++
writing new private key to 'WIN-AFDEJ8TS1B0.key'
-----
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) [CN]:
State or Province Name (full name) [HaiNan]:
Locality Name (eg, city) [WenChang]:
Organization Name (eg, company) [Groad]:
Organizational Unit Name (eg, section) [Dev]:
Common Name (eg, your name or your server's hostname) [WIN-AFDEJ8TS1B0]:
Name [ca.qunet.info]:WIN-AFDEJ8TS1B0
Email Address [vpnmaster@groad.net]:
Please enter the following 'extra' attributes
to be sent with your certificate request
A challenge password []:
An optional company name []:
Using configuration from /etc/openvpn/easy-rsa/2.0/openssl-0.9.8.cnf
Check that the request matches the signature
Signature ok
The Subject's Distinguished Name is as follows
countryName :PRINTABLE:'CN'
stateOrProvinceName :PRINTABLE:'HaiNan'
localityName :PRINTABLE:'WenChang'
organizationName :PRINTABLE:'Groad'
organizationalUnitName:PRINTABLE:'Dev'
commonName :PRINTABLE:'WIN-AFDEJ8TS1B0'
name :PRINTABLE:'WIN-AFDEJ8TS1B0'
emailAddress :IA5STRING:'vpnmaster@groad.net'
Certificate is to be certified until May 1 05:47:25 2022 GMT (3650 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
# ./build-dh
Generating DH parameters, 1024 bit long safe prime, generator 2
This is going to take a long time
..+....+........................
..............++*++*++*
# vim /etc/openvpn/server.conf
local 173.242.117.244
port 1194
proto tcp
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
dh /etc/openvpn/easy-rsa/2.0/keys/dh1024.pem
server 192.168.10.0 255.255.255.0
ifconfig-pool-persist ipp.txt
push "redirect-gateway"
push "dhcp-option DNS 8.8.8.8"
client-to-client
keepalive 10 120
comp-lzo
persist-key
persist-tun
tls-auth /etc/openvpn/easy-rsa/2.0/keys/ta.key 0
status openvpn-status.log
log openvpn.log
verb 4
# iptables -A INPUT -p tcp --dport 1194 -j ACCEPT
# iptables -t nat -A POSTROUTING -s 192.168.10.0/24 -o eth0 -j MASQUERADE
# /etc/init.d/iptables save
# echo "/usr/sbin/openvpn --config /etc/openvpn/server.conf &" >> /etc/rc.local
remote ca.qunet.info 1194
resolv-retry infinite
nobind
persist-key
persist-tun
ca ca.crt
cert WIN-AFDEJ8TS1B0.crt
key WIN-AFDEJ8TS1B0.key
ns-cert-type server
tls-auth ta.key 1
comp-lzo
route-delay 2
route-method exe
verb 4
欢迎光临 曲径通幽论坛 (http://www.groad.net/bbs/) | Powered by Discuz! X3.2 |