Skip to content

Using tokens

TLS

bxp tls --token "$TOKEN" --name web.example.com

See TLS certificates.

SSH

bxp ssh --token "$TOKEN" --key ~/.ssh/id_ed25519.pub                  # user
sudo bxp ssh --token "$TOKEN" --key /etc/ssh/ssh_host_ed25519_key.pub # host

See SSH user certificates and SSH host certificates.

SCEP

Put the token into the device's SCEP settings as the challenge password, or:

bxp scep enroll --token "$TOKEN" --name device1.example.com

See SCEP with a token.

From the environment

export BXP_TOKEN="$TOKEN"
bxp tls --name web.example.com

With curl

openssl req -new -newkey ec -pkeyopt ec_paramgen_curve:prime256v1 -nodes \
  -keyout web.key -out web.csr \
  -subj "/CN=web.example.com" -addext "subjectAltName=DNS:web.example.com"

jq -Rs '{csr: .}' web.csr |
  curl --cacert root.crt \
       -H "Authorization: Bearer $TOKEN" \
       -d @- https://ca.example.com:8443/v1/x509/sign |
  jq -r .chain > web.crt

See the HTTP API.

Errors

Error Meaning Token used up?
401 missing, invalid or expired token The token is wrong, expired, or from another CA. –
401 this token was already used One certificate per token. yes (by the earlier request)
403 a name is not in the token Ask only for names in the token. no
403 the token is for another kind of certificate e.g. a tls-server token at the SSH endpoint. no
400 the request is not sound No CSR or key, weak key, validity above the profile's maximum. no

A request that is refused for its names, its CSR or its key does not use up the token, so it can be corrected and sent again.