SCEP: bxp-cli scep¶
SCEP is a protocol for getting certificates. Phones, managed laptops, routers and printers use it, usually through an MDM.
bxp-cli scep acts like such a device. You can use it in two ways:
- to test a SCEP endpoint,
- to get a certificate for a machine that is not managed by an MDM.
| Command | What it does |
|---|---|
bxp-cli scep enroll |
Gets a certificate. It needs the challenge password. |
bxp-cli scep renew |
Gets a new certificate. It signs the request with the current certificate, so it needs no challenge password. |
bxp-cli scep getcert |
Fetches a certificate that the CA issued before, by its serial number. |
Which SCEP endpoint¶
Each SCEP verifier of an authority is a separate SCEP endpoint. To choose
one, give its ID with --scep-id. The ID is the verifier's Name in the
web portal.
bxp-cli then builds the endpoint's address. It uses the server and the
authority that bxp-cli trust saved:
Instead of --scep-id, you can give the full address with --url. This can
be the SCEP enrollment URL that the portal shows.
The challenge password¶
To get its first certificate, a device must know a challenge password. What the password is depends on the SCEP verifier's challenge mode:
| Challenge mode | The challenge password |
|---|---|
static |
The verifier's Static challenge secret. It is the same for every device. |
dynamic |
A one-time token with the purpose SCEP-DYNAMIC-CHALLENGE. An admin creates it in the portal, with Create token on the authority's page. Each device needs its own token. |
Enroll¶
$ bxp-cli scep enroll --scep-id my-scep --name printer1.example.com --challenge "$CHALLENGE"
Private key: /home/bob/.bxp-cli/scep/device.key
Certificate: /home/bob/.bxp-cli/scep/device.crt
Valid until: 2027-11-19 14:37 UTC
The first --name becomes the certificate's common name. BastionXP reads
the device's serial number from it, so give the device's serial number. The
CA issues the certificate only if a device with that serial number is in the
inventory. Otherwise it refuses the
request, even with the correct challenge password. To add more names,
give --name again for each one. Every name that is a host name is also
added to the certificate as a DNS name.
--org and --ou set the organization and the organizational unit in the
certificate's subject.
SCEP works only with RSA keys. So bxp-cli creates an RSA key for the device.
bxp-cli scep keeps its files in the folder given with --out-dir. The default
is ~/.bxp-cli/scep.
| File | What it is |
|---|---|
device.key |
The device's private key. |
device.crt |
The device's certificate. |
ca.crt |
The CA's certificates, as the SCEP server sent them. |
Renew¶
$ bxp-cli scep renew --scep-id my-scep
Not due yet: valid until 2027-11-19 14:37 UTC, renews after 2027-07-21 14:37 UTC.
renew signs the request with the current certificate. So it needs no
challenge password.
renew renews the certificate only when less than a third of its lifetime
is left. Otherwise it does nothing. So you can run it every day from a
timer, and it renews the certificate at the right time.
--force renews the certificate now, even if it is not due. --exec runs a
command after a renewal.
Fetch a certificate again¶
getcert signs its request with the device's current certificate and
private key. So the device must still have both.
The BastionXP CA keeps only the latest certificate of each device key. After a renewal, use the serial number of the new certificate.
Flags¶
| Flag | Commands | What it means |
|---|---|---|
--scep-id |
all | The ID of the SCEP endpoint on the BastionXP server. |
--url |
all | The full address of a SCEP endpoint. Use it instead of --scep-id. |
--out-dir |
all | The folder for the device's key and certificate. The default is ~/.bxp-cli/scep. |
--name |
enroll |
A name for the certificate. The first one becomes the common name. Give it once for each name. |
--challenge |
enroll |
The SCEP challenge password. |
--org, --ou |
enroll |
The organization and the organizational unit in the certificate's subject. |
--force |
enroll, renew |
With enroll, replace the existing certificate. With renew, renew now. |
--exec |
renew |
A command to run after a renewal. |
--serial |
getcert |
The certificate's serial number, in hexadecimal. |