Difference between revisions of "OpenVPN Checklist Guide"

From ArchWiki
Jump to: navigation, search
m (Setting up the Clients)
Line 60: Line 60:
 
==Setting up the Clients==
 
==Setting up the Clients==
 
* Create a .conf file for each client like this:
 
* Create a .conf file for each client like this:
{{bc|
+
{{hc|a-client-conf-file.conf|
 
client
 
client
 
remote <server> <port>
 
remote <server> <port>

Revision as of 16:35, 7 November 2012


This article summarizes the install process required for OpenVPN. See OpenVPN instead for a walkthrough.

Install

Install the package openvpn from the official repositories.

Prepare data

  • Copy /usr/share/openvpn/easy-rsa to /etc/openvpn/easy-rsa and cd there
  • Edit vars with the information you want, then source it. See here for details.
 . ./vars
  • Clean up any previous keys:
 ./clean-all

Generate the certificates

  • Create the "certificate authority" key
 ./build-ca
  • Create certificate and private key for the server
 ./build-key-server <server-name>
  • Create the Diffie-Hellman pem file for the server. Don't enter a challenge password or company name when you set these up.
 ./build-dh
  • Create a certificate for each client.
./build-key <client-name>

All certificates are stored in keys directory. If you mess up, you can start all over by doing a ./clean-all

Copy to each client the ca.crt, and their respective crt and key files.

Setting up the Server

  • Create /etc/openvpn/myvpnserver.conf with a content like this:
port <port>
proto tcp
dev tun0

ca /etc/openvpn/easy-rsa/keys/ca.crt
cert /etc/openvpn/easy-rsa/keys/<server-name>.crt
key /etc/openvpn/easy-rsa/keys/<server-name>.key
dh /etc/openvpn/easy-rsa/keys/<your pem file>

server <desired base ip> 255.255.255.0
ifconfig-pool-persist ipp.txt
keepalive 10 120
comp-lzo
user nobody
group nobody
persist-key
persist-tun
status /var/log/openvpn-status.log
verb 3

log-append /var/log/openvpn
status /tmp/vpn.status 10
  • Enable and start the openvpn daemon:
# systemctl enable openvpn@myvpnserver.service
# systemctl start openvpn@myvpnserver.service

Setting up the Clients

  • Create a .conf file for each client like this:
a-client-conf-file.conf
client
remote <server> <port>
dev tun0
proto tcp
resolv-retry infinite
nobind
persist-key
persist-tun
verb 2
ca ca.crt
cert <client crt file>
key <client key file>
comp-lzo
  • Start the connection with
openvpn a-client-conf-file.conf &

or save it to /etc/openvpn/ to enable and start the openvpn daemon:

# systemctl enable openvpn@a-client-conf-file.service
# systemctl start openvpn@a-client-conf-file.service