Compare commits

..
Author SHA1 Message Date
MickLesk 5b7de9c71d Obsidian LiveSync: refuse anonymous requests to CouchDB
require_valid_user was set only under [chttpd_auth], which CouchDB 3 does
not enforce, so the server root and Fauxton answered without credentials.
It now sits under [chttpd] as in upstream's init script, with
chttpd enable_cors; updates add both to existing installs.
2026-12-06 10:49:59 +01:00
6b202d4ed0 networkoptimizer: build all Go helpers (WAN Steering, AP Agent) (#19285)
Follow upstream docker/NATIVE-DEPLOYMENT.md "Build the Go Helpers": besides
uwnspeedtest, build wansteer (gateway, arm64) and apagent (arm/GOARM=7,
arm64, mipsle, mips softfloat) into publish/tools, and stamp every binary
with main.version so the app can report which build each one runs.

Without them WAN Steering reports "WAN Steering binary not found" and AP
Telemetry deploy fails with "The AP Agent binary for <arch> is not included
in this build."

Co-authored-by: Dave Packham <dpackham@p0larmacm4.thepackhams.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-06 10:32:00 +01:00
6 changed files with 66 additions and 43 deletions

No files matched your search

+2 -22
View File
@@ -76,9 +76,7 @@ EOF
sleep 1
chown -R hermes:hermes /home/hermes || msg_warn "Could not take ownership of everything under /home/hermes"
fi
if [[ -f /home/hermes/.config/systemd/user/hermes-dashboard.service && ! -f /home/hermes/.hermes/backend_migration.json ]]; then
$STD runuser -l hermes -c 'systemctl --user daemon-reload && systemctl --user enable hermes-dashboard'
fi
$STD runuser -l hermes -c 'systemctl --user daemon-reload && systemctl --user enable hermes-dashboard'
NODE_VERSION="22" setup_nodejs
@@ -90,26 +88,8 @@ EOF
msg_ok "Updated Hermes Agent"
msg_info "Starting Services"
$STD runuser -l hermes -c '
systemctl --user daemon-reload
if systemctl --user is-enabled -q hermes-dashboard 2>/dev/null; then systemctl --user start hermes-dashboard; fi
if systemctl --user is-enabled -q hermes-gateway 2>/dev/null; then systemctl --user restart hermes-gateway; fi
'
$STD runuser -l hermes -c 'systemctl --user start hermes-dashboard'
msg_ok "Started Services"
# hermes dashboard is deprecated; upstream moves it onto the gateway's Webapp on the same address.
if [[ -f /home/hermes/.config/systemd/user/hermes-dashboard.service && ! -f /home/hermes/.hermes/backend_migration.json ]]; then
msg_info "Moving the Dashboard to the Gateway's Webapp"
for _ in {1..30}; do
curl -so /dev/null http://127.0.0.1:9119/ && break
sleep 1
done
if $STD runuser -l hermes -c 'set -a; source /etc/default/hermes; set +a; hermes gateway migrate --backends --apply --yes'; then
msg_ok "Moved the Dashboard to the Gateway's Webapp"
else
msg_warn "Could not move the Dashboard to the Gateway's Webapp, it keeps running"
fi
fi
msg_ok "Updated successfully!"
exit
}
+17 -4
View File
@@ -50,12 +50,25 @@ function update_script() {
export DOTNET_SYSTEM_NET_DISABLEIPV6=1
$STD dotnet publish src/NetworkOptimizer.Web -c Release -r "$RID" --self-contained -o /opt/networkoptimizer/publish
chmod +x /opt/networkoptimizer/publish/NetworkOptimizer.Web
mkdir -p /opt/networkoptimizer/publish/tools
cd /opt/networkoptimizer/src/uwnspeedtest
CGO_ENABLED=0 GOOS=linux GOARCH=arm64 $STD go build -trimpath -ldflags "-s -w" -o /opt/networkoptimizer/publish/tools/uwnspeedtest-linux-arm64 .
[[ "$(arch_resolve)" != "arm64" ]] && CGO_ENABLED=0 GOOS=linux GOARCH="$(arch_resolve)" $STD go build -trimpath -ldflags "-s -w" -o "/opt/networkoptimizer/publish/tools/uwnspeedtest-linux-$(arch_resolve)" .
msg_ok "Rebuilt NetworkOptimizer"
msg_info "Building Go Helpers"
TOOLS=/opt/networkoptimizer/publish/tools
VERSION="$(cat ~/.networkoptimizer)"
LDFLAGS="-s -w -X main.version=${VERSION#v}"
mkdir -p "$TOOLS"
cd /opt/networkoptimizer/src/uwnspeedtest
CGO_ENABLED=0 GOOS=linux GOARCH=arm64 $STD go build -trimpath -ldflags "$LDFLAGS" -o "$TOOLS/uwnspeedtest-linux-arm64" .
[[ "$(arch_resolve)" != "arm64" ]] && CGO_ENABLED=0 GOOS=linux GOARCH="$(arch_resolve)" $STD go build -trimpath -ldflags "$LDFLAGS" -o "$TOOLS/uwnspeedtest-linux-$(arch_resolve)" .
cd /opt/networkoptimizer/src/wansteer
CGO_ENABLED=0 GOOS=linux GOARCH=arm64 $STD go build -trimpath -ldflags "$LDFLAGS" -o "$TOOLS/wansteer-linux-arm64" .
cd /opt/networkoptimizer/src/apagent
CGO_ENABLED=0 GOOS=linux GOARCH=arm GOARM=7 $STD go build -trimpath -ldflags "$LDFLAGS" -o "$TOOLS/apagent-linux-arm" .
CGO_ENABLED=0 GOOS=linux GOARCH=arm64 $STD go build -trimpath -ldflags "$LDFLAGS" -o "$TOOLS/apagent-linux-arm64" .
CGO_ENABLED=0 GOOS=linux GOARCH=mipsle GOMIPS=softfloat $STD go build -trimpath -ldflags "$LDFLAGS" -o "$TOOLS/apagent-linux-mipsle" .
CGO_ENABLED=0 GOOS=linux GOARCH=mips GOMIPS=softfloat $STD go build -trimpath -ldflags "$LDFLAGS" -o "$TOOLS/apagent-linux-mips" .
msg_ok "Built Go Helpers"
msg_info "Starting Service"
systemctl start networkoptimizer
msg_ok "Started Service"
+5
View File
@@ -45,6 +45,11 @@ function update_script() {
systemctl stop couchdb
restore_backup
# Only [chttpd] require_valid_user makes CouchDB 3 refuse anonymous requests
if ! sed -n '/^\[chttpd\]/,/^\[/p' /opt/couchdb/etc/local.d/obsidian-livesync.ini | grep -q '^require_valid_user'; then
sed -i '/^\[chttpd\]/a require_valid_user = true\nenable_cors = true' /opt/couchdb/etc/local.d/obsidian-livesync.ini
fi
msg_info "Starting CouchDB"
systemctl start couchdb
msg_ok "Started CouchDB"
+25 -12
View File
@@ -63,23 +63,36 @@ chown hermes:hermes /home/hermes/.hermes/.env
chmod 600 /home/hermes/.hermes/.env
msg_ok "Configured API Server"
msg_info "Setting up Gateway and Webapp"
$STD runuser -l hermes -c '
set -a; source /etc/default/hermes; set +a
hermes webapp --build-only
hermes config set webapp.enabled true
hermes config set webapp.host 127.0.0.1
hermes config set webapp.port 9119
hermes gateway install
systemctl --user enable --now hermes-gateway
'
msg_ok "Set up Gateway and Webapp"
msg_info "Creating Dashboard Service"
mkdir -p /home/hermes/.config/systemd/user
cat <<EOF >/home/hermes/.config/systemd/user/hermes-dashboard.service
[Unit]
Description=Hermes Agent Web Dashboard
After=network-online.target
[Service]
Type=simple
UMask=0077
WorkingDirectory=%h
EnvironmentFile=/etc/default/hermes
ExecStart=%h/.local/bin/hermes dashboard --host 127.0.0.1 --port 9119 --no-open
Restart=on-failure
RestartSec=5
[Install]
WantedBy=default.target
EOF
chown -R hermes:hermes /home/hermes/.config
$STD runuser -l hermes -c 'systemctl --user daemon-reload && systemctl --user enable --now hermes-dashboard'
msg_ok "Created Dashboard Service"
msg_info "Creating Setup Helper"
cat <<'SETUP' >/usr/bin/hermes-setup
#!/usr/bin/env bash
su - hermes -c 'set -a; source /etc/default/hermes; set +a; hermes setup'
su - hermes -c 'systemctl --user enable -q hermes-gateway && systemctl --user restart hermes-gateway'
if [[ -f /home/hermes/.config/systemd/user/hermes-gateway.service ]]; then
su - hermes -c 'systemctl --user enable --now hermes-gateway'
fi
echo "Hermes setup complete."
SETUP
chmod +x /usr/bin/hermes-setup
+15 -5
View File
@@ -43,12 +43,22 @@ $STD dotnet publish src/NetworkOptimizer.Web -c Release -r "$RID" --self-contain
chmod +x /opt/networkoptimizer/publish/NetworkOptimizer.Web
msg_ok "Built NetworkOptimizer"
msg_info "Building Speed Test Binaries"
mkdir -p /opt/networkoptimizer/publish/tools
msg_info "Building Go Helpers"
TOOLS=/opt/networkoptimizer/publish/tools
VERSION="$(cat ~/.networkoptimizer)"
LDFLAGS="-s -w -X main.version=${VERSION#v}"
mkdir -p "$TOOLS"
cd /opt/networkoptimizer/src/uwnspeedtest
CGO_ENABLED=0 GOOS=linux GOARCH=arm64 $STD go build -trimpath -ldflags "-s -w" -o /opt/networkoptimizer/publish/tools/uwnspeedtest-linux-arm64 .
[[ "$(arch_resolve)" != "arm64" ]] && CGO_ENABLED=0 GOOS=linux GOARCH="$(arch_resolve)" $STD go build -trimpath -ldflags "-s -w" -o "/opt/networkoptimizer/publish/tools/uwnspeedtest-linux-$(arch_resolve)" .
msg_ok "Built Speed Test Binaries"
CGO_ENABLED=0 GOOS=linux GOARCH=arm64 $STD go build -trimpath -ldflags "$LDFLAGS" -o "$TOOLS/uwnspeedtest-linux-arm64" .
[[ "$(arch_resolve)" != "arm64" ]] && CGO_ENABLED=0 GOOS=linux GOARCH="$(arch_resolve)" $STD go build -trimpath -ldflags "$LDFLAGS" -o "$TOOLS/uwnspeedtest-linux-$(arch_resolve)" .
cd /opt/networkoptimizer/src/wansteer
CGO_ENABLED=0 GOOS=linux GOARCH=arm64 $STD go build -trimpath -ldflags "$LDFLAGS" -o "$TOOLS/wansteer-linux-arm64" .
cd /opt/networkoptimizer/src/apagent
CGO_ENABLED=0 GOOS=linux GOARCH=arm GOARM=7 $STD go build -trimpath -ldflags "$LDFLAGS" -o "$TOOLS/apagent-linux-arm" .
CGO_ENABLED=0 GOOS=linux GOARCH=arm64 $STD go build -trimpath -ldflags "$LDFLAGS" -o "$TOOLS/apagent-linux-arm64" .
CGO_ENABLED=0 GOOS=linux GOARCH=mipsle GOMIPS=softfloat $STD go build -trimpath -ldflags "$LDFLAGS" -o "$TOOLS/apagent-linux-mipsle" .
CGO_ENABLED=0 GOOS=linux GOARCH=mips GOMIPS=softfloat $STD go build -trimpath -ldflags "$LDFLAGS" -o "$TOOLS/apagent-linux-mips" .
msg_ok "Built Go Helpers"
msg_info "Configuring NetworkOptimizer"
cat <<EOF >/opt/networkoptimizer/networkoptimizer.env
+2
View File
@@ -60,6 +60,8 @@ admin = ${COUCHDB_PASSWORD}
bind_address = 0.0.0.0
port = 5984
max_http_request_size = 4294967296
require_valid_user = true
enable_cors = true
[chttpd_auth]
require_valid_user = true