Posted: . At: 9:32 AM. This was 3 years ago. Post ID: 15462
Page permalink. WordPress uses cookies, or tiny pieces of information stored on your computer, to verify who you are. There are cookies for logged in users and for commenters.
These cookies expire two weeks after they are set.


Sample OpenVPN files to help setup a very useful OpenVPN server.


Sample OpenVPN configuration files to help with OpenVPN setup

Below is a sample OpenVPN configuration file, this is running a server with an internal IP address of 10.8.0.0. This is using UDP and port 1194. If you set it up on port 443 instead, it can be hidden amongst other SSL traffic. That is a good tip for getting past a proxy in certain educational institutions for example.

upd1194.conf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
server 10.8.0.0 255.255.255.0
verb 3
duplicate-cn
key server-key.pem
ca ca.pem
cert server-cert.pem
dh dh.pem
keepalive 10 120
persist-key
persist-tun
comp-lzo
push "redirect-gateway def1 bypass-dhcp"
push "dhcp-option DNS 8.8.8.8"
push "dhcp-option DNS 8.8.4.4"
 
user nobody
group nogroup
 
proto udp
port 1194
dev tun1194
status openvpn-status-1194.log

This is the client configuration file. This defines the remote IP address of the OpenVPN server and also contains the client keys to allow access to the remote server and the resources therein. The client connection is using TCP protocol.

client.ovpn
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
client
nobind
dev tun
redirect-gateway def1 bypass-dhcp
remote 54.66.223.254 443 tcp
comp-lzo yes
 
<key>
-----BEGIN RSA PRIVATE KEY-----
MIIEowIBAAKCAQEAsSq4DqHc4+z2Tpz1hsx9MizIUmtTukIY0PCOxSIaME3uXO/F
UX0oeKv1a7ko08UFk3jQq+x9d9iLKQXj69UcHG84Bw7RiYOnJ7NVVR3c2Zm+bbqK
Tx0dP8LT8Hbpm3fm+XCHxKLCVZYcNF4QvSuOdd9kbm3c2wRPtKhC+rEqU51Ue8HN
p0PqE8Q75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XlSiQLmk3f3A72DDYrZucDlcQGsyABVI6QvOiHTwvmCFiq
+ok7dDOqnTFwFg5rswnTKeuebBH7F3ugjXNXOiXvb5YhmhuAttFc8wcM+6ylze5S
3fgeDe6t1tpzbQ==
-----END CERTIFICATE-----
</ca>

An OpenVPN setup on a server as the sole way to access resources is very secure, once the client has access to the server and can use a local IP address like 10.8.0.1, then they may use SSH to access the machine and make changes without worry.

This very useful script can automatically generate a perfect OpenVPN config, but this is cheating, or is it?

https://www.rosehosting.com/blog/openvpn-setup-script-for-debian-and-ubuntu/.

Set or change a passphrase for an OpenVPN server key.
https://securitronlinux.com/bejiitaswrath/set-or-change-a-passphrase-for-an-openvpn-server-key/.

Iptables config for mapping an OpenVPN IP address to a physical machine address.
https://securitronlinux.com/debian-testing/iptables-config-for-mapping-an-openvpn-ip-address-to-a-physical-machine-address/.

How to create keys with easy-rsa without a password prompt.
https://securitronlinux.com/bejiitaswrath/how-to-create-keys-with-easy-rsa-without-a-password-prompt/.

This is how to generate new keys for your OpenVPN configuration if they have expired. This can be annoying. But it is easily fixed with admin access to the OpenVPN server. You must be careful when creating keys and make sure that the expiry dates are set correctly. This is very important.


Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.