Commit Graph
3 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
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