- Set Futurex PKCS #11 environment variables
- Configure Nginx certificates.
- Configure Nginx to use the signed certificate and private key stored on the KMES.
Set environment variables
In a terminal, run the following commands to set the required FXPKCS11 environment variables, modifying the file path to match the location where thelibfxpkcs11.so and fxpkcs11.cfg files are located on your system:
Shell
Configure Nginx certificates
Perform the following tasks to configure Nginx certificates:- Create a key pair on the KMES.
- Generate a CSR.
- Create a self-signed root CA.
- Sign the Nginx Server CSR.
- Create a client certificate.
Create a key pair
Perform the following steps to create a key pair on the KMES by using pkcs11-tool:In a terminal, run the following command to create a new RSA key pair on the KMES by using** pkcs11-tool**:
Shell
Generate a CSR
In a terminal, run the following command to generate a CSR from the private key that pkcs11-tool created on the KMES for Nginx in the preceding step. Ensure that the common name of the Nginx Server certificate matches the domain name or IP address of the virtual host for which you are configuring it.Shell
Create a self-signed root CA
The following instructions show you how to create and use a self-signed root certificate authority (CA) as a demonstration. In a production environment, 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 commands to generate a root private key and self-signed certificate:Shell
Sign the CSR
In a terminal, run the following command to issue a signed Nginx server certificate by using the self-signed root CA created in the preceding section:Shell
Create a client certificate
Perform the following steps to create a client certificate for the browser that connects to Nginx:Run the following command to convert the signed client certificate to PKCS #12 format for insertion into the browser:
Shell
If you encounter SSL errors when connecting to your Nginx server in the web browser after completing this guide, ensure that you added the v3\leaf extensions properly. Nginx requires the SANS (added in as
IP.1 under the v3\leaf extension in your openssl.cnf file) in both the signed Nginx certificate and the browser client certificate.Configure Nginx
This section covers modifying the configuration file for an Nginx virtual host to use the signed certificate and private key stored on the KMES.Refer to the 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. Configuring a virtual host is outside the scope of this guide.
In a text editor, open the configuration file in your
conf.d folder in the Nginx directory for the virtual host you want to configure HTTPS for and modify it as shown in the following example:Modify the location of the signed Nginx certificate specified in the ssl\certificate define according to where it is stored on your system.The object name of the Nginx private key specified in the ssl\certificate_key define must match the label you set in the pkcs11-tool command.
None
Confirm the Nginx configuration
This section uses a Firefox web browser. Using a different browser might require altered actions, but the fundamental steps remain the same. Perform the following steps to confirm that Nginx uses the new TLS certificate and private key stored on the KMES for HTTPS connections:Select Your Certificates > Import to import the PKCS #12 client certificate (
ssl-client-pkcs12.p12).Browse to the IP address of the Nginx website that runs 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.

