Skip to content

bxp ssh

Get an SSH certificate for an existing SSH key.

Usage

Ask the CA for an SSH certificate for an existing SSH public key and
write it next to the key, where OpenSSH looks for it:

  ~/.ssh/id_ed25519.pub   ->  ~/.ssh/id_ed25519-cert.pub

Only the public key is sent to the CA. An existing certificate file
is replaced, because SSH certificates are short-lived and renewed often.

With --token, the token decides whether this is a user or a host
certificate and which principals (login names or host names) are
allowed. Without one, your browser opens for a login with your
identity provider (or, with --ldap, you give your directory password),
and you get a user certificate with the principals the CA's rules
give you.

With --agent, the key and the certificate go into ssh-agent, for as
long as the certificate is valid. Without --key, a new key is made for
it, in memory only: nothing is written to disk.

Usage:
  bxp ssh [flags]

Examples:
  # a user certificate for yourself, with a login in the browser
  bxp ssh --ca-url https://ca.example.com:8443 --root root.crt \
      --key ~/.ssh/id_ed25519.pub

  # the same, with an Active Directory password
  bxp ssh --ldap --key ~/.ssh/id_ed25519.pub

  # into ssh-agent, with a new key that never touches the disk
  bxp ssh --agent

  # a user certificate with a token
  bxp ssh --ca-url https://ca.example.com:8443 --root root.crt \
      --token $TOKEN --key ~/.ssh/id_ed25519.pub

  # a host certificate
  bxp ssh --ca-url https://ca.example.com:8443 --root root.crt \
      --token $TOKEN --key /etc/ssh/ssh_host_ed25519_key.pub

Flags:
      --agent                   put the key and the certificate into ssh-agent (SSH_AUTH_SOCK), until the certificate expires
      --ca-url string           address of the CA server, e.g. https://ca.example.com:8443
                                (or BXP_CA_URL; default: the one saved by "bxp trust")
  -h, --help                    help for ssh
      --key string              path of the SSH public key, e.g. ~/.ssh/id_ed25519.pub
                                (with --agent: optional; without it, a new key is made in memory)
      --ldap                    log in with your directory (Active Directory) username and password instead of the browser
      --ldap-user string        the username for --ldap (default: your name on this machine)
      --password-stdin          with --ldap, read the password from the standard input instead of asking
      --principal stringArray   a login name or host name for the certificate (repeat for more; default: all the token allows)
      --profile string          ssh-user, ssh-host or one of the CA's SSH profiles. Only used without --token: a token already
                                says which (default: the profile the CA gives people for themselves at this login)
      --root string             path of the CA's root certificate, root.crt
                                (or BXP_ROOT; default: the one saved by "bxp trust")
      --token string            a one-time token (or BXP_TOKEN). Without one, you log in in your browser
      --validity duration       how long the certificate should be valid, e.g. 8h (default: decided by the CA)

Global Flags:
      --config string   path to the configuration file (default "bastionxp-ca.yaml")