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

+22 -5
View File
@@ -2,10 +2,11 @@
# block is required. Every setting is explained in the README.
# --- Required ----------------------------------------------------------
# Generate with: bin/rails secret (or: openssl rand -hex 64)
# Keep a copy somewhere safe off the server: signatures and stored secrets
# depend on it, and a restore needs the same one.
SECRET_KEY_BASE=change-me
# Generate with: bin/rails secret (or: openssl rand -hex 64). Anyone who knows
# it can sign in as anyone, so the app won't start with a placeholder or a
# short one. Keep a copy somewhere safe off the server: signatures and stored
# secrets depend on it, and a restore needs the same one.
SECRET_KEY_BASE=
# The host name people use to reach the app (used in email links).
APP_HOST=aircraft.example.com
@@ -13,9 +14,20 @@ APP_HOST=aircraft.example.com
# their own zone, from Profile or their device). Default UTC.
# TZ=America/New_York
# true: the app redirects to HTTPS and sets secure cookies (use behind a TLS
# proxy such as Traefik, Caddy or Cloudflare Tunnel). false: plain HTTP on a LAN.
# proxy such as Traefik, Caddy or Cloudflare Tunnel, or with TLS_DOMAIN).
# false: plain HTTP, only on a private network: passwords travel unencrypted.
FORCE_SSL=true
# --- HTTPS without a proxy (docker-compose.direct.yml) -------------------
# The app gets a Let's Encrypt certificate for this name itself (ports 80
# and 443 must reach it).
# TLS_DOMAIN=aircraft.example.com
# --- Allowed addresses ---------------------------------------------------
# Requests are answered only for APP_HOST (and the APP_URL host), localhost
# and IP addresses. Other names that should work, comma-separated:
# ALLOWED_HOSTS=sam.lan,aircraft.home.arpa
# --- Address -----------------------------------------------------------
# Full public URL, if it isn't https://APP_HOST (used for the single sign-on
# and Google Drive redirect URIs).
@@ -37,6 +49,11 @@ FORCE_SSL=true
# OIDC_AUTO_CREATE_USERS=false # true: create an account at first sign-in
# OIDC_TRUST_EMAIL=false # true: link accounts by unverified email
# OIDC_ADMIN_GROUP= # members become admins (synced at sign-in)
# --- AirTrail ------------------------------------------------------------
# AirTrail servers on your private network that everyone may connect to
# (admins can always use private addresses), comma-separated host names:
# AIRTRAIL_ALLOWED_HOSTS=airtrail.lan
# PASSWORD_LOGIN=true # false: SSO only (invited mechanics then can't sign in)
# --- Sign-in security ----------------------------------------------------