SCEP Certificate Lifecycle Operations
The Horizon Client includes a SCEP client to perform challenge based pre-validated enrollments and renewals. Its usage is similar to that of the EST client in challenge mode.
Usage:
horizon-cli scep [command] [flags]
SCEP Enrollment
The enroll
command allows you to perform a SCEP enrollment operation. It will generate a new key pair and a CSR based on the content parameters, and send it to the SCEP server to obtain a certificate.
Enrollment modes
The following enrollment modes are supported:
-
Authorized user/password in decentralized mode
-
Challenge password in decentralized mode
Authorized user
In this enrollment mode, a local user account is created in Horizon for Horizon Client, and the SCEP profile on Horizon is configured in authorized
mode thus a static username and password can be provided to Horizon Client for enrollment.They need to be set in general configuration as APIID
and APIKEY
.
|
Challenge password
In this enrollment mode, the SCEP profile on Horizon is set to challenge
mode. A request must then be made on Horizon in order to retrieve the one-time password challenge
to be used to authenticate the SCEP request.No APIID
nor APIKEY
need to be set.
Use the
|
General enrollment parameters
Parameter |
Description |
|
Horizon’s technical name of the profile to enroll on. Mandatory |
|
Challenge generated on Horizon on the profile. Mandatory in challenge mode |
|
Horizon’s discovery campaign name to use in order to report the certificate to Horizon after enrollment |
|
Path to the script to execute after enrollment. See script for more details |
Certificate parameters
Parameter |
Description |
|
Requested subject Common Name. Single value |
|
Requested subject |
|
Requested subject alternative name DNS entries. Can contain multiple values |
|
Requested subject alternative name IP entries. Can contain multiple values |
|
Requested subject alternative name RFC822Name entries. Can contain multiple values |
Parameter |
Description |
|
Contact email of the request. Single value |
|
Owner of the request. Single value |
|
Team of the request. Single value |
|
Labels of the request. Can contain multiple values |
Parameter |
Description |
|
Key-type of the certificate. See key types for more details |
Output parameters
These parameters define how to store the retrieved certificate and its associated private key. The following alternatives are available:
-
Key and certificate stored separately in two files, in PEM format. This is typically used by Apache or NGINX web servers;
-
Key and certificate stored together in a PKCS#12 file. This is typically used by Tomcat application server;
-
Key and certificate stored together in Windows certificate store. This is typically used by IIS web server (see Windows parameters)
Parameter |
Description |
|
Path to the certificate to store |
|
Path to the private key to store |
|
Path to the chain to store |
|
Path to write the PKCS#12 output |
|
Password for the PKCS#12 output. Mandatory if |
|
Enable AES encryption for PKCS#12, compatible with openssl v3 |
|
Path to write the JKS output |
|
Password for the JKS output. Mandatory if |
|
Alias for the JKS output. Mandatory if |
|
Password for the alias in the JKS output. Mandatory if |
|
Always overwrite existing files |
Windows parameters
These parameters define how to integrate with the Windows certificate store:
Parameter |
Description |
|
Triggers the use of user Windows certificate store to save the certificate after enrollment |
|
Triggers the use of computer Windows certificate store to save the certificate after enrollment |
|
Triggers the ability to store the certificate in the |
|
Triggers the ability to store the certificate in the legacy |
|
Marks the key as exportable from the Windows certificate store. If not specified, the key is not exportable |
SCEP Renewal
The renew
command is designed to work similarly to the enroll
command, but with a few differences:
-
It will enroll a certificate based on the
--in-cert
parameter (or similar, see below) instead of the content parameters. Only the--key-type
parameter is used to generate a new key pair. -
No challenge is needed for a SCEP renewal operation
General renewal parameters
Parameter |
Description |
|
Horizon’s technical name of the profile to enroll on. Mandatory |
|
Horizon’s discovery campaign name to use in order to report the certificate to Horizon after renewal |
|
Key-type of the certificate. See key types for more details |
|
Path to the script to execute after renewal. See script for more details |
|
Number of days before expiration to trigger the renewal. Defaults to 30 |
Input certificate parameters
These parameters define how to find the certificate to renew. It can be stored in the following formats:
-
Key and certificate stored separately in two files, in PEM format (
--in-cert
&--in-key
) -
Key and certificate stored together in a PKCS#12 file (
--in-cert
&--in-pfx-pwd
) -
Key and certificate stored together in a JKS file (
--in-cert
&--in-jks-pwd
&--in-jks-alias
&--in-jks-alias-pwd
) -
Key and certificate stored together in Windows certificate store:
-
Using certificate thumbprint, available in the details tab of windows certificate explorer or in certutil (
--in-cert
)
-
Parameter |
Description |
|
Path to the certificate to renew (PEM file, PKCS#12 file, JKS file) or certificate thumbprint for Windows certificate store entries |
|
Path to the private key of the certificate to renew if --in-cert is a PEM file |
|
Password for the PKCS#12 file to renew |
|
Password for the JKS file to renew |
|
Alias for the JKS file to renew |
|
Alias password for the JKS file to renew |
Output parameters
These parameters define how to store the retrieved certificate and its associated private key. The following alternatives are available:
-
Key and certificate stored separately in two files, in PEM format. This is typically used by Apache or NGINX web servers;
-
Key and certificate stored together in a PKCS#12 file. This is typically used by Tomcat application server;
-
Key and certificate stored together in Windows certificate store. This is typically used by IIS web server (see Windows parameters)
Parameter |
Description |
|
Path to the certificate to store |
|
Path to the private key to store |
|
Path to the chain to store |
|
Path to write the PKCS#12 output |
|
Password for the PKCS#12 output. Mandatory if |
|
Enable AES encryption for PKCS#12, compatible with openssl v3 |
|
Path to write the JKS output |
|
Password for the JKS output. Mandatory if |
|
Alias for the JKS output. Mandatory if |
|
Password for the alias in the JKS output. Mandatory if |
|
Always overwrite existing files |
Windows parameters
These parameters define how to integrate with the Windows certificate store:
Parameter |
Description |
|
Triggers the use of user Windows certificate store to save the certificate after enrollment |
|
Triggers the use of computer Windows certificate store to save the certificate after enrollment |
|
Triggers the ability to store the certificate in the |
|
Triggers the ability to store the certificate in the legacy |
|
Marks the key as exportable from the Windows certificate store. If not specified, the key is not exportable |
Key Types
Depending on your Horizon version, the following key types are supported:
RSA
To add a RSA key type, the following syntax must be used.
rsa-<key-size>
rsa-2048 , rsa-3072 , rsa-4096
|
Script parameter
You can tell Horizon Client to launch a script upon successful certificate enrollment or renewal by using the --script
parameter, which takes the path to the script as an argument.
The script will receive arguments passed by Horizon Client in the following order:
-
Issued certificate serial number
-
Issued certificate fingerprint (SHA-1 hash of the certificate in DER format - windows store thumbprint)
-
Issued certificate Subject DN
-
Issued certificate Issuer DN
Below is an example of a very simple bash script:
#!/bin/sh
echo $1
echo $2
echo $3
echo $4
Below is an example of a very simple PowerShell script:
param($serial, $fingerprint, $subject, $issuer)
Write-Output $serial
Write-Output $fingerprint
Write-Output $subject
Write-Output $issuer
Examples
You will find below a few examples detailing how to use the client for SCEP enrollment in various context
Enrollment with output as key and certificate
horizon-cli scep enroll --profile=<profile> --challenge=<challenge> --cn=test.example.com --dnsnames=test.example.com,www.test.example.com --cert=/path/to/cert --key=/path/to/key
Enrollment with lots of metadata and output as PKCS#12
horizon-cli scep enroll \
--profile=<profile> \
--challenge=<challenge> \
--key-type=rsa-2048 \
--cn=test.example.com \
--dnsnames=test.example.com,www.test.example.com \
--owner="John Doe" \
--ou="IT" \
--team="IT" \
--labels="env:prod" \
--pfx=/path/to/pkcs12 \
--pfx-pwd=<pkcs12_password>