OpenVPN on Fedora 9
OpenVPN maybe free and open source, but it sure challenges the enterprise stuff out there. It is a full featured SSL VPN which can be used to create a VPN over a redily available public network. It has Linux and Windows clients, which means you are not limited to Linux alone when using OpenVPN. Ok lets dive in to installation and setup:
1. Install openvpn.
# yum install openvpn
2. Copy the necessary configuration files to generate RSA keys and Initialize PKI.
# cp -R /usr/share/openvpn/easy-rsa/ /etc/openvpn/
# cd /etc/openvpn/easy-rsa/2.0/
3. Make the /etc/openvpn/keys direcotory and edit the /etc/openvpn/easy-rsa/2.0/vars file:
# mkdir /etc/openvpn/keys
# vi vars
now set the parameters for KEY_COUNTRY, KEY_PROVINCE, KEY_CITY, KEY_ORG and KEY_MAIL. Here is a sample:
export KEY_COUNTRY="MV"
export KEY_PROVINCE="Kaafu"
export KEY_CITY="Male"
export KEY_ORG="Fourthirty Inc."
export KEY_EMAIL="typos@fourthirty.rog"
also set the KEY_DIR parameter line to read as:
export KEY_DIR="/etc/openvpn/keys"
4. Initialize PKI.
# . ./vars
the above line is very tricky (dot space dot/vars)
# ./clean-all
# ./build-ca
5. Build the server key.
# ./build-key-server server
6. Generate certificates and keys for clients. You can do this for as many clients you want to joing your VPN. I am demonstrating the setup of only one client.
# ./build-key client1
7. Generate Diffie Hellman parameters/
# ./build-dh
8. Copy server.conf file from the /usr/share/doc/openvpn-2.1/sample-config-files/ to /etc/openvpn/ and make the following changes:
# cp /usr/share/doc/openvpn-2.1/sample-config-files/server.conf /etc/openvpn/
ca keys/ca.crt
cert keys/server.crt
key keys/server.key
dh keys/dh1024.pem
server 172.16.0.0 255.255.255.0
9. That’s it ! You have successfully set up the OpenVPN server. Now start the service and set it to start automatically on start.
# service openvpn startn
# chkconfig openvpn o
10. Setup the client in Linux. Copy the client.conf to /etc/openvpn
# cp /usr/share/doc/openvpn-2.1/sample-config-files/client.conf /etc/openvpn/
from the server system copy ca.crt, client1.crt and client1.key over to the client machine. Use a secure method to do this. The files are located in /etc/openvpn/keys/
edit the client.conf to include:
remote <ip of server> 1194
ca keys/ca.crt
cert keys/client.crt
key keys/client.key
ns-cert-type server
start the client service now.
# service openvpn start
ping to 172.16.0.1 from client machine. If it succeeds…congrats you have a working VPN !
11. To setup the client in windows, get the binary and install it. Use the same confiurations in the client.ovpn and run it.