Commit Graph
16 Commits
Author SHA1 Message Date
d4nn13andClaude Opus 4.7 b27ca6b989 rewrite CGI scripts in POSIX sh
Busybox httpd runs CGI under ash regardless of #!/bin/bash, so bash-only
constructs — arrays (restart=()), [[ ]], =~, <<< — all broke at runtime
with "syntax error: unexpected (" / "unexpected redirection" messages
visible in the httpd log.

Switched all four CGIs (status, config-get, config-save, logs) to
#!/bin/sh with POSIX-only constructs: space-separated strings instead of
arrays, [ ] instead of [[ ]], parameter expansion + awk instead of =~
regex, printf '%s\n' … | awk instead of herestrings.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-19 19:56:34 +02:00
d4nn13andClaude Opus 4.7 e9256e6389 detach service restarts from config-save CGI
Saving wg0.conf via the web UI restarts wg-quick + watchdog + monitor
serially. wg-quick's down/up can take long enough that busybox httpd
closes the HTTP socket first, which the browser reports as "Failed to
fetch" even though the file was saved.

Move the restart loop into a detached background process, log its
output to /var/log/wirecon-restart.log (with per-service timeout 20s),
and have the CGI return the save confirmation immediately. The new log
is also servable via logs.sh?service=restart.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-19 19:49:12 +02:00
d4nn13andClaude Opus 4.7 4cb36b7807 mkdir /usr/local/sbin before writing autologin wrapper
Alpine's base image doesn't create /usr/local/sbin, so the heredoc
failed with "can't create /usr/local/sbin/autologin-root: nonexistent
directory" on fresh containers.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-19 19:45:13 +02:00
d4nn13andClaude Opus 4.7 78c3a790be auto-start services, prompt for WG + LAN nets, fix busybox httpd applet
- create-lxc.sh prompts for WIRECON_NET / PEER_IP / CLIENT_IP / LAN_CIDR
  (defaults 10.13.13.0/24, .1, .2, 192.168.1.0/24) and passes them through
  to the in-container bootstrap
- install.sh generates a placeholder /etc/wireguard/wg0.conf from those
  env vars instead of copying the static example, and updates PEER_IP in
  wirecon.conf on first install
- install.sh always enables + starts wg-quick, watchdog, monitor and
  (if WIRECON_WEB_AUTOSTART=yes, default yes) the web UI, even before
  keys are filled in — wg-quick will fail until then, and the web UI
  is the way to finish configuration
- apk installs busybox-extras and wirecon-web now runs /usr/sbin/httpd
  (fixes "httpd: applet not found" on base busybox)
- create-lxc.sh drops its own web-UI start block (install.sh owns it)

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-19 19:41:44 +02:00
d4nn13 14fad9a49e create-lxc: fix tty1 auto-login regex (Alpine uses empty id field)
The previous sed pattern required ^tty1::respawn: but Alpine's LXC
inittab has no id field — the line is ::respawn:/sbin/getty 38400 tty1.
Match any line containing "getty.*tty1$" instead, and pkill getty after
the reload so init respawns with the new command.
2026-04-19 19:34:13 +02:00
d4nn13 33d713f95b install nano + set it as default EDITOR/VISUAL 2026-04-19 19:20:24 +02:00
d4nn13 4c9df1941d create-lxc: drop sshd, enable tty1 auto-login instead
Access is now via the Proxmox web Console (or pct enter) — no SSH,
no keys, no passwords. /etc/inittab's tty1 line is rewritten to
`getty -n -l /usr/local/sbin/autologin-root` which execs `login -f root`,
dropping straight into a root shell when the Console button is clicked.
2026-04-19 19:19:07 +02:00
d4nn13 1ab70a6f9a create-lxc: replace password flow with passwordless SSH key injection
Always authorize the Proxmox host's root pubkey (generate an ed25519
pair if missing) so `ssh root@<lxc>` from the host works immediately.
Extra keys via SSH_PUBKEY (literal or path). Relies on Alpine's default
PermitRootLogin=prohibit-password — no sshd_config edits, no password
ever set; pct enter stays as fallback.
2026-04-19 19:15:46 +02:00
d4nn13 d6e846c7a0 create-lxc: prompt for web UI autostart, enable it by default 2026-04-19 19:11:47 +02:00
d4nn13 eaca8305ae create-lxc: prompt for root password, enable sshd when set
Accepts ROOT_PASSWORD from env or reads from /dev/tty (works under
curl|bash). When set, pipes it through `chpasswd` via stdin (secret
stays out of argv) and installs+enables openssh with PermitRootLogin
yes. Skipping leaves the prior no-password behavior intact so pct
enter remains the fallback.
2026-04-19 19:11:01 +02:00
d4nn13 4e7e0f34ba add optional web UI: busybox httpd + shell CGI, dark theme
- /etc/init.d/wirecon-web supervises `busybox httpd` on WEB_PORT (8080).
- /var/www/wirecon: single-page UI with Status / Config / Logs tabs.
  - Status auto-refreshes every 5s: service states + wg0 endpoint,
    handshake age, MTU, rx/tx.
  - Config edits wg0.conf + wirecon.conf, saves atomically, restarts
    dependents, surfaces their output.
  - Logs tails /var/log/wirecon-{watchdog,monitor}.log.
- CGI returns plain text (key=value or raw) — no JSON-escape pain.
- HTTP Basic Auth template in /etc/wirecon/httpd.conf.
- Disable via `rc-service wirecon-web stop && rc-update del wirecon-web`.
2026-04-19 18:55:36 +02:00
d4nn13 2d07a590e2 scope down to LXC client side only; drop docker/ server tree
The server side is out of scope — this repo now ships only the Alpine
LXC tooling (installer, OpenRC watchdog/monitor, MTU probe) and the
Proxmox-host creator. Rewrite the README around that focus.
2026-04-19 18:47:06 +02:00
d4nn13 810bad6ea5 docs: drop LXC-side bootstrap one-liner, Proxmox creator is the single entrypoint 2026-04-19 18:43:26 +02:00
d4nn13 5b9abdae08 port LXC side to Alpine/OpenRC, add Proxmox host-side creator
- Replace systemd units with OpenRC init scripts (supervise-daemon)
- Add wirecon-watchdog-loop.sh since OpenRC has no timers
- Switch install.sh to apk + rc-update
- Update bootstrap.sh to install git/bash via apk
- New proxmox/create-lxc.sh: picks next VMID, downloads Alpine template,
  creates unprivileged LXC with tun passthrough, chains bootstrap
- Rewrite README around the Proxmox one-liner flow
2026-04-19 18:40:55 +02:00
d4nn13 390e10b06d add README with install one-liner and architecture overview 2026-04-19 18:28:28 +02:00
d4nn13 49b01dfcd3 initial commit: wirecon WireGuard stack
Rootless-Docker server (wireguard-go + Caddy sharing netns) and
unprivileged-LXC client (kernel WG + systemd watchdog/monitor/MTU-probe)
with curl-pipeable bootstrap. Tuned for Telekom DSL/LTE Hybrid uplinks.
2026-04-19 18:20:21 +02:00