This section details how to enable client certificate authentication on a faircom server. For more information on the configuration options used here, visit the security section in our Faircom DB configuration options. For other security terminology, see Security terms.
- Create a server certificate (using createservercert.py), signed by a CA certificate and named something like
ServerCertAndKey.pem -
ServerCertAndKey.pemcontains the following data in this order:- Unencrypted Server private key
- Server certificate
- CA certificate
- Copy
ServerCertAndKey.pemto a suitable location on the server. We will use<faircom>/config/ServerCertAndKey.pem. Ensure that the filesystem permissions prevent users other than the faircom process from accessing this file, as it contains a private key. - Edit FairCom's server configuration file,
<faircom>/config/ctsrvr.cfg. - Update the
SUBSYSTEM COMM_PROTOCOL SSLsection with the following minimal configuration:
SUBSYSTEM COMM_PROTOCOL SSL {
;This is the file name in your server's config directory
SERVER_CERTIFICATE_FILE c:/programdata/faircom/edge/config/ServerCertAndKey.pem
;For TLS troubleshooting, you can specify a debug log file name
;DEBUG_LOG c:/programdata/faircom/edge/data/ssl.log
;Allow x509 client certificates for database authentication
x509_AUTHENTICATION YES
;Use the SUBJECT:CN from the client's certificate as their user name
x509_PATH CN
}- To enable TLS client certificates for HTTPS, MQTTS or MQTTWSS edit:
<faircom>/config/services.json - Update the
listeners.tlssection for HTTPS, MQTTS and/or MQTTWSS to include
"tls": {
"serverCertificateFilename":"c:/programdata/faircom/edge/config/ServerCertAndKey.pem",
"caCertificateFilename":"c:/programdata/faircom/edge/config/ca.crt",
"requireClientCertificate": true
}
The ca.crt specified in "caCertificateFilename" contains only the CA certificate.- While still in
services.json, ensure theauthenticationMethodsblock in themqttsection contains“clientCertificate”. - Restart the FairCom server.