- Modify
as.confto set Access Server in external PKI mode. - (Optional) Create the server CA using
pkcs11-toolcommands. - Generate the server certificate and key via
pkcs11-toolcommands. - Generate the client certificate and key via
pkcs11-toolcommands.
NoteIt is important to also point out that Access Server connection will stop working once the CA certificate expires. Since the clients use the CA’s public key to verify the connection to the Access Server, it is important that the CA certificate will need to be replaced on time to not cause disruption to any of the client’s connection. This is especially true if the CA’s certificate validity period is short lived.
Set FXPKCS11 environment variables
In a terminal, run the following sequence of commands to set the required FXPKCS11 environment variables:Shell
Configure OpenVPN Access Server
Edit the Comment out Save and exit the file. This command will make the Access Server no longer use the certificate database. Instead, an external system must handle this.
as.conf for external PKI usage:Shell
certs_db:None
(Optional - If using external CA, skip this step) Generate CA key via The key is now securely stored on the KMES. However, the OpenSSL CA signing command requires a key reference in a After setting up the Python CLI environment and installing Run the following command to generate the CA certificate:
pkcs11-tool command:Shell
.pem file. Instead of exporting the private key—which would create significant security risks—you can store a PKCS #11 URI reference in the .pem file. This allows pkcs11-provider by Latchset to access the key directly on the KMES and perform the signing operation without exposing the key material.NOTEIn this guide, running Python scripts is demonstrated using the CLI. This is not the only way to run the script—it can also be executed within an IDE, a Jupyter notebook, or any environment that supports Python execution.
asn1crypto, run the following command to generate a PKCS #11 URI reference and save it directly to ca.key in the current directory:Shell
Shell
Create a custom OpenSSL file for the server.Open the Look for the section Look for the section Save and exit the file with a new name
openssl.cnf file to edit:Shell
[ req ] and add the below line in that section:None
[ v3_req ], remove the content that is currently in that section, and add the below lines in that section:None
openssl-server.cnf (To perform this, hit ctrl + x, y, and then type the new name, then hit Enter).Create a custom OpenSSL file for clients.Open the Look for the section Look for the section Save and exit the file with a new name
openssl.cnf file to edit:Shell
[ req ] and add the below line in that section:None
[ v3_req ], remove the content that is currently in that section, and add the below lines in that section:None
openssl-client.cnf (To perform this, hit ctrl + x, y, and then type the new name, then hit Enter).Generate the server key via Using the Generate the certificate signing request (CSR) for the server:Use the CA generated from an earlier step to sign the
pkcs11-tool command:Shell
uri2pem.py script, generate the PKCS #11 URI reference file and save it as server.key:Shell
Shell
.csr file:Shell

