Skip to content

TLS certificates

bxp tls creates a new private key on this machine, asks the CA for a certificate for it, and writes both files.

With a token

The administrator, on the CA machine:

bxp token --profile tls-server --name web.example.com --name www.example.com

The requester, on the machine that needs the certificate:

$ bxp tls --token <token> --name web.example.com --name www.example.com
Private key:  web.example.com.key
Certificate:  web.example.com.crt
Valid until:  2027-02-13 16:28 UTC
File What it is
web.example.com.key The private key (PKCS#8 PEM, mode 600). It never left this machine.
web.example.com.crt The certificate followed by the intermediate certificate, ready for a web server.

The files are named after the first --name, in the current directory (--out-dir changes where). Existing files are not replaced unless you add --force.

Names

  • Repeat --name for more names: DNS names, IP addresses or email addresses.
  • With a token, --name can be left out: the certificate is then for all the names the token allows, and the files are named after the first.
  • Every name requested must be in the token. You may ask for fewer.
  • The first name becomes the common name.
  • The profile decides which kinds of names are allowed (see Certificate profiles).

Server or client certificate

The token decides the profile:

Token made with Certificate
--profile tls-server Server authentication (web servers, APIs, databases).
--profile tls-client Client authentication (mutual TLS: users, devices, services).
--profile <your-profile> Whatever your profile defines.

The request command is the same for all of them.

Lifetime

bxp tls --token <token> --name web.example.com --validity 24h

Without --validity, the profile's default applies (24 hours for tls-server and tls-client). A value above the profile's maximum is refused.

With a login

Without --token, the command logs in:

bxp tls --profile tls-server --name web.example.com
bxp tls --ldap --profile tls-server --name web.example.com

What a person may request after a login depends on the access rules. Admins may request any certificate, as above. Everyone else gets a client certificate for themselves.

A client certificate for yourself

After a login, with no token and no --name:

$ bxp tls
Private key:  [email protected]
Certificate:  [email protected]
Valid until:  2026-12-15 16:28 UTC
bxp tls --ldap
  • The CA decides the name: yours. The common name is your name as the login reports it, which is also the certificate's email address when it is one. You cannot ask for another name.
  • The profile is the login's x509.cert_profile (default tls-client): client authentication, for VPN and mutual TLS. See Each verifier's profile.
  • The files are named after your name.

Use the certificate

ssl_certificate     /etc/nginx/tls/web.example.com.crt;
ssl_certificate_key /etc/nginx/tls/web.example.com.key;
SSLCertificateFile    /etc/httpd/tls/web.example.com.crt
SSLCertificateKeyFile /etc/httpd/tls/web.example.com.key
cat web.example.com.crt web.example.com.key > /etc/haproxy/web.example.com.pem
ssl_client_certificate /etc/nginx/tls/bastionxp-ca-root.crt;
ssl_verify_client on;
ssl_crl /etc/nginx/tls/bastionxp-ca.crl;   # refreshed from /crl by a timer

Inspect it

openssl x509 -in web.example.com.crt -noout -subject -issuer -dates -ext subjectAltName
openssl verify -CAfile root.crt -untrusted web.example.com.crt web.example.com.crt

Renew it

Run bxp renew every hour: it renews when a third of the lifetime is left, with no token.

Behind the command

bxp tls makes an ECDSA P-256 key, builds a CSR and sends it to POST /v1/x509/sign with the token. You can do the same with any tool; see the HTTP API.