Keys and secrets on the server
APP_KEY, VAULT_KEKS, the sign-in secrets and storage/keys: where they are, how to keep them safe, and what you never do.
Bugsoft Portal has a few keys and secrets that only exist on the server. This page says where they are, how to keep them safe, and when to change them. How the encryption works, and who can decrypt what, is on Encryption and keys.
Without APP_KEY and VAULT_KEKS, the saved passwords, the keys for
people's codes from an authenticator app that are saved with them, and the authenticator keys of the emergency accounts are
lost forever, even if you have a backup. They are deliberately not
in the backup. Put them in the password vault or secrets vault of IT right after the installation.
Where each secret is
| Secret | Where | In the backup? |
|---|---|---|
APP_KEY | The configuration file (/etc/bugsoft/bugsoft.env with install.sh, otherwise .env) | No |
VAULT_KEKS and VAULT_KEK_ACTIVE | The configuration file | No |
DB_PASSWORD, MAIL_PASSWORD, CRON_TOKEN, ASSISTANT_AI_KEY | The configuration file. With install.sh and MariaDB on the same server, the database password is also in /etc/bugsoft/db-password. | No |
The client secrets for sign-in (ENTRA_CLIENT_SECRET, SSO_<KEY>_SECRET) | The configuration file, or encrypted in the database if you enter them on Connections (Sign-in and sign-in systems) | Only encrypted, with the database |
| The Bugsoft Connect key | storage/keys/ (with install.sh: /var/lib/bugsoft/keys/) | Yes, in the storage part of the backup |
Secrets from a file
Every secret can also come from a file. Set <NAME>_FILE=/path/to/file instead of the value, for example
APP_KEY_FILE or DB_PASSWORD_FILE. This works for APP_KEY, VAULT_KEKS,
DB_PASSWORD, ENTRA_CLIENT_SECRET, CRON_TOKEN, MAIL_PASSWORD,
ASSISTANT_AI_KEY and the SSO_<KEY>_SECRET secrets.
So a secret never has to exist as an ordinary environment variable. This is useful with Docker and Kubernetes secrets.
APP_KEY
The main key of the installation. Bugsoft Portal derives separate keys from it for the sessions, the authenticator keys of the emergency accounts, the audit log check, and the secrets you enter on the web page.
- A new installation makes it itself (install.sh, the installation wizard or
sudo bugsoft key:generate). - Do not change it without a good reason. After a new
APP_KEY: everyone must sign in again, the emergency accounts must link their authenticator again, the audit log starts a new chain, and you enter the secrets on Connections again. Only change it after a leak, in a maintenance window; see Encryption and keys. - A test environment gets its own
APP_KEY, never the one of production (A test environment and production).
VAULT_KEKS and VAULT_KEK_ACTIVE
The keys for the saved sign-in details: employees' own passwords, shared logins for everyone and the formulas on tiles. KEK means "key encryption key": a key that protects other keys.
VAULT_KEKSis a list ofnumber:key, separated by commas, for example1:…,2:….VAULT_KEK_ACTIVEis the number that Bugsoft Portal uses now for new encryption.
To change the key:
- Make a new key:
sudo bugsoft vault:keygen. - Add it at the end of
VAULT_KEKSwith the next number, and setVAULT_KEK_ACTIVEto that number. - Encrypt everything again:
sudo bugsoft vault:rotate-kek. - Only remove the old key when nothing uses it any more. Keep it with the old backups: they need it.
You see the status in Admin › Settings › System › System status, under Keys for sign-in details (KEK).
The sign-in secrets
You enter the client secret of Microsoft Entra ID or another sign-in system in Admin › Settings › Sign-in ›
Connections. Bugsoft Portal then stores it encrypted with APP_KEY.
If the secret is also in the configuration file (ENTRA_CLIENT_SECRET or SSO_<KEY>_SECRET) or
in a _FILE, that one wins. You can then only see it on the page, not change it. Also enter the expiry date:
administrators get an e-mail before the secret expires. See Sign in with Microsoft Entra ID.
storage/keys
This folder holds the key with which the server signs your own Bugsoft Connect package. The extension ID of that package depends on it: a new key gives a new ID, and then IT must change the policy on every PC. That is why this folder is in the backup.
Bugsoft Portal makes the key itself, the first time someone opens Admin › Settings › Bugsoft Connect or a
browser asks for an update. To see the ID and the values for Intune on the server: sudo bugsoft vault:knop-key.
Only change the key after misuse (--rotate); see Your server's own package.
Keep the keys safe
- After an installation with install.sh, the keys are also in
/root/bugsoft-sleutels.env. Put them in the vault and confirm withsudo bugsoft keys; the file is then deleted. See Backups and restoring. - Do not keep the keys in the same place as the database backups: whoever has both can read all saved passwords.
- The configuration file must only be readable by its owner (
chmod 600) and be outside the web folder.production:checkchecks this (Check and monitor the server). - Never send keys with a support question. The vendor never asks for them (Get help and support details).
Stuck? See Questions and problems or contact Bugsoft at ugurs156@gmail.com.