Skip to content

Certificate profiles

A profile fixes what a kind of certificate contains: its key usages, its lifetime, which kinds of names it may hold, and which keys it accepts. Every request names a profile, and the CA enforces it on every certificate, whichever way the request came.

Built-in profiles

Profile For Usage Default lifetime Maximum
tls-server web servers, APIs, databases server auth 24 hours 30 days
tls-client users and services (mutual TLS) client auth 24 hours 30 days
tls-device managed devices enrolling over SCEP client auth 30 days 90 days
ssh-user people logging in to servers SSH user certificate 16 hours 24 hours
ssh-host SSH servers SSH host certificate 30 days 90 days

The built-in profiles are short-lived on purpose: certificates are renewed automatically, and one that expires within a day needs no revocation to stop working. For anything that must live longer, define a profile of your own (below): a profile's lifetime is not limited by its base.

tls-device is a tls-client profile with a longer life, for devices that renew when their device management says so rather than every few hours. It is based on tls-client, so it is allowed wherever a tls-client profile is, and it is the default of SCEP's shared challenge.

SSH user certificates allow X11, agent and port forwarding, a PTY and the user's rc file (permit-X11-forwarding, permit-agent-forwarding, permit-port-forwarding, permit-pty, permit-user-rc).

Your own profiles

Define profiles for certificates that need other lifetimes, usages or contents: device certificates for VPN and network access, S/MIME email, code signing, short-lived admin certificates, SSH certificates usable only from one network. A profile starts from a base and changes only what it lists. There are X.509 profiles and SSH profiles.

An X.509 profile:

profiles:
  - name: device-client
    base: tls-client                 # tls-server, tls-client, email or code-signing
    validity: 365d                   # default lifetime; or 8h, 90m
    max_validity: 365d               # the longest a request may ask for
    subject:
      organizational_unit: [Devices] # written into every certificate
      require_common_name: true
    names: { dns: false, ip: false, email: true, wildcard: false }
    ext_key_usage: [client_auth]     # replaces the base's
    key_usage: [digital_signature, key_encipherment]
    policies: [1.3.6.1.4.1.55555.1.1]
    extensions:                      # added as they are: OID and DER value in hex
      - { oid: 1.3.6.1.4.1.55555.1.2, critical: false, value_hex: "0c0764657669636573" }   # the text "devices"
    keys: { algorithms: [rsa, ecdsa], min_rsa_bits: 3072, curves: [P-256, P-384] }

The bases

Base Usage Lifetime (default / max) Names
tls-server server auth 24 hours / 30 days DNS names, IP addresses, email addresses; at least one DNS name or IP address
tls-client client auth 24 hours / 30 days DNS names, IP addresses, email addresses
email email protection (S/MIME) 365 / 1095 days email addresses only
code-signing code signing 365 / 1095 days none; a common name is required
ssh-user SSH user certificate 16 / 24 hours login names
ssh-host SSH host certificate 30 / 90 days host names

Settings

Setting Meaning
name Lower case letters, digits and dashes. Cannot be a built-in profile's name, or start with ssh-.
base The profile it starts from: tls-server, tls-client, email, code-signing (X.509) or ssh-user, ssh-host (SSH).
validity Default lifetime: 365d, 8h, 90m.
max_validity The longest a request may ask for.
subject.organizational_unit OU values written into every certificate.
subject.require_common_name Refuse requests without a common name.
names Which kinds of names a certificate may contain: dns, ip, email, wildcard. Left out, the base decides. Name constraints and the token's own names still apply.
ext_key_usage Replaces the base's: server_auth, client_auth, email_protection, code_signing, time_stamping, ocsp_signing. A profile with server_auth must allow DNS names or IP addresses.
key_usage digital_signature, key_encipherment, content_commitment, data_encipherment, key_agreement. Left out: digital signature, plus key encipherment for RSA keys.
policies Certificate policy OIDs.
extensions Extra extensions, added as they are: OID, criticality, DER value in hex. Cannot repeat what the CA sets itself (names, usages, policies, revocation addresses): use the profile's own settings for those.
keys.algorithms ecdsa, rsa, ed25519.
keys.min_rsa_bits Smallest RSA key accepted.
keys.curves P-256, P-384, P-521.

Changing profiles needs a restart of the server.

See what a profile contains

bxp profiles shows the values each profile ends up with, base values and your settings combined, as the CA computes them:

bxp profiles --config bastionxp-ca.yaml                 # all of them
bxp profiles --config bastionxp-ca.yaml device-client   # one
bxp profiles --bases                              # the six bases, no configuration needed
$ bxp profiles --config bastionxp-ca.yaml device-client
device-client  (profile, base tls-client)
  Usage:       client auth
  Key usage:   digital signature; key encipherment too for RSA keys
  Lifetime:    365 days (max 365 days)
  Subject:     O from the CA, OU=Devices
  Names:       DNS names, email addresses
  Keys:        any the CA accepts (ECDSA P-256/384/521, RSA 2048+, Ed25519)

It reads only the configuration file: no keys, no CA.

SSH profiles

An SSH profile starts from ssh-user or ssh-host:

profiles:
  - name: ops-ssh
    base: ssh-user
    validity: 8h
    max_validity: 24h
    ssh:
      extensions: [permit-pty, permit-agent-forwarding]   # replaces the base's; [] for none
      critical_options:
        source-address: 10.0.0.0/8                        # usable only from there
        # force-command: /usr/local/bin/backup            # only this command
  - name: web-hosts
    base: ssh-host
    validity: 90d
Setting Meaning
validity, max_validity Default and longest lifetime, as for X.509 profiles.
ssh.extensions What a session may do: permit-pty, permit-port-forwarding, permit-agent-forwarding, permit-X11-forwarding, permit-user-rc, no-touch-required. Replaces the base's; left out: the base's (for ssh-user, all but no-touch-required); []: none.
ssh.critical_options Restrictions the SSH server enforces: source-address (addresses and ranges, comma-separated), force-command (the only command the certificate may run), verify-required (a FIDO key must verify the user).

Host profiles (base: ssh-host) take only validity and max_validity: host certificates have no extensions or critical options. X.509 settings (key_usage, names, subject, ...) are refused on SSH profiles, and ssh is refused on X.509 profiles.

$ bxp profiles --config bastionxp-ca.yaml ops-ssh
ops-ssh  (profile, base ssh-user)
  Kind:        user certificate: login names
  Lifetime:    8 hours (max 24 hours)
  Allows:      permit-agent-forwarding, permit-pty
  Restricts:   source-address=10.0.0.0/8

Use a profile

With a token, by name:

bxp token --profile device-client --name [email protected]
bxp token --profile ops-ssh --name deploy

Admins can also request any profile directly: bxp tls --profile device-client --name ..., bxp ssh --profile ops-ssh ....

Each verifier's profile

Every verifier has a cert_profile, under x509 and ssh, naming the profile it issues:

Verifier Setting Default Must be based on
OIDC logins oidc.x509.cert_profile tls-client tls-client
oidc.ssh.cert_profile ssh-user ssh-user
LDAP logins ldap.x509.cert_profile tls-client tls-client
ldap.ssh.cert_profile ssh-user ssh-user
ACME acme.x509.cert_profile tls-server tls-server
SCEP shared challenge scep.static.x509.cert_profile tls-client tls-client or tls-server
One-time tokens, SCEP with a token the token's --profile any
oidc:
  issuer: https://login.microsoftonline.com/<tenant-id>/v2.0
  client_id: ...
  client_secret_file: /etc/bastionxp-ca/oidc-client-secret
  x509: { cert_profile: user-client }    # people's own TLS client certificates
  ssh:  { cert_profile: ops-ssh }        # people's own SSH certificates

ldap:
  url: ldaps://dc1.corp.example.com
  # ...
  x509: { cert_profile: user-client-short }   # e.g. shorter-lived than with OIDC and MFA

acme:
  allowed_domains: [example.com]
  x509: { cert_profile: short-server }

A profile of the wrong kind is refused when the configuration is read: an ACME profile must be for servers, a login's X.509 profile for clients, a login's SSH profile for users. Each verifier's profiles are independent: for example, people who log in with a password (LDAP) can get shorter-lived certificates than people who log in with MFA (OIDC).

Examples

profiles:
  - name: smime
    base: email
    validity: 365d
    subject: { require_common_name: true }
profiles:
  - name: release-signing
    base: code-signing
    validity: 90d
    keys: { algorithms: [ecdsa], curves: [P-384] }
profiles:
  - name: admin-client
    base: tls-client
    validity: 8h
    max_validity: 24h
    subject: { organizational_unit: [Admins], require_common_name: true }
    names: { dns: false, ip: false, email: true }
profiles:
  - name: rsa-server
    base: tls-server
    validity: 365d
    keys: { algorithms: [rsa], min_rsa_bits: 3072 }