Run your own server
Looking after your server
Changes, backups, removing people and devices, updating the kit, and fixing connection problems.
After any change
Whenever you add or remove a user, a unit or a team, write the account files again and restart the server. Accounts are created when the server starts, so a change does nothing until you do.
python3 bastionctl.py --root ./data accounts write --dir .
docker compose up -d --force-recreate
To see every command the admin tool has:
python3 bastionctl.py --help
To see what's on the server:
python3 bastionctl.py --root ./data tree phoenix
python3 bastionctl.py --root ./data tree --user alice
What to keep safe
| What | Why |
|---|---|
hostkeys/ |
The server's identity. If it is lost or regenerated, every device stops with SERVER KEY MISMATCH, and each person has to delete the server in the app and add it again. |
data/registry.json |
Records every account and its password. Keep it private. |
users.conf |
Also holds every password. |
Connection cards and setup-<unit>/ |
Each card contains a password. |
data/ |
Your content. |
Back up
Back up the whole bastion-server folder: data/, hostkeys/, users.conf, bastion-perms.sh and the kit's own files.
To restore onto a new machine, copy the folder back and start the server:
docker compose up -d --force-recreate
Because hostkeys/ came back with it, the server has the same identity as before.
If the new machine has a different address, each person edits the server's Host in the app. The saved password is kept. Because the address changed, the app asks to verify the server again on the next sync. The fingerprint is the same one as before, the one on the card: check it and choose Trust & Sync.
The backup contains every password. Protect it accordingly.
Remove a device's share folder
When someone leaves a team, their device's share folder stays on the server. A lead or the gold admin can empty it from the app, but only the server can remove the folder.
List a team's device folders, with each device's callsign:
python3 bastionctl.py --root ./data lane list phoenix raptor
Remove one, using the folder name from that list:
python3 bastionctl.py --root ./data lane prune phoenix raptor d-1a2b3c4d
This deletes that device's share folder and everything in it. Content already published to the team or to gold is not touched.
Remove a team, a unit or a user
These delete content and can't be undone. Back up first.
python3 bastionctl.py --root ./data team remove phoenix viper
python3 bastionctl.py --root ./data unit remove phoenix --yes
python3 bastionctl.py --root ./data user remove alice --yes
Then write the account files and restart the server, as above.
Update the kit
When a new version of the BASTION app changes how sharing works, the kit is updated to match. To update:
Download the current server kit.
Replace
bastionctl.pyanddocker-compose.ymlin yourbastion-serverfolder with the new ones. Leavedata/,hostkeys/and everything else alone.Add any folders the new version has to your existing storage. It only creates what is missing and never changes or removes anything; add
--dry-runto see what it would do first:python3 bastionctl.py --root ./data layout updateWrite the account files and restart the server.
If a device can't connect
- Did you restart after the last change? Run
docker compose up -d --force-recreate. - Do the user name and root path match the card exactly? Both are case-sensitive.
- Is the server itself working? From the server, run
sftp -P 2222 alice@localhostwith that account's name. If it logs in, the server is fine: check the address and port on the device, and that the device is on a network that can reach the server. If it doesn't, look atdocker compose logs sftp. - "Permission denied" on a folder in a unit is usually the roles working. A team member, for example, never sees the unit share.
- SERVER KEY MISMATCH means the server's identity keys changed. If you restored
hostkeys/from a backup, restart the server. If the keys are gone for good, each person deletes the server in the app and adds it again.
If a file doesn't arrive
- It must be in the right folder, with a lowercase folder name.
- The account must be able to read it. A file copied in as root may not be readable: restart the server, which resets ownership.
- A replacement with the same name, the same size and an older date is not noticed. Rename it.