Harden installs reachable from the internet without a proxy

- Refuse to start with a placeholder or short SECRET_KEY_BASE (under 32
  characters); warn and fail sam:doctor under 64. .env.example no longer
  ships a placeholder.
- First-run setup needs a one-time code printed only in the server log, so
  only whoever runs the server can create the admin account.
- AirTrail: the server resolves the address and connects to exactly that;
  never the server itself or link-local addresses (cloud metadata);
  private-network addresses only for admins or hosts in
  AIRTRAIL_ALLOWED_HOSTS.
- Host authorization when APP_HOST is set: APP_HOST, the APP_URL host,
  ALLOWED_HOSTS, localhost and IP addresses; /up exempt. A blocked name
  gets a short explanation instead of a blank 403.
- docker-compose.direct.yml: HTTPS without a proxy via Thruster's built-in
  Let's Encrypt (TLS_DOMAIN).
- Notes' Markdown no longer allows the unused class attribute.
- README, .env.example and the user guide updated.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
rickyandClaude Opus 5.5 committed 2026-11-14 12:42:53 -05:00
1 parent faae719b12
commit 5876c07a1a
20 files changed
+319 -29

No files matched your search

+1 -1
View File
@@ -103,7 +103,7 @@ Run on the server like the account recovery commands (`docker compose exec web`
| Command | What it does |
|---|---|
| `bin/rails sam:doctor` | Health report: secret key, address, HTTPS, email (SMTP reachable), single sign-on (issuer reachable), Google Drive, migrations, disk space, background jobs, and how recent the backup, records check, off-site copy, procedures and audit are. Exits non-zero if something fails |
| `bin/rails sam:doctor` | Health report: secret key (set and long enough), address, HTTPS, email (SMTP reachable), single sign-on (issuer reachable), Google Drive, migrations, disk space, background jobs, and how recent the backup, records check, off-site copy, procedures and audit are. Exits non-zero if something fails |
| `bin/rails records:check` | Backs up the database now and checks the record history and every signature; prints any problems and exits non-zero |
| `bin/rails backups:list` | Lists the nightly database copies |
| `bin/rails "backups:restore[file]"` | Replaces the database with a backup (newest nightly copy if no file; a Google Drive `.sqlite3.gz` works too). The app must be stopped: `docker compose stop web`, then `docker compose run --rm web bin/rails backups:restore`. The current database is moved to `storage/pre-restore-…`, never deleted. `CONFIRM=yes` skips the question |
+1 -1
View File
@@ -12,7 +12,7 @@ If you've set up an authenticator app (see [Your profile](profile.md#two-factor-
After 10 failed tries in a row (wrong passwords or codes), an account is locked for 15 minutes and its owner is emailed. Wait, or ask the administrator to unlock it.
The very first visit to a new installation asks for the administrator account instead.
The very first visit to a new installation asks for the administrator account instead. It also asks for a one-time setup code, which is printed only in the server's log (the line starting `Setup code`; with Docker, `docker compose logs web | grep "Setup code"`), so only whoever runs the server can create that account.
## Roles
+2
View File
@@ -55,3 +55,5 @@ Turn it on on each phone or computer you want them on; **Send a test** checks it
## Integrations: AirTrail
**AirTrail sync** pushes the flights you log to your AirTrail flight map, with their GPS tracks. In AirTrail, create an API key (Settings → Security) with the scopes shown, then paste your AirTrail address and key here. A full sync first links flights already in AirTrail, so nothing is duplicated. If an airport code can't be matched, enter the code AirTrail uses for it.
If your AirTrail server is on your private network (an address like 192.168.x.x or 10.x.x.x), only an administrator can connect to it, unless the administrator lists it in `AIRTRAIL_ALLOWED_HOSTS`. This stops accounts from using the app to probe the private network. The app's own server and link-local addresses can't be used at all.