If not done already, set up the necessary certificates: FairCom — Use client certificate authentication in client software
Use client certificate authentication in a FairCom CLI tool
- The CA certificate file must be copied to the local directory and named
ctsrvr.pem - Set environment variable
CTSSL_CLIENT_CERTIFICATEto identify the user certificate you want to be authenticated. The user certificate must be followed by the CA certificate in the specified file. Certificates generated using createclientcert.py already contain the CA certificate.set CTSSL_CLIENT_CERTIFICATE=c:\my\certs\user.pem - (optional) Set environment variable
CTSSL_CLIENT_KEYto identify the user private key that corresponds to theCTSSL_CLIENT_CERTIFICATE. Certificates generated using createclientcert.py contain the private key by default and can skip this step.set CTSSL_CLIENT_KEY=c:\my\keys\user.key - (optional) Set another environment variable to log client-side SSL errors to a log file of your choosing:
set CTSSL_DEBUG_LOG=c:\my\logs\my_tls.log - Run the FairCom command line utility program with
nonein place of the username and password, and specify a FSSLTCP connection in the connection string:ctadmn none none "" "FAIRCOMS@localhost^fssltcp" - If the private key is encrypted, you will be prompted for the password.
Use client certificate authentication in ISAM or CTDB API
The CLI tool steps can be followed as above to configure other ISAM/CTDB applications. Alternatively, the certificates can be configured programmatically using ctSetCommProtocolOption.
- The server CA certificate filename can be changed from the
"ctsrvr.pem"default filename:ctSetCommProtocolOption(ctCOMMOPT_FSSLTCP_SERVER_CERTIFICATE,"c:\my\certs\ca.pem"); - Client software can use the following code to register a client certificate for authenticating with a FairCom server:
ctSetCommProtocolOption(ctCOMMOPT_FSSLTCP_CLIENT_CERTIFICATE,"c:\my\certs\user.pem");
This may be overridden by the environment variableCTSSL_CLIENT_CERTIFICATE - Client software can use the following code to register a private key file and prove ownership when authenticating with a FairCom server:
ctSetCommProtocolOption(ctCOMMOPT_FSSLTCP_CLIENT_KEY,"c:\my\keys\my_user.pem");
This may be overridden by the environment variableCTSSL_CLIENT_KEY - If the private key is encrypted, use the following code to register a private key password (
char *) to decrypt an encrypted private key:ctSetCommProtocolOption(ctCOMMOPT_FSSLTCP_CLIENT_PASSPHRASE,yourPassphrase); - When connecting with
ctdbLogon()/INTISAMX(), append"^fssltcp"to the connection string to indicate using the TLS protocol. - Any username/password connection arguments are ignored if the server allows client certificate authentication.