Configure Apache HTTP Server
Perform the following tasks to configure the Apache HTTP Server:
In a terminal, run the following commands to set the required FXPKCS11 environment variables:
In a terminal, run the following command to create a new key pair on the using pkcs11-tool:
At the time of writing, there is a bug in Apache that prevents RSA certificates from being served correctly to the browser. This bug may be fixed, but to be safe it is recommended to create and use an ECC certificate as demonstrated.
Enter the identity password configured inside the <CRYPTO-OPR-PASS> tag in the fxpkcs11.cfg file when prompted for the User PIN. If the command is successful the keys will be listed in the output, as shown below:
One private ECC 256-bit key was created with asymmetric sign usage, and one public ECC 256-bit key was created with verify usage.
Before completing the remaining steps in this section, create a directory to store the TLS certificates that will be created, then navigate to that directory.
In a terminal, run the following command to generate a CSR using the private key that you created on the for Apache Server:
The common name of the Apache server certificate should match the domain name of the virtual host it is configured for.
A self-signed root certificate authority (CA) is being used here for demonstration purposes. In a production environment, a secure certificate authority (such as the ) should be used for all private key generation and certificate signing operations.
Run the following commands in a terminal to generate a root private key and self-signed certificate. You use this certificate to sign the Apache Server certificate in the next section.
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:
This section covers how to modify the configuration file for a virtual host that is running in Apache. Configuring a virtual host is outside the scope of this guide. Please reference the following documentation specific to your operating system, if you do not already have a virtual host configured.
In a text editor, open the configuration file for the virtual host you want to configure HTTPS for and modify it as shown below.
The location of the configuration file will specific to your system.
The location of the signed Apache certificate specified in the SSLCertificateFile define needs to be modified according to where it is stored on your system.
The object name of the Apache private key specified in the SSLCertificateKeyFile define needs to match the label that was set in the pkcs11-tool command.
Restart Apache to save and apply the configuration.
This step is only required if you want to use mutual authentication.
In a terminal, generate a client key pair with the following command:
Create a client certificate signing request:
Sign the CSR with the CA certificate:
Convert the signed client certificate to PKCS #12 format for insertion into the browser:
8 | Confirm that Apache is using the TLS certificate and private key stored in for HTTPS connections
If a client certificate was not created for mutual authentication in the previous section, skip to the next step below.
The following steps were completed using a Firefox web browser. There may be some differences in the actions taken when using a different browser, but the overall intent of the process will be the same.
In Firefox, go to Settings > Privacy & Security > Certificates and select [ View Certificates ]
Under the Your Certificates tab, select [ Import ] to import the client certificate converted to PKCS #12 (i.e., ssl-client-pkcs12.p12).
Under the Authorities tab, select [ Import ] to import the CA certificate (such as ssl-ca-cert.pem).
Go to the IP address from which Apache is running over HTTPS.
If a client certificate was configured in the browser for mutual authentication, you should see a lock icon next to the web address. If a client certificate was not configured, bypass the warning and connect to the website anyway.
View the certificate that the website served to the browser and confirm that it is the certificate that was configured in Apache.