Skip to content

Quick start

In about ten minutes you will:

  1. create a CA,
  2. start the CA server,
  3. make a client trust it,
  4. get a TLS certificate for a web server, and
  5. get an SSH certificate for a user.

Everything runs on one machine here. In real use, steps 1, 2 and the bxp token commands run on the CA machine, and steps 3 to 5 on the machines that need certificates.

Tip

Install BastionXP CA first: see Installation.

1. Create the CA

Write a minimal configuration file, bastionxp-ca.yaml:

bastionxp-ca.yaml
data_dir: ./bastionxp-ca-data          # where the keys and the database live

ca:
  name: Example                  # used in the CA certificates' names
  organization: Example Org      # written into every certificate

server:
  address: ":8443"               # where the HTTPS server listens
  names: [localhost, 127.0.0.1]  # names clients use to reach it

Create the CA:

$ bxp init --config bastionxp-ca.yaml
Choose a passphrase of at least 12 characters. Keep it safe: it cannot be recovered.
Passphrase for the root key: ****************
Again: ****************
CA created in ./bastionxp-ca-data

  Root CA:        Example Root CA
  Valid until:    2036-11-14
  SHA-256:        913b5b955914460612338f9468e8ae0bcb24a8a6904f137c684f7dbd9febb5ef

  To hand out (public):
    bastionxp-ca-data/root.crt          root certificate: install where the CA is trusted
    bastionxp-ca-data/intermediate.crt  intermediate certificate (sent with every certificate)
    bastionxp-ca-data/ssh_user_ca.pub   SSH user CA: TrustedUserCAKeys on SSH servers
    bastionxp-ca-data/ssh_host_ca.pub   SSH host CA: @cert-authority in known_hosts

  To move offline:
    bastionxp-ca-data/root.key          root key (encrypted)

  Kept by the server (secret, not encrypted; refer to the BastionXP CA documentation for more information):
    bastionxp-ca-data/intermediate.key  signs TLS certificates
    bastionxp-ca-data/ssh_user_ca.key   signs SSH user certificates
    bastionxp-ca-data/ssh_host_ca.key   signs SSH host certificates
    bastionxp-ca-data/token.key         signs one-time tokens

The root key is not needed to run the server. Move bastionxp-ca-data/root.key to offline
storage, keep a backup, and keep its passphrase in a password manager.

Clients trust this CA with:
  bxp trust --ca-url <address of this server> --fingerprint 913b5b955914460612338f9468e8ae0bcb24a8a6904f137c684f7dbd9febb5ef

The root key's passphrase must be at least 12 characters. Keep it in a password manager: you need it only when you use the root key again, for example to replace the intermediate.

The fingerprint

The SHA-256 line is the fingerprint of the root certificate. Clients use it to make sure they talk to your CA. Note it down; you can show it again any time with bxp fingerprint --config bastionxp-ca.yaml.

init lists every file it wrote, grouped by what to do with it:

File What it is
root.crt The root certificate. Machines that should trust the CA install it.
root.key The root private key, encrypted. Not needed to run the server: move it offline.
intermediate.crt, intermediate.key The intermediate CA, which signs all TLS certificates.
ssh_user_ca.key, ssh_user_ca.pub The SSH user CA.
ssh_host_ca.key, ssh_host_ca.pub The SSH host CA.
token.key Signs the one-time tokens.

2. Start the server

$ bxp serve --config bastionxp-ca.yaml
level=INFO msg="server started" address=:8443 names="[localhost 127.0.0.1]" oidc_login=false ldap_login=false acme=false scep=false root_fingerprint=913b5b955914460612338f9468e8ae0bcb24a8a6904f137c684f7dbd9febb5ef

The server issues its own TLS certificate from the CA at startup, for the names in server.names. Leave it running and open a second terminal.

3. Trust the CA (on the client)

$ bxp trust --ca-url https://localhost:8443 --fingerprint 913b5b955914460612338f9468e8ae0bcb24a8a6904f137c684f7dbd9febb5ef
Trusted:      https://localhost:8443
Root:         Example Root CA
SHA-256:      913b5b955914460612338f9468e8ae0bcb24a8a6904f137c684f7dbd9febb5ef
Saved in:     /home/alice/.config/bastionxp-ca

bxp trust downloads the root certificate, refuses it unless its fingerprint matches, checks that the server belongs to that root, and saves the address and the root. The other client commands use them from now on. See Trust the CA.

4. Get a TLS certificate

On the CA machine, the administrator creates a one-time token that allows one tls-server certificate for web.example.com:

$ bxp token --config bastionxp-ca.yaml --profile tls-server --name web.example.com
eyJhbGciOiJFUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJ...

On the web server, the requester uses it:

$ bxp tls --token eyJhbGciOiJFUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJ... --name web.example.com
Private key:  web.example.com.key
Certificate:  web.example.com.crt
Valid until:  2026-11-18 13:50 UTC

The private key was created on the requesting machine and never left it. web.example.com.crt holds the certificate followed by the intermediate, ready for nginx, Apache, HAProxy and others.

Check it:

openssl verify -CAfile bastionxp-ca-data/root.crt -untrusted web.example.com.crt web.example.com.crt

5. Get an SSH certificate

SSH certificates are for an SSH key you already have. If ~/.ssh/id_ed25519.pub does not exist yet, create it first:

ssh-keygen -t ed25519 -C "[email protected]"

(See Before you start: an SSH key for hardware keys, RSA and Windows.)

On the CA machine, a token for an SSH user certificate that may log in as alice:

bxp token --config bastionxp-ca.yaml --profile ssh-user --name alice

On Alice's machine, for her existing key:

$ bxp ssh --token <token> --key ~/.ssh/id_ed25519.pub
Certificate:  /home/alice/.ssh/id_ed25519-cert.pub
Principals:   alice
Valid until:  2026-11-18 05:50 UTC

ssh finds id_ed25519-cert.pub next to the key by itself. Servers accept it once they trust the CA's SSH user key:

On each SSH server
sudo cp ssh_user_ca.pub /etc/ssh/ssh_user_ca.pub
echo "TrustedUserCAKeys /etc/ssh/ssh_user_ca.pub" | sudo tee -a /etc/ssh/sshd_config
sudo systemctl reload sshd

6. See what the CA issued

$ bxp list certificates --config bastionxp-ca.yaml
SERIAL                                    PROFILE              VIA  NAMES                                           VALID UNTIL       STATUS
670965598395367721                        ssh-user             api  alice-95d9fac9b47a32d6075663878d9c1ab1 (alice)  2026-11-18 05:50  valid
3f9f71cf217f20c952283f4f8b5575c217d214ff  tls-server           api  web.example.com                                 2026-11-18 13:50  valid
239f9fb896d0e808a505839318ff3e501e307eba  bastionxp-ca-server  -    localhost, 127.0.0.1                            2026-11-18 13:50  valid

The last line is the server's own certificate.

What you have now

The Example Root CA signs the Example Intermediate CA, which signs web.example.com and the CA server certificate; the SSH user CA signs alice The Example Root CA signs the Example Intermediate CA, which signs web.example.com and the CA server certificate; the SSH user CA signs alice

Continue with Next steps to make this setup ready for real use.