5.10.5. OpenVPN Certificates Configuration

In the 2SRA use case, the use of OpenVPN as a VPN service requires the use of certificates.

../../_images/openvpn-certs_ss.png


This section shows how to configure CA for OpenVPN.

5.10.5.1. CA Configuration

A) Generate CA

It is necessary to have a certificate to associate to the Ipsec tunnel that we are going to create, so if you already have a PKI infrastructure you can use your own CA and the server certificates created with it. Go to the following section of this documentation to add your CA.

If you do not have your own CA or prefer to use a new one, follow these steps:

  1. Access CMI via SSH.

  2. Download easy_rsa to /opt and unzip it:

cd /opt
wget -c https://github.com/OpenVPN/easy-rsa/releases/download/v3.0.6/EasyRSA-unix-v3.0.6.tgz
tar xvzf EasyRSA-unix-v3.0.6.tgz
  1. Edit and configure the variables file with the data of your organization:

    1. Inside the directory /opt/EasyRSA-v3.0.6/, copy the “vars.example” file with name “vars” and modify its permissions

    cd EasyRSA-v3.0.6/
    cp vars.example vars && chmod +x vars
    vim vars
    
    1. Edit the newly created file “vars”.

    Modify the following parameters according to your organization:

    ../../_images/2SRA_CA-1.png


Then you have to modify the expiration time of the CA and the certificates. You will need to uncomment the following lines and adapt the time according to your needs:

../../_images/2SRA_CA-2.png


Having modified the default data, create your CA by following these steps:

  1. Initialize the PKI environment:

./easyrsa init-pki
../../_images/2sra26.png


  1. Create your CA: You will need to protect your CA with a strong password (write it down, as it will be needed in section “C) GENERATE A VPN SERVER CERTIFICATE USING THE CA”):

./easyrsa build-ca

It will ask you to enter a password and then a Common Name. In this example the Common Name is VPRW_EMMA:

../../_images/2SRA_CA-4.png


The CA will be available in /opt/EasyRSA-v3.0.6/pki/ca.crt on the server. Copy it locally for later use.

scp root@<IP>:/opt/EasyRSA-v3.0.6/pki/ca.crt <LocalDirectory>

If you want to check that the certificate was created with the parameters used, run the following command:

openssl x509 -in /opt/EasyRSA-v3.0.6/pki/ca.crt -text -noout

B) Register the CA in the CMDB

Once the CA has been created, it must be registered in the BackEnd so that it is available and can be used in the VPN Gateway.

  1. Connect to the management console and go to the “CMDB -> CMDB Certificate Authorities” menu and use the “Add new” button to add your CA:

../../_images/2sra27.png


Give the new CA a name and use the “Select” button to select the file with the CA. You can also copy the content of the CA directly into the certificate area.

../../_images/2sra28.png


  1. Click on accept and the CA will be loaded:

../../_images/2sra29.png


C) Generate a VPN server certificate using the CA

Once the CA is created we can use it to create new certificates.

  1. Generate a new CSR (new certificate request), return to the same directory where the CA was generated and execute the following request:

./easyrsa gen-req VPN_EMMA_RW_SRV nopass
../../_images/2sra30.png


  1. We will sign this request with our CA (for this we will need the password used in section “A) Generate a CA”):

./easyrsa sign-req server VPN_EMMA_RW_SRV
../../_images/2sra31.png


  1. It will generate two files:

    1. The certificate file: /opt/EasyRSA-v3.0.6/pki/issued/VPN_EMMA_RW_SRV.crt

    2. The private key: /opt/EasyRSA-v3.0.6/pki/private/VPN_EMMA_RW_SRV.key

Copy both files to upload them to the management console for section D) “Register the server certificate in the CMDB”.

D) Register the server certificate in the CMDB

Once the server certificate has been created, it must be registered in the BackEnd so that it is available and can be used in the VPN Gateway.

  1. Connect to the administration console and go to the “CMDB -> CMDB Server Certificates” menu and use the “Add new” button to add your Certificate:

../../_images/2sra32.png


Give the certificate a name and use the “Select” button to select the file with the certificate and then the private key. You can also copy the content directly into the certificate and private key area:

../../_images/2sra33.png


  1. Click on accept and the CA will already be loaded

../../_images/2sra34.png