Previously, we explained how to create a site-to-site VPN tunnel with OpenVPN on pfSense by protecting it with a shared key.
However, in this tutorial, we will explain how to do it by securing OpenVPN with SSL certificates.
Note: as for the OpenVPN tunnel in our previous tutorial, we will use a virtual infrastructure (in our case) with 2 sites: site 1 (Brussels) with the network ID "10.0.1.0/24" and site 2 (Paris) with the network ID "10.0.2.0/24".
The OpenVPN server will be installed on site 1 (Brussels), as this is the company's headquarters and the OpenVPN client will be installed on site 2 (Paris). If you have other geographic sites in your case, you will just need to install an OpenVPN client on pfSense and configure what is needed (as you will see in this tutorial).
To get started, you need to create a certificate authority that will be used by OpenVPN to authenticate clients to your OpenVPN server.
The OpenVPN server will have a "server" type certificate and the clients will each have a different "user" type certificate.
These certificates will come from the internal certification authority that you will create on the pfSense machine at site 1 (Brussels) where you will later install the OpenVPN server.
To learn more about how a certificate authority works, refer to our article: WS 2016 - AD CS - What is a CA and install an enterprise CA.
To do this, on site 1 (Brussels), go to: System -> Cert. Manager.
Then, in the "CAs" tab of the "System / Certificate Manager / CAs" page that appears, click on: Add.
On the page that appears, in the "Create / Edit CA" section, configure these settings:
In the "Internal Certificate Authority" section, you will be able to configure security settings, as well as for information purposes for your certificate authority:
Warning : when the certificate of a certification authority expires, the certificates issued by it become invalid.
Consider this when specifying the Lifetime of this certificate of authority.
Your internal CA certificate has been created.
Now that you have an internal certificate authority, you can generate certificates that will emanate from it.
To do this, in the "Certificates" tab, click on: Add.
Note: the "webConfigurator default" SSL certificate that you see in the list simply concerns the web interface that you are currently using and which is accessible via HTTPS.
On the page that appears, in the "Add/Sign a New Certificate" section, configure these settings:
In the "Internal Certificate" section, configure these settings:
Finally, in the "Certificate Attributes" section, select "Server Certificate" and simply click Save.
Important : you must always select "Server Certificate" when generating a certificate that will be used by an OpenVPN server.
The certificate for your OpenVPN server has been created.
In the "Certificates" tab, click "Add" again.
Important : you must create as many certificates as sites that will be configured with an OpenVPN client.
Indeed, when OpenVPN operates in SSL/TLS mode, it uses client certificates to identify OpenVPN clients.
Additionally, you can assign specific configurations to an OpenVPN client by specifying the common name of the certificate you will create here.
Hence the importance of generating a certificate per site per OpenVPN client.
In our case, we have 2 sites. So, site 2 (Paris) will use an OpenVPN client.
In the "Add/Sign a New Certificate" section of the page that appears, indicate this:
In the "Internal Certificate" section, specify the same parameters as for the previous certificate, except for the Common Name of the certificate.
Select "User Certificate" for the certificate type and click: Save.
Important : you must always select "User Certificate" when it is to be used by an OpenVPN client.
The certificate for your OpenVPN client has been created.
When you want to configure an OpenVPN client on a remote site (in our case: that of Paris), you will need the user certificate corresponding to this OpenVPN client.
However, given that this comes from your internal certification authority created on site 1 (Brussels), you will also need the certificate from your CA so that the chain of trust is complete.
To get started, go to "System -> Certificate Manager", then to the "CAs" tab.
Then, click on the star icon (framed in red) in the image below to export only its certificate (which notably contains its public key).
Warning : to verify the signature and validity of a certificate, pfSense only needs the certificate from your certification authority.
In fact, the verification of a certificate is carried out using the public key present in the certificate of your certification authority.
The private key must remain on the server where you created your certificate authority and your clients must never know it. Otherwise, they could create valid certificates from your certificate authority (CA).
Next, go to the "Certificates" tab and export the certificate (using the star icon), as well as the private key (using the key icon) of each User Certificate.
Important : the certificate and private key for the OpenVPN server must remain on that server and therefore should NOT be exported.
In our case, we therefore have 3 files:
Firewall 5/21/2025
Firewall 8/13/2025
Firewall 8/6/2025
Firewall 6/4/2025
Pinned content
Contact
® InformatiWeb-Pro.net - InformatiWeb.net 2008-2022 - © Lionel Eppe - All rights reserved.
Total or partial reproduction of this site is prohibited and constitutes an infringement punishable by articles L.335-2 and following of the intellectual property Code.
You must be logged in to post a comment