Skip to content

Uninstall BastionXP - Clean Up

This page explains how to remove BastionXP from a server, and how to clean up everything that it leaves behind. It is useful when you tried BastionXP, and you want to start again from the beginning.

This cannot be undone

The data directory holds your certificate authorities and their keys. The key-encryption key decrypts them. If you delete them, you lose every certificate authority, and every certificate that BastionXP issued can no longer be renewed or revoked.

Do this only on a test installation. If you run BastionXP in production, first make a backup, and keep the backup and the key-encryption key.

Stop and remove the software package

Stop the service, and remove the package.

Debian and Ubuntu

sudo systemctl stop bastionxp
sudo apt remove bastionxp

RPM-based systems

sudo systemctl stop bastionxp
sudo rpm -e bastionxp

Removing the package does not delete your data and your settings. This is on purpose, so that you do not lose them if you remove the package by mistake. To start from the beginning, remove them yourself, as described below.

Delete the data directory

BastionXP keeps its data in the data directory, /var/lib/bastionxp by default. It holds the database, the server's HTTPS certificate and key, and the files of the web portal.

If you changed the data_dir setting, delete that directory.

sudo rm -rf /var/lib/bastionxp

If you use PostgreSQL, the database is not in the data directory. Drop the database in PostgreSQL as well, or delete its tables.

Delete the configuration and the key-encryption key

BastionXP keeps its configuration file, config.yaml, in /etc/bastionxp. The key-encryption key is usually there too, as kek.

sudo rm -rf /etc/bastionxp

If you put the key-encryption key somewhere else, delete it there. If you use a systemd credential for it, remove the credential file and the LoadCredentialEncrypted line of the service. See Key protection.

Delete the client's files

On every machine where you ran the bxp-cli client, the client keeps its files in ~/.bxp-cli, in the home folder of each user. To make a machine forget the CA, delete the folder:

rm -rf ~/.bxp-cli

If you also added the root CA's certificate to the system trust store, remove it there. On Debian and Ubuntu:

sudo rm /usr/local/share/ca-certificates/bastionxp-ca.crt
sudo update-ca-certificates --fresh

Start again

Install the package, and follow Getting started. You will create a new key-encryption key, a new root CA and new authorities. Certificates from your earlier installation are not trusted by the new one.