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`.
This commit is contained in:
d4nn13 committed 2026-04-19 18:55:36 +02:00
1 parent 2d07a590e2
commit 4e7e0f34ba
12 files changed
+543 -4

No files matched your search

+26
View File
@@ -0,0 +1,26 @@
#!/sbin/openrc-run
# wirecon web UI — busybox httpd serving /var/www/wirecon with CGI.
# Disable to save resources:
# rc-service wirecon-web stop && rc-update del wirecon-web
name="wirecon-web"
description="wirecon web UI (busybox httpd)"
# Pull WEB_PORT from wirecon.conf if present.
: "${WIRECON_CONF:=/etc/wirecon/wirecon.conf}"
[ -r "$WIRECON_CONF" ] && . "$WIRECON_CONF"
: "${WEB_PORT:=8080}"
: "${WEB_BIND:=0.0.0.0}"
: "${WEB_ROOT:=/var/www/wirecon}"
supervisor="supervise-daemon"
command="/bin/busybox"
command_args="httpd -f -v -p ${WEB_BIND}:${WEB_PORT} -h ${WEB_ROOT} -c /etc/wirecon/httpd.conf"
respawn_delay=5
respawn_max=0
output_log="/var/log/wirecon-web.log"
error_log="/var/log/wirecon-web.log"
depend() {
need net
}
+12
View File
@@ -0,0 +1,12 @@
# busybox httpd config for wirecon web UI.
#
# HTTP Basic Auth (recommended — the UI can edit wg0.conf):
# /:admin:$1$salt$hash
# Generate the hash with: openssl passwd -1 'your-password'
# Uncomment the line below and paste your hash. Restart: rc-service wirecon-web restart
#
# /:admin:REPLACE_WITH_HASH
# Treat scripts under /cgi-bin/ as CGI (busybox httpd does this by default,
# but being explicit doesn't hurt).
*.sh:/bin/sh
+6 -1
View File
@@ -30,8 +30,13 @@ MONITOR_INTERVAL=10
# Watchdog cadence (seconds between tick invocations by the loop wrapper)
WATCHDOG_INTERVAL=20
# Log tag (shows up as SYSLOG_IDENTIFIER in journald)
# Log tag (used by scripts when emitting structured lines)
LOG_TAG=wirecon
# Runtime state dir
STATE_DIR=/run/wirecon
# Web UI (busybox httpd). Disable to save resources:
# rc-service wirecon-web stop && rc-update del wirecon-web
WEB_PORT=8080
WEB_BIND=0.0.0.0