Skip to content

Annotated example

A complete configuration with every section, for a company CA at ca.example.com. Take what you need; everything but data_dir and ca.organization is optional.

/etc/bastionxp-ca/bastionxp-ca.yaml
# Where the CA keeps its keys, certificates and database.
# Private: mode 700, owned by the CA's user.
data_dir: /var/lib/bastionxp-ca

ca:
  # The CA certificates are named "<name> Root CA" and "<name> Intermediate CA".
  name: Example
  # Organization (O) in the CA certificates and in every issued certificate.
  organization: Example Org
  # CA key algorithm, chosen at init: ecdsa (P-256, default) or rsa (3072 bits).
  key_type: ecdsa
  # Lifetimes of the CA certificates: y (365 days) or d. The root's is used
  # once, at init; the intermediate's at init and at every new-intermediate.
  root_validity: 10y
  intermediate_validity: 3y
  # The only names the CA may ever issue for. Written into the intermediate
  # at init: set them before. A kind not listed is not allowed at all.
  name_constraints:
    dns_domains: [example.com, corp.internal]
    ip_ranges: [10.0.0.0/8]
    email_domains: [example.com]
  # If the server's keys are encrypted: a file with their passphrase, not
  # inside data_dir. Better: the systemd credential "bastionxp-ca-key-passphrase",
  # sealed to the TPM (then leave this out).
  # key_passphrase_file: /run/secrets/bastionxp-ca-key-passphrase

server:
  # Where the HTTPS server listens.
  address: ":8443"
  # Names clients use to reach the server; they go into its TLS certificate.
  names: [ca.example.com, 10.0.0.5]
  # The address people's browsers use (needed for OIDC login).
  url: https://ca.example.com:8443
  # Plain HTTP for public information only (CA certificates, CRL, OCSP),
  # and how others reach it. Written into every TLS certificate.
  public_address: ":8080"
  public_url: http://ca.example.com:8080

# Your own certificate profiles, beside tls-server, tls-client, tls-device,
# ssh-user and ssh-host. Use them by name: bxp token --profile device-client.
profiles:
  - name: device-client
    base: tls-client          # tls-server, tls-client, email or code-signing
    validity: 365d
    subject: { organizational_unit: [Devices] }
    names: { dns: true, email: true }
  - name: user-client
    base: tls-client
    validity: 30d
    subject: { organizational_unit: [People] }
  - name: ops-ssh
    base: ssh-user
    validity: 8h
    ssh:
      extensions: [permit-pty, permit-agent-forwarding]
      critical_options: { source-address: 10.0.0.0/8 }

# Login with the company identity provider (OIDC).
oidc:
  issuer: https://login.microsoftonline.com/<tenant-id>/v2.0
  client_id: 00000000-0000-0000-0000-000000000000
  client_secret_file: /etc/bastionxp-ca/oidc-client-secret
  username_claim: preferred_username   # the default
  groups_claim: groups                 # the default
  # What people get for themselves after a login (bxp tls, bxp ssh).
  x509: { cert_profile: user-client }  # default: tls-client
  ssh:  { cert_profile: ops-ssh }      # default: ssh-user

# Login with an Active Directory username and password. Both logins can be
# on at once; they share the access rules.
ldap:
  url: ldaps://dc1.corp.example.com
  ca_file: /etc/bastionxp-ca/corp-root.pem
  base_dn: DC=corp,DC=example,DC=com
  bind_dn: CN=bastionxp-ca-svc,OU=Service Accounts,DC=corp,DC=example,DC=com
  bind_password_file: /etc/bastionxp-ca/ldap-password
  group_base_dn: OU=Groups,DC=corp,DC=example,DC=com
  x509: { cert_profile: user-client }

# Who gets what after a login. {username} is the person's name in lower
# case, {short_username} the part before the "@". Reloadable.
access:
  - groups: [linux-users]
    ssh_principals: ["{short_username}"]
  - groups: [dba]
    ssh_principals: [postgres]
  - groups: [ca-admins]
    admin: true

# The ACME server: certbot, acme.sh, lego, Caddy, cert-manager.
acme:
  allowed_domains: [example.com]       # example.com, *.example.com and below
  allowed_ip_ranges: [10.0.0.0/8]      # IP addresses ACME may issue for
  challenges: [http-01, dns-01, tls-alpn-01]
  dns_resolver: 10.0.0.53:53           # the DNS server dns-01 asks
  limits:
    accounts_per_ip_per_hour: 100
    orders_per_account_per_hour: 300
  x509: { cert_profile: tls-server }   # the default

# The SCEP server: phones, MDM, routers, printers.
scep:
  enabled: true
  # A shared challenge for MDM systems that cannot fetch a token per device.
  static:
    challenge_file: /etc/bastionxp-ca/scep-challenge   # at least 16 characters
    x509: { cert_profile: device-client }
    dns_domains: [devices.example.com]
    max_per_hour: 100

# Prometheus metrics, on an address of their own.
metrics:
  address: 10.0.0.5:9100
  token_file: /etc/bastionxp-ca/metrics-token

The repository also has a commented starting point, bastionxp-ca.example.yaml.