CA and VA Configuration
The following describes the steps included in EJBCA CA to VA configuration and administration tasks related to VA management.
Apache Certificate Generation for the VA
Generate the Apache Certificate for the RA by following the instructions for the CA and the RA Server below.
Step 1: On the CA
SSH into the CA server and navigate to the /opt/PrimeKey/support
directory.
Start by taking a backup of the system:
# /opt/PrimeKey/support/system_backup.sh
Generate TLS certificates for the VA server on the CA. Since an VA will most likely have two IP addresses (one internal and one external), those are indicated with the "-i"
flag. In this case the IP addresses the host has are:
- 40.121.65.197
- 10.4.0.4
# /opt/PrimeKey/support/create_ra_tls_certs.sh -i 40.121.65.197 -i 10.4.0.4
If you are using a load balancer you can include that VIP name in the command above by specifying a "-d". if the domain was ra.example.com the command would be:
# /opt/PrimeKey/support/create_ra_tls_certs.sh -i 40.121.65.197 -i 10.4.0.4 -d ra.example.com
The script will prompt to request to generate the certificates in the format that Apache will expect them on the VA.
Choose Y and press enter. It will output these files into the home directory of the user you provisioned the instance with. In this case the user is "azure-user" so the certificates will be in the /home/azure-user/pem directory for easy copying. If you would like to keep them with the hostname in the file for easy tracking, press N.
The three files output will be:
- managementca.ca-mgmt.pem
- server-mgmt.key
- server-mgmt.pem
Copy these files to the VA server and put them into place with the instructions in the next section.
Step 2: On the VA Server
SSH into the VA server and start by taking a backup of the system. Azure allows users to provision instances with their own username. For this example, we will use the user "azure-user".
# /opt/PrimeKey/support/system_backup.sh
Copy the three files that were copied to /home/azure-user/pem to the new VA. Copy the files from the user folder you provisioned the instance with to the /etc/httpd/ssl directory and restart Apache:
# cp /home/azure-user/pem/* /etc/httpd/ssl/
# service httpd restart
Convert the server to an VA using the install_ra.sh script. This script will import the ManagementCA certificate from the CA server so that the VA is managed by the same ManagementCA as the CA server.
# /opt/PrimeKey/support/install_ra.sh
The script will ask for the path to the ManagementCA PEM file from the CA server.
Use the managementca PEM that was copied to the /etc/httpd/ssl directory or copy a new one. Use absolute paths.
Access the VA Administration GUI with the same certificate used to access the CA server. Test this by going to the EJBCA Admin Web on the VA. Note that there is no Management CA configured, an external ManagementCA is used.
Import the CAs Public Certificate Chain into the VA
For the VA to be aware of the CA we need to import the CAs certificates into the VA. If you need assistance with setting up a CA structure, see the EJBCA Quick Start Guide.
Step 1: On the CA
On the CA, Click RA Web on the left side navigation and open the CAs RA web. Select CA Certificates and CRLs.
- Download the CA certificates from the CA, RA web in PEM format.
- Access the RA Servers administration UI and click Certification Authorities
- Click Import CA Certificate.
- Browse to the Root CA PEM file and select it.
- Enter the name of the CA in the CA Name field.
- Click Import CA Certificate.
- Repeat for any other CAs.
All imported CAs will show as an "External CA"
Step 2: On the VA
- Click Certification Authorities.
- Click Import CA certificate.
- Enter the name for the Root CA.
- Click Browse and browse to the CA cert downloaded in the last section.
- Click Import CA Certificate.
- Click Import CA Certificate
- Enter the name for the Issuing CA.
- Click Browse and browse to the CA cert downloaded in the last section.
- Click Import CA Certificate.
Configure TLS Connections Between the CA and VA
Step 1: Import Profiles on the CA
SSH into the CA server and import the profiles that are going to be used for generating the key binding and peer connection certificates.
# /opt/ejbca/bin/ejbca.sh ca importprofiles -d /opt/PrimeKey/ra_profiles/
Step 2: Create Crypto Token to store Peer Systems authentication key on CA
Create a Crypto Token for the key binding to use. Navigate to Crypto Tokens and select Create new.
- Enter a name: Peer Systems Token.
- Select Type: Soft.
- Enter and repeat Authentication Code.
- Enable Auto-activation.
- Click Save.
- Generate new key pair:
- Alias: peer_systems_auth_key.
- Key Spec: RSA 4096.
Step 3: Set up Authentication Key Binding for Mutual Authentication on CA
Create an internal key binding for authenticating the TLS connection to the VA. Start by selecting Internal Key Bindings on the CA.
- Click Create new on the AuthenticationKeyBinding tab.
- Enter a name: Peer System Key Binding to VA.
- Select Crypto Token: "Peer Systems Token".
- Key Pair Alias: peer_systems_auth_key.
- Signature Algorithm: SHA256WithRSA.
- Click Create.
Click Back to overview to go back to the AuthenticationKeyBinding tab and select CSR under the Action column and save the file (Peer System Key Binding to RA.pkcs10.pem).
Step 4: Generate Certificate for TLS Connection
Click RA Web on the left side navigation and open the CAs RA web. Select Make New Request.
- Select Certificate Type: "Peer Systems User EE Profile"
- CA: "ManagementCA".
- Click Browse and select the "Peer System Key Binding to RA.pkcs10.pem" file.
- Change CN, Common Name to "peersystems".
- Change the Username to be the "peersystems"
- Click Download PEM.
- Save the file (peersystems.pem).
Step 5: Import Peer Systems certificate into Authentication Key Binding on CA
- Choose System Functions > Internal Key Bindings.
- Click the AuthenticationKeyBinding tab.
- Under Import externally issued certificate:
- Target AuthenticationKeyBinding: Peer System Key Binding to RA.
- Click Browse.
- Select the
peersystems.pem
file. - Click Import.
- Under Action:
- Click Enable.
- The Peer Systems Authentication Key Binding should now be Active.
Setup Peer Systems
Follow the steps below to setup Peer Systems:
Step 1: On the CA
- Choose System Functions > Peer Systems.
- Under Outgoing Peer Connectors, click Add.
- For Create Peer Connector, specify the following:
- Name: Peer Connection to RA
- URL: This should be the internal FQDN of the RA. For this example: "https://10.4.0.4/ejbca/peer/v1"
EJBCA Cloud Uses Apache and no port designation is necessary. - In the Authentication Key Binding list menu, select Peer System Key Binding to RA
- Select Enabled.
- Change Maximum parallel requests to 50.
- Click Create.
- Click Ping. You should see the error Unable to connect to peer. Unauthorized
If the error Unable to connect to peer displays, this means you instances cannot communicate. Please check your VPN connection.
Also, make sure that the internal IP address is used and not an FQDN or external IP unless you have internal name resolution across vNets.
Step 2: On the VA
- Choose System Functions > Peer Systems.
- You should see a connection attempt from the CA under Incoming Connections.
- Click Create Role.
- Ensure that – Create new role – is selected, and click Select.
- Additional properties will show. Change the Role name to "External VA Role".
- Ensure that Role is intended for peer connections is selected.
- Select Access ManagementCA and any other CAs the VA needs to access.
- Select Publish Certificate.
- Select Compare certificate synchronization status.
- Click Create new role.
Step 3: On the CA
- Click Peer Systems.
- Click Manage on the Peer Connection to VA peer connection.
- Click Start.
- It will say "Running".
- Click Refresh.
- You should see certificates added or synchronized.
Create a Peer Publisher on the CA
To create a Peer Publisher on the CA, do the following:
- Select Publishers in the Administration GUI.
- Enter a name such as VA Peer Publisher.
- Click Add.
- Select the publisher and click Edit.
- From the PublisherType drop down select Validation Authority Peer Publisher.
- Ensure the correct Peer System is selected.
- Select Store CRL at the Validation Authority.
- Click Save and Test Connection.
- You should see Connection Tested Successfully at the top. Click Save.
Edit a Certificate Profile to use the Publisher
In order for generated certificates to be published to the VA, the profiles for the CA need to be configured to use the Peer Publisher.
- In the Admin GUI, select CA Functions > Certificate Profiles.
- Click Edit next to the profile from which you want to issue certificates (or create a new one).
- Under the section Other Data, select VA Peer Publisher next to Publishers.
- Click Save.
Create Crypto Token to Store OCSP Key Binding Key on VA
To create a Crypto Token for the key binding to use, do the following:
- On the VA, navigate to Crypto Tokens and select Create new.
- Enter a name: OcspKeyBindingToken.
- Type: SOFT.
- Enter and repeat Authentication Code.
- Enable Auto-activation.
- Click Save.
- Generate new key pair:
- Alias: OcspKeyBindingKey
- Key Spec: RSA 4096
Set up OCSP Key Binding for Mutual Authentication on the VA
To set up OCSP Key Binding for Mutual Authentication on the VA, do the following:
Step 1: On the VA
- Click on InternalKeyBindings on the VA and then select the OcspKeyBinding tab.
- Click Create new.
- Enter a name for the key binding, for example “OCSPKeyBinding_IssuingCA”.
- Select the OCSPKeyBindingToken.
- Ensure the correct key par alias is chosen
- Click Create.
- Click Back to Overview.
- Click CSR under the actions column.
- Save the
OCSPKeyBinding_IssuingCA.pkcs10.pem
file.
Step 2: On the CA
- In the Admin GUI, select RA Web.
- Click Make New Request.
- Select the OCSP Signer EE Profile.
- Select the Issuing CA. This is the CA certificate that is going to stamp the OCSP responses.
- Browse to the OCSPKeyBinding_IssuingCA.pkcs10.pem file.
- Enter a username, for example “OCSPKeyBinding_IssuingCA”.
- Click download PEM.
Step 3: On the VA
- On the Internal Key Bindings > OCSP Key Bindings tab, click Browse to browse to the certificate that was downloaded from the RA Web.
- Click Import.
- The following message displays “Operation completed without errors.”
- Click Update.
- Click Enable. An hourglass will show in the Active Column and the text “OCSPKeyBinding_IssuingCA status is now ACTIVE” will appear at the top
- Set the Default Responder to be the OCSP Key Binding created.
You need to repeat these steps for any other CAs you want the VA to be an OCSP responder for.
Testing OCSP
Generate a certificate from the Issuing CA using the RA Web. The instructions will not be outlined here but have already been done several times in this guide. Use the profile that has the publisher added to it. It is easiest to have the key generated server side and the certificate downloaded as PEM for testing purposes. Once completed run the following SSL command (changing the attributes for your files and IPs):
# openssl ocsp -issuer CorporateIssuingCAG1.pem -CAfile CorporateRootCAG1_1.pem -cert server.pem -req_text -url https://40.121.65.197/ejbca/publicweb/status/ocsp
Where the flags are:
Option | Description |
---|---|
-issuer | OS the Issuing CA Public Certificate. |
-CAfile | The Root certificate or Chain of the CA. |
-url | The URL to the OCSP server. |
-req_text | Optional but gives more output. |
The output should appear as the following:
Where “Response Verify: OK” means that the stamped OCSP reply from the OCSP server was able to be validated with the certs provided in the command. “server.pem: good” means the certificate status is good.
Revoking the Certificate
- Select Search End Entities.
- Search by username (end entity name).
- Find the End Entity in the search results.
- Click ViewCertificates on the right side.
- Select CertificateHold from the revocation reasons.
- Click Revoke.
- Run the openssl command again and the status should now be “revoked” with a reason of “Certificate Hold”.
Remote Internal Key Binding Updater
You can automatically update OCSP Key Binding Keys to renew themselves. This service will auto-rotate the OCSP signing key, renew the OCSP signing certificate and put it into production on a set interval.
To be able to use remote internal key binding updater some access rules have to be changed on the VA.
To automatically update OCSP Key Binding Keys to renew themselves, do the following:
The following configuration is performed on the VA
- Open a browser and go to the Admin UI of the VA.
- Click Peer Systems.
- For the peer-connector, click Modify role.
- In the CAs section, make sure Access 'Sub CA' is selected.
- In the Internal Key Bindings section, select Renew certificate for the SubCA.
- In the Crypto Tokens section, select Access and Key generation for OCSP.
- Click Modify role to save the changes.
The following configuration is performed on the CA
- Open a browser and go to the Admin UI of the CA.
- Click Services.
- In the Add Service field, enter OCSP Key Binding Updater.
- Click Add.
- In the List of Service list, select OCSP Key Binding Updater and click Edit Service.
- In the Select Worker list, select Remote Internal Key Binding Updater.
- In the Process key bindings where certificate is issued by list, select SubCA.
- Select Renew key pair (optional).
- In the Time before certificate expires field, enter 12.
- In the Time unit of certificate expiry drop-down list select hours.
- In the Period field, enter 1 and select hours from the list.
- Select Active.
- Click Save.