diff --git a/lxc/etc/wirecon/wirecon.conf b/lxc/etc/wirecon/wirecon.conf
index e17d5ab..2a77a20 100644
--- a/lxc/etc/wirecon/wirecon.conf
+++ b/lxc/etc/wirecon/wirecon.conf
@@ -27,6 +27,12 @@ MTU_MAX=1420
# Monitor cadence (seconds between log emissions)
MONITOR_INTERVAL=10
+# Quiet mode: when MONITOR_QUIET=yes, the monitor uses MONITOR_QUIET_INTERVAL
+# instead of MONITOR_INTERVAL and suppresses info-level lines (warn/error
+# still emit). Toggle from the web UI's Status tab once the link is stable.
+MONITOR_QUIET=no
+MONITOR_QUIET_INTERVAL=60
+
# Watchdog cadence (seconds between tick invocations by the loop wrapper)
WATCHDOG_INTERVAL=20
diff --git a/lxc/install.sh b/lxc/install.sh
index 9a7db8d..5ebac3b 100755
--- a/lxc/install.sh
+++ b/lxc/install.sh
@@ -80,6 +80,8 @@ install -m 0755 "$SRC/var/www/wirecon/cgi-bin/status.sh" /var/www/wirecon/c
install -m 0755 "$SRC/var/www/wirecon/cgi-bin/config-get.sh" /var/www/wirecon/cgi-bin/
install -m 0755 "$SRC/var/www/wirecon/cgi-bin/config-save.sh" /var/www/wirecon/cgi-bin/
install -m 0755 "$SRC/var/www/wirecon/cgi-bin/logs.sh" /var/www/wirecon/cgi-bin/
+install -m 0755 "$SRC/var/www/wirecon/cgi-bin/quiet.sh" /var/www/wirecon/cgi-bin/
+install -m 0755 "$SRC/var/www/wirecon/cgi-bin/shutdown-web.sh" /var/www/wirecon/cgi-bin/
install -m 0644 "$SRC/etc/wirecon/httpd.conf" /etc/wirecon/httpd.conf
# Per-interface wg-quick symlink so the init script knows which iface to bring up.
diff --git a/lxc/usr/local/bin/wirecon-monitor.sh b/lxc/usr/local/bin/wirecon-monitor.sh
index e197a8a..0323f20 100755
--- a/lxc/usr/local/bin/wirecon-monitor.sh
+++ b/lxc/usr/local/bin/wirecon-monitor.sh
@@ -1,8 +1,13 @@
#!/bin/bash
+# Edited with Claude Code
# wirecon-monitor.sh — long-running observer. Emits one structured log line
# every MONITOR_INTERVAL seconds with handshake age, throughput deltas,
# endpoint, and in-tunnel RTT. Designed to make silent-death diagnosable
# after the fact via journalctl.
+#
+# Quiet mode: when MONITOR_QUIET=yes, switches to MONITOR_QUIET_INTERVAL
+# and suppresses info-level lines (warn/error still emitted). Toggle from
+# the web UI once the link is stable to cut log volume + wake-ups.
set -uo pipefail
@@ -13,6 +18,16 @@ CONF="${WIRECON_CONF:-/etc/wirecon/wirecon.conf}"
: "${WG_INTERFACE:=wg0}"
: "${PEER_IP:=10.42.0.1}"
: "${MONITOR_INTERVAL:=10}"
+: "${MONITOR_QUIET:=no}"
+: "${MONITOR_QUIET_INTERVAL:=60}"
+
+if [[ "$MONITOR_QUIET" == "yes" ]]; then
+ ACTIVE_INTERVAL="$MONITOR_QUIET_INTERVAL"
+ QUIET=1
+else
+ ACTIVE_INTERVAL="$MONITOR_INTERVAL"
+ QUIET=0
+fi
prev_rx=""
prev_tx=""
@@ -22,6 +37,8 @@ prev_mtu=""
log() {
local level="$1"; shift
+ # In quiet mode, drop info-level chatter. Warn/error always emit.
+ if [[ "$QUIET" -eq 1 && "$level" == "info" ]]; then return; fi
printf 'level=%s ts=%s %s\n' "$level" "$(date -u +%FT%TZ)" "$*"
}
@@ -34,12 +51,14 @@ rtt_probe() {
echo "$rtt"
}
-log info "event=monitor_start iface=$WG_INTERFACE peer_ip=$PEER_IP interval=${MONITOR_INTERVAL}s"
+# monitor_start is logged at warn so it's visible even after a quiet-mode
+# restart — useful for confirming the toggle landed.
+log warn "event=monitor_start iface=$WG_INTERFACE peer_ip=$PEER_IP interval=${ACTIVE_INTERVAL}s quiet=$MONITOR_QUIET"
while :; do
if ! ip link show "$WG_INTERFACE" >/dev/null 2>&1; then
log warn "event=iface_missing iface=$WG_INTERFACE"
- sleep "$MONITOR_INTERVAL"
+ sleep "$ACTIVE_INTERVAL"
continue
fi
@@ -49,7 +68,7 @@ while :; do
dump=$(wg show "$WG_INTERFACE" dump 2>/dev/null | awk 'NR==2')
if [[ -z "$dump" ]]; then
log warn "event=no_peer_dump iface=$WG_INTERFACE"
- sleep "$MONITOR_INTERVAL"
+ sleep "$ACTIVE_INTERVAL"
continue
fi
@@ -66,8 +85,8 @@ while :; do
# byte deltas (bps averaged over interval)
rx_bps="-"; tx_bps="-"
if [[ -n "$prev_rx" && -n "$prev_tx" ]]; then
- rx_bps=$(( (rx - prev_rx) * 8 / MONITOR_INTERVAL ))
- tx_bps=$(( (tx - prev_tx) * 8 / MONITOR_INTERVAL ))
+ rx_bps=$(( (rx - prev_rx) * 8 / ACTIVE_INTERVAL ))
+ tx_bps=$(( (tx - prev_tx) * 8 / ACTIVE_INTERVAL ))
fi
rtt=$(rtt_probe)
@@ -88,5 +107,5 @@ while :; do
log "$level" "event=tick iface=$WG_INTERFACE endpoint=$endpoint handshake_age=${hs_age}s mtu=$mtu rtt_ms=$rtt rx_bps=$rx_bps tx_bps=$tx_bps rx_total=$rx tx_total=$tx${notes}"
prev_rx="$rx"; prev_tx="$tx"; prev_hs="$hs_ts"; prev_ep="$endpoint"; prev_mtu="$mtu"
- sleep "$MONITOR_INTERVAL"
+ sleep "$ACTIVE_INTERVAL"
done
diff --git a/lxc/var/www/wirecon/app.js b/lxc/var/www/wirecon/app.js
index f2d2237..60c86d9 100644
--- a/lxc/var/www/wirecon/app.js
+++ b/lxc/var/www/wirecon/app.js
@@ -1,3 +1,4 @@
+// Edited with Claude Code
// wirecon web UI — vanilla JS. Talks to CGI scripts in /cgi-bin/ that
// return plain text (key=value for status, raw text for config/logs).
@@ -61,6 +62,11 @@ async function refreshStatus() {
dl.insertAdjacentHTML('beforeend', `
${k}${v}`);
}
+ const quiet = (kv['monitor.quiet'] || 'no') === 'yes';
+ const qb = $('#btn-quiet');
+ qb.dataset.quiet = quiet ? 'yes' : 'no';
+ qb.textContent = quiet ? 'enable verbose mode' : 'enable quiet mode';
+
$('#status-updated').textContent = `updated ${new Date().toLocaleTimeString()}`;
setOverall(allOk);
} catch (e) {
@@ -112,6 +118,44 @@ async function loadLogs() { await Promise.all([loadLog('watchdog'), loadLog('mon
$$('button[data-reload]').forEach(btn => btn.addEventListener('click', () => loadLog(btn.dataset.reload)));
+// --- maintenance -----------------------------------------------------------
+const maintMsg = (txt, ok) => {
+ const el = $('#res-maint');
+ el.textContent = txt;
+ el.className = 'result ' + (ok ? 'ok' : 'err');
+};
+
+$('#btn-quiet').addEventListener('click', async (e) => {
+ const btn = e.currentTarget;
+ const next = btn.dataset.quiet === 'yes' ? 'off' : 'on';
+ maintMsg(`switching quiet mode ${next}…`, true);
+ try {
+ const r = await fetch(`cgi-bin/quiet.sh?state=${next}`, { method: 'POST' });
+ maintMsg(await r.text(), r.ok);
+ if (r.ok) refreshStatus();
+ } catch (err) {
+ maintMsg(`error: ${err.message}`, false);
+ }
+});
+
+$('#btn-shutdown-web').addEventListener('click', async () => {
+ if (!confirm(
+ 'Shut down the wirecon web UI?\n\n' +
+ 'After this, the UI will be unreachable until you re-enable it from the\n' +
+ 'Proxmox Console (or SSH) with:\n\n' +
+ ' rc-update add wirecon-web default\n' +
+ ' rc-service wirecon-web start'
+ )) return;
+ maintMsg('stopping web UI… this connection will drop shortly.', true);
+ try {
+ const r = await fetch('cgi-bin/shutdown-web.sh', { method: 'POST' });
+ maintMsg(await r.text(), r.ok);
+ } catch (err) {
+ // Expected: connection drops mid-response when httpd dies.
+ maintMsg('web UI shut down (connection closed by server).', true);
+ }
+});
+
// --- boot ------------------------------------------------------------------
refreshStatus();
setInterval(refreshStatus, 5000);
diff --git a/lxc/var/www/wirecon/cgi-bin/quiet.sh b/lxc/var/www/wirecon/cgi-bin/quiet.sh
new file mode 100755
index 0000000..3de536c
--- /dev/null
+++ b/lxc/var/www/wirecon/cgi-bin/quiet.sh
@@ -0,0 +1,45 @@
+#!/bin/sh
+# Edited with Claude Code
+# CGI: toggle MONITOR_QUIET in /etc/wirecon/wirecon.conf, restart monitor.
+# Query: state=on|off
+# POSIX-sh; busybox httpd may run CGI via ash regardless of shebang.
+set -u
+
+CONF=/etc/wirecon/wirecon.conf
+
+state=""
+case "${QUERY_STRING:-}" in
+ *state=on*) state=yes ;;
+ *state=off*) state=no ;;
+ *)
+ printf 'Status: 400 Bad Request\r\nContent-Type: text/plain\r\n\r\n'
+ echo "state=on|off required"; exit 0
+ ;;
+esac
+
+if [ "${REQUEST_METHOD:-}" != "POST" ]; then
+ printf 'Status: 405 Method Not Allowed\r\nContent-Type: text/plain\r\n\r\n'
+ echo "POST required"; exit 0
+fi
+
+if grep -q '^MONITOR_QUIET=' "$CONF" 2>/dev/null; then
+ sed -i "s/^MONITOR_QUIET=.*/MONITOR_QUIET=$state/" "$CONF"
+else
+ echo "MONITOR_QUIET=$state" >> "$CONF"
+fi
+
+printf 'Content-Type: text/plain\r\n\r\n'
+echo "MONITOR_QUIET=$state"
+echo "restarting wirecon-monitor in background..."
+echo "watch: tail -F /var/log/wirecon-restart.log"
+
+(
+ ts() { date '+%Y-%m-%dT%H:%M:%S%z'; }
+ echo "[$(ts)] quiet-toggle: MONITOR_QUIET=$state -> restarting wirecon-monitor"
+ if ! timeout 20 rc-service wirecon-monitor restart 2>&1; then
+ echo "[$(ts)] (restart returned non-zero or timed out)"
+ fi
+ echo "[$(ts)] quiet-toggle: done"
+) >/var/log/wirecon-restart.log 2>&1 &
+
+exit 0
diff --git a/lxc/var/www/wirecon/cgi-bin/shutdown-web.sh b/lxc/var/www/wirecon/cgi-bin/shutdown-web.sh
new file mode 100755
index 0000000..cb27ed5
--- /dev/null
+++ b/lxc/var/www/wirecon/cgi-bin/shutdown-web.sh
@@ -0,0 +1,34 @@
+#!/bin/sh
+# Edited with Claude Code
+# CGI: stop and disable wirecon-web. After this CGI returns, the web UI is
+# unreachable. Re-enable from Console/SSH:
+# rc-update add wirecon-web default && rc-service wirecon-web start
+# POSIX-sh; busybox httpd may run CGI via ash regardless of shebang.
+set -u
+
+if [ "${REQUEST_METHOD:-}" != "POST" ]; then
+ printf 'Status: 405 Method Not Allowed\r\nContent-Type: text/plain\r\n\r\n'
+ echo "POST required"; exit 0
+fi
+
+printf 'Content-Type: text/plain\r\n\r\n'
+echo "wirecon-web shutting down..."
+echo ""
+echo "to re-enable later (Console or SSH):"
+echo " rc-update add wirecon-web default"
+echo " rc-service wirecon-web start"
+
+# Detach so the response gets flushed before httpd is killed. Brief sleep
+# gives the kernel time to send our buffered body before rc-service stop
+# tears the listening socket down.
+(
+ ts() { date '+%Y-%m-%dT%H:%M:%S%z'; }
+ sleep 1
+ echo "[$(ts)] shutdown-web: rc-update del wirecon-web default"
+ rc-update del wirecon-web default 2>&1
+ echo "[$(ts)] shutdown-web: rc-service wirecon-web stop"
+ rc-service wirecon-web stop 2>&1
+ echo "[$(ts)] shutdown-web: done"
+) >/var/log/wirecon-restart.log 2>&1 &
+
+exit 0
diff --git a/lxc/var/www/wirecon/cgi-bin/status.sh b/lxc/var/www/wirecon/cgi-bin/status.sh
index ffa0f43..41d2d87 100755
--- a/lxc/var/www/wirecon/cgi-bin/status.sh
+++ b/lxc/var/www/wirecon/cgi-bin/status.sh
@@ -1,4 +1,5 @@
#!/bin/sh
+# Edited with Claude Code
# CGI: emit service + tunnel state as key=value lines.
# POSIX-sh; busybox httpd may run CGI via ash regardless of shebang.
set -u
@@ -14,6 +15,12 @@ for svc in wg-quick.wg0 wirecon-watchdog wirecon-monitor wirecon-web; do
printf 'svc.%s=%s\n' "$svc" "$state"
done
+if grep -q '^MONITOR_QUIET=yes' /etc/wirecon/wirecon.conf 2>/dev/null; then
+ printf 'monitor.quiet=yes\n'
+else
+ printf 'monitor.quiet=no\n'
+fi
+
IFACE="${WG_INTERFACE:-wg0}"
if ip link show "$IFACE" >/dev/null 2>&1; then
diff --git a/lxc/var/www/wirecon/index.html b/lxc/var/www/wirecon/index.html
index 3ac4a15..75931db 100644
--- a/lxc/var/www/wirecon/index.html
+++ b/lxc/var/www/wirecon/index.html
@@ -1,4 +1,5 @@
+
@@ -32,6 +33,25 @@
tunnel
+
+ maintenance
+
+
+
+
monitor verbosity
+
quiet mode widens the cadence and drops info-level lines once the link is stable
+
+
+
+
+
+
web UI
+
reclaims the busybox httpd footprint; re-enable from Console/SSH
+
+
+
+
+
diff --git a/lxc/var/www/wirecon/style.css b/lxc/var/www/wirecon/style.css
index c43a802..2bf9056 100644
--- a/lxc/var/www/wirecon/style.css
+++ b/lxc/var/www/wirecon/style.css
@@ -1,3 +1,4 @@
+/* Edited with Claude Code */
:root {
--bg: #0e0e11;
--panel: #17171c;
@@ -99,3 +100,16 @@ button[data-save]:hover, button[data-reload]:hover { border-color: var(--accent)
}
.muted { color: var(--muted); font-size: 12px; font-family: var(--mono); }
+
+.maint { background: var(--panel); border: 1px solid var(--border); border-radius: 8px; padding: 4px 14px; }
+.maint-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--border); }
+.maint-row:last-of-type { border-bottom: 0; }
+.maint-label { font-family: var(--mono); font-size: 13px; }
+.maint-hint { color: var(--muted); font-size: 12px; margin-top: 2px; }
+.maint button {
+ appearance: none; border: 1px solid var(--border); background: var(--panel-2); color: var(--text);
+ padding: 6px 12px; border-radius: 6px; cursor: pointer; font-family: var(--sans); font-size: 12px; white-space: nowrap;
+}
+.maint button:hover { border-color: var(--accent); color: var(--accent); }
+.maint button.danger { color: var(--err); border-color: color-mix(in srgb, var(--err) 40%, var(--border)); }
+.maint button.danger:hover { background: color-mix(in srgb, var(--err) 12%, var(--panel-2)); color: var(--err); border-color: var(--err); }