Commit Graph

8 Commits

Author SHA1 Message Date
grabowski 0ceee55f9b Replace SvelteKit CSRF with custom multi-origin check
Deploy to LXC / deploy (push) Successful in 19s
SvelteKit's built-in CSRF only allows one origin, breaking access via
NetBird/Yggdrasil/Tor IPs. Now:
- Disabled checkOrigin in svelte.config.js
- Custom CSRF in hooks.server.ts checks Origin against ALLOWED_ORIGINS
- ALLOWED_ORIGINS env var: comma-separated list of trusted origins
- Caddy no longer needs to rewrite Host/Origin headers
- Each access method (public domain, NetBird IP, Yggdrasil, Tor onion)
  just needs its URL added to ALLOWED_ORIGINS

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-13 14:23:02 +07:00
grabowski dbc140c1f9 Fix CSRF 403: override Origin header in Caddy proxy snippet
Deploy to LXC / deploy (push) Successful in 18s
SvelteKit checks the browser's Origin header, not just Host or
X-Forwarded-Proto. Rewrite Origin to https://collection.newedge.house
so CSRF passes on all non-public routes (NetBird, Yggdrasil, Tor).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-13 14:18:56 +07:00
grabowski d41ff1112d Fix Caddy proxy: hardcode X-Forwarded-Proto to https on all routes
Deploy to LXC / deploy (push) Successful in 18s
SvelteKit expects ORIGIN=https://... so all routes must send
X-Forwarded-Proto: https regardless of actual connection scheme.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-13 14:15:02 +07:00
grabowski 392747e639 Update Caddy guide: upstream TLS, NetBird, Tor, Yggdrasil
Deploy to LXC / deploy (push) Successful in 19s
Rewritten for the actual architecture: separate upstream Caddy handles
TLS for public domain, LXC Caddy only does HTTP. Added NetBird
interface binding, explicit per-interface blocks, upstream Caddy
config snippet.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-13 14:08:28 +07:00
grabowski e6c213f35c Add Caddy reverse proxy guide for internal, Tor, and Yggdrasil access
Deploy to LXC / deploy (push) Successful in 20s
Caddyfile config with shared proxy snippet that sets Host header for
CSRF compatibility. Handles:
- Public domain with auto HTTPS (Let's Encrypt)
- LAN/internal on port 80
- Tor hidden service via localhost:8880
- Yggdrasil IPv6 on port 80

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-13 14:02:01 +07:00
grabowski c12f727734 Update deploy workflow for private repo with deploy keys
Deploy to LXC / deploy (push) Successful in 19s
Two SSH keys needed:
- DEPLOY_KEY: CI runner → LXC server (SSH access)
- REPO_DEPLOY_KEY: LXC server → Gitea repo (git pull access)

Workflow writes the repo deploy key to ~/.ssh on the server and
configures SSH to use it for git.b4l.co.th. Handles first deploy
(clone) and subsequent deploys (pull) automatically.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-07 16:26:04 +07:00
grabowski 12a6e9ef0b Add Gitea Actions workflow for auto-deploy to LXC on push
Deploy to LXC / deploy (push) Failing after 6s
SSH-based deploy: git pull, npm ci, build, db:push, systemctl restart.
Secrets configured in Gitea repo settings (DEPLOY_HOST, DEPLOY_USER,
DEPLOY_KEY). Includes setup guide in docs/ci-deploy-setup.md.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-07 16:07:12 +07:00
grabowski eac11c3a24 Add Proxmox LXC deployment guide
Covers NixOS LXC (recommended, uses the flake module) and Debian/Ubuntu
LXC (traditional setup). Includes PostgreSQL setup, systemd service,
nginx reverse proxy, backup strategies, and update instructions.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-07 13:30:52 +07:00