- Set FXPKCS11 environment variables.
- Create a key pair on the KMES Series 3 with
pkcs11-tool. - Generate a CSR by using the Apache Server private key.
- Create a self-signed root certificate authority (CA).
- Sign the Apache Server CSR.
- Configure Apache to use the signed certificate and the private key stored on the KMES Series 3.
- (Optional) Create a client certificate for the browser that connects to the Apache HTTP Server.
- Confirm that Apache uses the new TLS certificate and private key (stored on the KMES) for HTTPS connections.
Set FXPKCS11 environment variables
In a terminal, run the following sequence of commands to set the required FXPKCS11 environment variables:Shell
Create a key pair
Perform the following steps to create a key pair on the KMES Series 3with pkcs11-tool:In a terminal, run the following command to create a new key pair on the KMES Series 3 with Currently, Apache has a bug that prevents RSA certificates from being served correctly to the browser. This bug might be fixed, but we recommend that you create and use an ECC certificate as demonstrated in the code example.
pkcs11-tool:Shell
Enter the password of the identity configured in
fxpkcs11.cfg when prompted for the User PIN.If the command succeeds, the output includes the keys (a private ECC 256-bit key with asymmetric sign usage and a public ECC 256-bit key with verify usage), as shown in the following output sample:
None
Generate a CSR
Before completing the steps in this section, create a directory to store the new TLS certificates and go to that directory. Then, perform the following process to create a CSR by using the Apache Server private key: In a terminal, run the following command to generate a CSR by using the private key that you created on the KMES Series 3 for Apache Server:Shell
Create a self-signed root CA
This section uses a self-signed root certificate authority (CA) for demonstration purposes. In a production environment, you should use a secure certificate authority (such as the KMES Series 3) for all private key generation and certificate signing operations. In a terminal, run the following sequence of commands to generate a root private key and self-signed certificate. This certificate signs the Apache Server certificate in the next section.Shell
Sign the CSR
In a terminal, run the following command to issue a signed Apache Server certificate by using the self-signed root CA created in the previous step:Shell
Configure Apache
This section explains how to modify the configuration file for a virtual host running in Apache. Configuring a virtual host is outside of the scope of this guide. Refer to the following documentation (www.digitalocean.com/community/tutorial-collections/how-to-install-apache) specific to your operating system if you have not already configured a virtual host. Perform the following steps to configure Apache to use the signed certificate and the private key stored on the KMES Series 3:In a text editor, open the configuration file for the virtual host for which you want to configure HTTPS. The location of the configuration file varies depending on your system. Modify the file as shown in the following example:
None
(Optional) Create a client certificate
Complete this step only if you want to use mutual authentication. Perform the following steps to create a client certificate for the browser that connects to Apache HTTP Server:Run the following command to sign the CSR with the CA certificate created earlier in this section:
Shell
Confirm Apache configuration
If you did not create a client certificate for mutual authentication in the previous section, start at step 4 of the following procedure.
In Firefox, selectSettings>
Privacy & Security>
Certificatesand then select**[ View Certificates ]**.
On theYour Certificatestab, select**[ Import ]**to import the client certificate that was converted to PKCS #12 (
ssl-client-pkcs12.p12).to the IP address from which Apache is running over HTTPS.
If you configured a client certificate in the browser for mutual authentication, you should see a lock icon next to the web address. If you did not configure a client certificate, bypass the warning that displays and connect to the website anyway.

