Configuration¶
This page describes every setting in BastionXP's configuration file. It also explains the settings that most installations need to change, with examples that you can copy.
You need to edit the configuration file only a few times: when you install BastionXP, and when you change how it connects to its database, its keys or its network. You manage everything else, such as certificate authorities, verifiers, certificate profiles and users, in the web portal.
The configuration file¶
BastionXP reads its settings from the file /etc/bastionxp/config.yaml. The file is written in YAML. BastionXP does not start without it.
To use a different file, start BastionXP with the --config option:
After you change the file, restart BastionXP so that it reads the new settings:
A misspelled setting stops BastionXP
BastionXP checks every setting in the file when it starts. If the file contains a setting that BastionXP does not know, BastionXP does not start. It writes a message that names the setting, so that a spelling mistake is never ignored. Run sudo journalctl -u bastionxp -n 20 to read the message.
Certificate authorities are not in this file
You create certificate authorities and their verifiers in the web portal. BastionXP keeps them in its database. If you add an authorities setting to the configuration file, BastionXP refuses to start. See Certificate authorities.
The smallest configuration¶
This is the smallest configuration that works. It has the three settings that every installation needs.
email: [email protected]
domain: ca.example.com
kek_file: /etc/bastionxp/kek
| Setting | What it means |
|---|---|
email |
The email address of the first administrator of the web portal. BastionXP creates this account when it starts for the first time. The setting is required. See Sign in and set up your account. |
domain |
The DNS name of your BastionXP server, for example ca.example.com. BastionXP writes it into the addresses in the certificates it issues, such as the CRL and OCSP addresses. It also uses it in the links it shows in the portal. The default is localhost, which is only suitable for a test. |
kek_file |
The path of the key-encryption key (KEK). BastionXP uses the KEK to encrypt the private keys and secrets in its database. BastionXP does not start without a KEK. See Key protection. |
We also recommend that you set org_name, the name of your organization. BastionXP writes it into every certificate that it issues. If you leave it out, the name is empty until you set it in the portal, under Settings → Organization. Set it before you create your first authority.
All settings¶
The tables below list every setting, with its default value. A setting that you leave out uses its default.
Server¶
| Setting | Default | What it means |
|---|---|---|
domain |
localhost |
The DNS name of the server. Use the name that your devices and users will use to reach BastionXP. |
https_port |
443 |
The TCP port of the web portal, the API and the certificate protocols (ACME and SCEP). Use a higher port, such as 8443, if a reverse proxy runs in front of BastionXP. |
http_port |
80 |
The TCP port of the plain HTTP server. It serves only the CRLs, the OCSP responder and the CA certificates. See Why BastionXP also listens on HTTP. |
data_dir |
/var/lib/bastionxp |
The folder where BastionXP keeps its data. With SQLite, the database is in this folder. The server's own HTTPS certificate and key are also in it. |
org_name |
empty | The name of your organization, for example Example Corporation. BastionXP writes it into the Organization (O) field of the certificates it issues. BastionXP reads this setting only when it starts for the first time. After that, you change the name in the portal, under Settings → Organization. |
rsa_enabled |
false |
Allows RSA keys for the root CA and for authorities. Without it, BastionXP uses ECDSA keys. BastionXP reads this setting only when it starts for the first time. After that, you change it in the portal, under Settings → Organization. |
The server's HTTPS certificate¶
| Setting | Default | What it means |
|---|---|---|
lets_encrypt_server_cert |
false |
Set it to true to let BastionXP get and renew its HTTPS certificate from Let's Encrypt. |
tls_cert_file |
server.crt |
The name of the certificate file, inside data_dir. Give a file name, not a full path. |
tls_priv_key_file |
server.key |
The name of the private key file, inside data_dir. Give a file name, not a full path. |
Keys¶
| Setting | Default | What it means |
|---|---|---|
kek_file |
none | The path of the key-encryption key. If you leave it out, BastionXP looks for a systemd credential named kek. See Key protection. |
kek_previous_file |
none | The path of the old KEK, while you rotate to a new one. BastionXP uses it only to decrypt. See Rotate the KEK. |
kms |
none | Keeps the CA keys in a hardware security module or in a cloud key management service, instead of in the database. See Key protection. |
Database and Redis¶
| Setting | Default | What it means |
|---|---|---|
database |
SQLite in data_dir |
Connects BastionXP to a PostgreSQL database. See Use PostgreSQL. |
redis |
none | Connects BastionXP to Redis. You need Redis only when you run several BastionXP servers together. See High availability. |
Web portal sign-in¶
| Setting | Default | What it means |
|---|---|---|
email |
none | The email address of the first administrator. The setting is required. |
dashboard_oidc |
none | Makes the web portal's administrators sign in with your company's identity provider. See Single sign-on for the portal. |
Audit, log and metrics¶
| Setting | Default | What it means |
|---|---|---|
audit |
database only | Also sends the audit log to a syslog server. See Audit logging. |
log |
text, info |
The format and the level of the server's log. See The log. |
metrics |
off | Turns on an endpoint for Prometheus. See Monitoring. |
Advanced¶
You normally leave these settings at their defaults. The BastionXP packages set them correctly.
| Setting | Default | What it means |
|---|---|---|
web_app_dir |
/var/lib/bastionxp/webapp/dist |
The folder that holds the files of the web portal. |
binary_download_path |
/var/lib/bastionxp/download |
The folder that BastionXP serves at https://<domain>/download. It holds the bxp-cli client programs. |
The server's HTTPS certificate¶
BastionXP serves its web portal and its API over HTTPS, so it needs a certificate and a private key for its own domain name. You have two choices.
Option 1: Use your own certificate¶
Get a certificate for your domain name from your company's PKI or from a public certificate authority. Copy the certificate and its private key into BastionXP's data directory, with these names:
Make the key readable only by its owner:
If the files are missing, or if they are not a matching certificate and key, BastionXP does not start. It writes a message that names the files.
BastionXP reads the files when it starts. When you replace an expiring certificate, copy in the new files and restart BastionXP.
Option 2: Let BastionXP get a certificate from Let's Encrypt¶
If your domain name is public, for example ca.example.com, BastionXP can get its certificate from Let's Encrypt and renew it by itself. You do not need server.crt and server.key in this case.
email: [email protected]
domain: ca.example.com
kek_file: /etc/bastionxp/kek
lets_encrypt_server_cert: true
Open TCP port 80
Let's Encrypt connects to your server on TCP port 80, to check that you own the domain name. Open the port on your firewall, and point the domain name to the server.
Browsers and the bxp-cli client trust Let's Encrypt certificates without any extra step.
Why BastionXP also listens on HTTP¶
BastionXP listens on two ports. HTTPS (https_port, 443 by default) serves the portal, the API, ACME and SCEP. Plain HTTP (http_port, 80 by default) serves only the information that other computers need to check a certificate:
- the certificate revocation lists (CRLs),
- the OCSP responder, and
- the CA certificates.
This is intentional. The certificates that BastionXP issues contain http:// addresses for these three things. The responses are signed, so plain HTTP does not weaken them. Plain HTTP also avoids a problem that HTTPS would cause. A client that checks a certificate would first have to check the revocation of the HTTPS server's own certificate, and that check would need HTTPS again.
Leave TCP port 80 open to every computer that needs to check certificates. If you change http_port, the addresses in the certificates still say port 80. Change it only when a reverse proxy forwards port 80 to the new port.
Use PostgreSQL¶
By default, BastionXP keeps its data in a SQLite database file in data_dir. SQLite is simple, and it is suitable for a single server.
Use PostgreSQL in production. You also need PostgreSQL when you run several BastionXP servers together. Add a database section:
email: [email protected]
domain: ca.example.com
kek_file: /etc/bastionxp/kek
database:
driver: postgres
hostname: db.example.com
port: "5432"
db_name: bastionxp
user: bastionxp
password: change-this-password
ssl_mode: verify-full
| Setting | What it means |
|---|---|
driver |
Set it to postgres. Any other value means SQLite. |
hostname, port |
The address of the PostgreSQL server. Write the port in quotes. |
db_name |
The name of the database. Create the empty database before you start BastionXP. BastionXP creates its tables when it starts. |
user, password |
The database account that BastionXP uses. |
ssl_mode |
How BastionXP protects the connection. It takes PostgreSQL's own values: disable, require, verify-ca or verify-full. Use verify-full in production. |
The database holds the private keys of your certificate authorities, but only in encrypted form. They are encrypted with the key-encryption key, which is not in the database. See Key protection.
See High availability to learn how to run several servers with PostgreSQL and Redis.
The log¶
BastionXP writes its log to its standard error output, like other modern services. When BastionXP runs as a systemd service, the system journal collects the log. Read it with:
The log setting controls the format and the level:
| Setting | Values | What it means |
|---|---|---|
format |
text (default), json |
Use json to write one JSON object per line. Log collectors such as Elastic, Loki and Splunk read this format easily. |
level |
debug, info (default), warn, error |
The least important messages that BastionXP writes. Use debug only while you investigate a problem. |
You can also set the format and the level with the environment variables BASTIONXP_LOG_FORMAT and BASTIONXP_LOG_LEVEL. When an environment variable is set, it overrides the configuration file.
The log is for the people who run the server. It tells you how the server is doing. The audit log is a different record. It tells you who did what, and it is the record to keep for your compliance needs.
A complete example¶
This example puts the most common settings together. Remove the sections that you do not need.
# The first administrator of the web portal.
email: [email protected]
# The server's DNS name and ports.
domain: ca.example.com
https_port: 443
http_port: 80
# The name written in the certificates.
org_name: Example Corporation
# Where BastionXP keeps its data, and its key-encryption key.
data_dir: /var/lib/bastionxp
kek_file: /etc/bastionxp/kek
# Let BastionXP get its own HTTPS certificate.
lets_encrypt_server_cert: true
# PostgreSQL, instead of SQLite.
database:
driver: postgres
hostname: db.example.com
port: "5432"
db_name: bastionxp
user: bastionxp
password: change-this-password
ssl_mode: verify-full
# Send the audit log to your syslog server, too.
audit:
backends: [db, syslog]
syslog_network: tcp
syslog_address: siem.example.com:514
log:
format: json
level: info
Where to go next¶
- Certificate authorities explains how to create authorities and verifiers in the portal.
- Key protection explains the key-encryption key, hardware security modules and cloud key management services.
- High availability explains how to run several servers.
- Backup and restore explains how to protect your data.
- Monitoring explains the health check and the metrics.
If you have questions or suggestions, write to [email protected].