[2024-feb-29] Sad news: Eric Layton aka Nocturnal Slacker aka vtel57 passed away on Feb 26th, shortly after hospitalization. He was one of our Wiki's most prominent admins. He will be missed.
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
howtos:network_services:openvpn [2013/12/31 11:38 (UTC)] – chrisabela | howtos:network_services:openvpn [2018/03/02 00:28 (UTC)] – Move passphrase removal to the passphrase section bifferos | ||
---|---|---|---|
Line 54: | Line 54: | ||
==== 4.3 Administrator Rights ==== | ==== 4.3 Administrator Rights ==== | ||
- | You will need to have administrator rights to set up the Openvpn. This applies to both the Server and the Client. For simplicity, in this tutorial, it will be assumed that all actions will be performed by the root user. Naturally advanced users might be more discerning. | + | You will need to have administrator rights to set up OpenVPN. This applies to both the Server and the Client. For simplicity, in this tutorial, it will be assumed that all actions will be performed by the root user. Naturally advanced users might be more discerning. |
==== 4.4 Possible Constraints and Possible Solutions for a WiFi equipped Client ==== | ==== 4.4 Possible Constraints and Possible Solutions for a WiFi equipped Client ==== | ||
Line 70: | Line 70: | ||
< | < | ||
# cd | # cd | ||
- | # git clone git:// | + | # git clone http:// |
</ | </ | ||
Line 144: | Line 144: | ||
=== 5.2.1 Sign the Client' | === 5.2.1 Sign the Client' | ||
- | For the purpose of this article, it is assumed that the Client' | + | For the purpose of this article, it is assumed that the Client' |
< | < | ||
Line 170: | Line 170: | ||
</ | </ | ||
- | Copy the sample server.conf from the openvpn | + | Copy the sample server.conf from the OpenVPN |
< | < | ||
Line 180: | Line 180: | ||
</ | </ | ||
- | Copy the file server.conf contained in the source to the openvpn | + | Copy the file server.conf contained in the source to the OpenVPN |
< | < | ||
- | # cp openvpn-2.3.2/ | + | # cp openvpn-*/ |
> / | > / | ||
</ | </ | ||
Line 230: | Line 230: | ||
daemon | daemon | ||
</ | </ | ||
+ | |||
+ | < | ||
My full server.conf is the following: | My full server.conf is the following: | ||
Line 548: | Line 550: | ||
# / | # / | ||
# | # | ||
- | # Start/ | + | # Start/ |
# | # | ||
Line 589: | Line 591: | ||
</ | </ | ||
- | Eventually when you start openvpn | + | Eventually when you start OpenVPN |
< | < | ||
Line 597: | Line 599: | ||
===== 7. Port Forwarding ===== | ===== 7. Port Forwarding ===== | ||
- | YYou will need to forward traffic from the port you have chosen for Openvpn | + | You will need to forward traffic from the port you have chosen for OpenVPN |
In case if you have misplaced such documentation, | In case if you have misplaced such documentation, | ||
Line 605: | Line 607: | ||
On the Client machine perform the following instructions to set it up. | On the Client machine perform the following instructions to set it up. | ||
- | Download the openvpn | + | Download the OpenVPN |
< | < | ||
Line 644: | Line 646: | ||
< | < | ||
- | You will need the this files that were generated by the Client' | + | You will need this file that were generated by the Client' |
< | < | ||
Line 818: | Line 820: | ||
</ | </ | ||
- | Enter the Client PEM pass phrase when prompted. To stop openVPN | + | Enter the Client PEM pass phrase when prompted. To stop OpenVPN |
On both you should see a new network interface called tun0. On the Server, I obtained the following: | On both you should see a new network interface called tun0. On the Server, I obtained the following: | ||
Line 864: | Line 866: | ||
===== 10. Storing the PEM pass phrase in a secure file and Automatic start of service after booting ===== | ===== 10. Storing the PEM pass phrase in a secure file and Automatic start of service after booting ===== | ||
- | To start the Openvpn | + | To start the OpenVPN |
< | < | ||
Line 879: | Line 881: | ||
This may be repeated also on the Client, just edit / | This may be repeated also on the Client, just edit / | ||
- | To start the Openvpn | + | To start the OpenVPN |
< | < | ||
Line 887: | Line 889: | ||
fi | fi | ||
</ | </ | ||
+ | |||
+ | An alternate method (albeit less secure) is to remove the passphrase from server1.key file altogether. | ||
+ | |||
+ | < | ||
+ | # cd / | ||
+ | # openssl rsa -in server1.key -out tmp.key | ||
+ | # mv tmp.key server1.key | ||
+ | # chmod 600 server1.key | ||
+ | </ | ||
+ | |||
===== 11. IP Routing ===== | ===== 11. IP Routing ===== | ||
Line 922: | Line 934: | ||
push "route 192.168.200.0 255.255.255.0" | push "route 192.168.200.0 255.255.255.0" | ||
- | client-config-dir ccd | + | client-config-dir |
route 192.168.1.0 255.255.255.0 | route 192.168.1.0 255.255.255.0 | ||
Line 932: | Line 944: | ||
Naturally replace 192.168.200.0 255.255.255.0 with the Server' | Naturally replace 192.168.200.0 255.255.255.0 with the Server' | ||
+ | 208.67.222.222 and 208.67.220.220 are the OpenDNS IP addresses. | ||
- | 208.67.222.222 and 208.67.220.220 are the OpenDNS IP addresses. | + | <note warning>Up to now the DNS push configuration has not been successful.</ |
+ | |||
+ | You can either use the original Client DNS servers or else you may rewrite | ||
+ | |||
+ | < | ||
+ | # OpenDNS Servers | ||
+ | nameserver 208.67.222.222 | ||
+ | nameserver 208.67.220.220 | ||
+ | </ | ||
+ | |||
+ | According to your routing table however, | ||
+ | |||
+ | Some users have reported that their Client' | ||
Next you will have to configure some iptables NAT forwarding on the Server (only). You can do this by first flushing the iptables: | Next you will have to configure some iptables NAT forwarding on the Server (only). You can do this by first flushing the iptables: | ||
Line 989: | Line 1014: | ||
$IPT -A INPUT -j SERVICES # append the services chain to the input | $IPT -A INPUT -j SERVICES # append the services chain to the input | ||
- | # allowed forwarding for openVPN | + | # allowed forwarding for OpenVPN |
$IPT -A FORWARD -i eth0 -o tun0 -m state --state ESTABLISHED, | $IPT -A FORWARD -i eth0 -o tun0 -m state --state ESTABLISHED, | ||
$IPT -A FORWARD -s 10.8.0.0/24 -o eth0 -j ACCEPT | $IPT -A FORWARD -s 10.8.0.0/24 -o eth0 -j ACCEPT | ||
- | # masquerade the openvpn | + | # masquerade the OpenVPN |
$IPT -t nat -A POSTROUTING -s 10.8.0.0/24 -o eth0 -j MASQUERADE | $IPT -t nat -A POSTROUTING -s 10.8.0.0/24 -o eth0 -j MASQUERADE | ||
Line 999: | Line 1024: | ||
#$IPT -A SERVICES -p tcp --dport 22 -j ACCEPT # Uncomment to allow sshd | #$IPT -A SERVICES -p tcp --dport 22 -j ACCEPT # Uncomment to allow sshd | ||
- | # allow openvpn | + | # allow OpenVPN |
- | $IPT -A SERVICES -p tcp --dport | + | $IPT -A SERVICES -p udp --dport |
| | ||
echo " | echo " | ||
Line 1056: | Line 1081: | ||
</ | </ | ||
- | Restart the Openvpn | + | Restart the OpenVPN |
< | < | ||
Line 1070: | Line 1095: | ||
===== 12. Firewalls ===== | ===== 12. Firewalls ===== | ||
- | In the previous chapter we referred to a firewall you may include to protect your Openvpn | + | In the previous chapter we referred to a firewall you may include to protect your OpenVPN |
In order to penetrate through the Client firewall your may want to try changing the port to 443 - normally reserved for https. Using TCP instead of UDP will also help. To make these change you will need to amend / | In order to penetrate through the Client firewall your may want to try changing the port to 443 - normally reserved for https. Using TCP instead of UDP will also help. To make these change you will need to amend / | ||
Line 1127: | Line 1152: | ||
(4) http:// | (4) http:// | ||
+ | |||
+ | (5) http:// | ||
* Originally written by [[wiki: | * Originally written by [[wiki: |