Commit Graph

3 Commits

Author SHA1 Message Date
154872da9f feat(scripts): add idempotent 'harden' subcommand — key-only sshd + nft SSH-guard (ref #529)
After the wg-admin tunnel is confirmed working, 'harden' closes the
public SSH brute-force surface:
  - sshd drop-in: PasswordAuthentication no + PermitRootLogin
    prohibit-password (refuses if no root authorized_keys — no lockout).
  - nft SSH-guard: drop tcp/22 from sources outside the LAN (192.168.1.0/24)
    + 10.x tunnels, inserted BEFORE the blanket 'iif eth1 accept' so the
    router's port-forwarded public SSH (real public src IP, DNAT no-SNAT)
    is dropped while LAN + wg-admin stay reachable. Persisted in
    /etc/nftables.conf + applied live without flushing other tables.

Applied + verified on gk2: tunnel SSH (10.98.0.1) key-only works; public
admin.gk2.secubox.in:22 now times out. Tables (blacklist/wg) intact.
2026-06-12 15:09:00 +02:00
3c289c50b9 fix(scripts): local loop vars in write_server_conf so client $pip isn't clobbered (ref #529)
The while-read in write_server_conf reused the global pip/ppub names, so
after it ran the caller's $pip (the new peer IP for the client config)
was wiped to empty — the emitted client config showed 'Address = /32'.
The provisioned server state was always correct; only the printed config
was wrong. Loop now uses local _pn/_pip/_pub.
2026-06-12 14:49:38 +02:00
8f2a5c1608 feat(scripts): admin WireGuard tunnel setup script (wg-admin, ref #529)
Idempotent provisioner for a dedicated out-of-band admin tunnel,
distinct from wg-toolbox:
  - wg-admin UDP 51821, server 10.98.0.1/24, peers 10.98.0.2+/32.
  - generates server+peer keys once (0600, never in repo), writes
    /etc/wireguard/wg-admin.conf from a peers state file.
  - installs /etc/nftables.d/secubox-admin-wg.nft (allow udp/51821,
    persistent) — ADDITIVE, does not touch sshd or existing rules.
  - 'add <name>' mints a client .conf + QR (split-tunnel, endpoint
    admin.gk2.secubox.in:51821).
sshd hardening (key-only + restrict 22) is a deliberate separate step.
2026-06-12 14:47:21 +02:00