OpenVPN secret keys

To secure the OpenVPN connection, a secret key is needed. First, we will generate such a key. Then, it needs to be copied to the remote endpoint using a secure channel (example SCP:

$ openvpn --genkey --secret secret.key

Note that it is not necessary to run this command as root (hence the prompt $). The resulting secret key file has the following format:

#
# 2048 bit OpenVPN static key
#
-----BEGIN OpenVPN Static key V1-----
1393ae687606c1f7d465d70227bf63e8
8963e9d1401450002d073d6eab1bffde
b06d1a33cc5c45d4a667016339e921d3
3ac36b1a949eb52e9217e41e4b035a7b
987ddfa9d6766d3b5e4c952dc27f518d
12ccff6b2f0966284382ddc0f62b824a
f576f0982beec9d6a4728d0788499a75
0fd7055ef681404fd463d9862d3a40a9
31fca7d87997c70c07b8303a1b85f1ff
76aa7790e7c341353d2b4ea5049b11a2 ...

Get Mastering OpenVPN now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.