I want to copy my OpenVPN configuration from a client configuration file to my pfSense firewall. pfSense requires me to provide certificate and key. This is how they look like in the .ovpn configuration file:
<cert>
-----BEGIN CERTIFICATE-----
MIIBxjCCAWugAwIBAgIQSi...
...8TCu2B1Y=
-----END CERTIFICATE-----
</cert>
<key>
-----BEGIN ENCRYPTED PRIVATE KEY-----
MIHjME4GCSqGSIb3DQEFD...
...atxri8=
-----END ENCRYPTED PRIVATE KEY-----
</key>
pfSense does not understand the encrypted private key, so I assume I somehow need to decrypt it. Obviously OpenVPN uses a tool /etc/openvpn/easy-rsa/easyrsa
to encrypt the private key. I tried decrypting it with OpenSSL (as described in this question and several other places) which does not work:
# openssl rsa -in secure.key -out plain.key
Enter pass phrase for secure.pem:
3069640768:error:0607907F:digital envelope routines:EVP_PKEY_get0_RSA:expecting an rsa key:../crypto/evp/p_lib.c:474:
Any ideas how to get a plain PEM key from that Encrypted Private Key?
(And no, I cannot import the .ovpn directly to pfSense as it is not pfSense plus)
openssl pkey -in secure.key -out plain.key
. Maybe add-text
to get a decode in addition to the decrypted PEM. Or doopenssl x509 -text
on the cert to see what kind of key it contains; the private key should match that. .