PR Pipeline — Authorize → Validate → Review → Merge / auth (pull_request) Successful in 2s
PR Pipeline — Authorize → Validate → Review → Merge / validate (pull_request) Successful in 2s
PR Pipeline — Authorize → Validate → Review → Merge / lint (pull_request) Successful in 5s
PR Pipeline — Authorize → Validate → Review → Merge / ai-review (pull_request) Successful in 2s
PR Pipeline — Authorize → Validate → Review → Merge / gate (pull_request) Successful in 1s
infrastructure-control.prose.md: - Add hwepve as 6th Proxmox node - Fix Gitea IP: .17 (was .110) - Fix AdGuard IP: .10 on minipve (was .102 on acerpve) - Fix Abiba placement: hwepve (was amdpve) - Fix Mumuni placement: hwepve (was minipve) - Fix Authentik port: add :9000 - Add CT 118 (jdownloader), CT 119 (infisical-vault) - Add last-verified date (2026-07-24) infrastructure-update.prose.md: - Add post-reboot CT sweep procedure - Add Zulip Docker network recovery steps - Add WireGuard tunnel verification scripts/netbird-add-domain.sh: - New script to register domains in Netbird proxy store.db
66 lines
2.5 KiB
Bash
66 lines
2.5 KiB
Bash
#!/bin/bash
|
|
# Netbird Reverse Proxy — Add a new domain route
|
|
#
|
|
# Usage: netbird-add-domain.sh <domain> <backend_ip> [port] [protocol]
|
|
#
|
|
# Example:
|
|
# netbird-add-domain.sh dns.sysloggh.net 192.168.68.10 80
|
|
#
|
|
# This script adds a domain to the Netbird proxy by inserting records
|
|
# directly into the management server's SQLite database, then restarting
|
|
# the proxy stack.
|
|
#
|
|
# Prerequisites: SSH root access to 72.61.0.17
|
|
# sqlite3 available on VPS
|
|
#
|
|
# Requires: The domain must already have a DNS CNAME to netbird.sysloggh.net
|
|
# pointing to 72.61.0.17.
|
|
|
|
set -euo pipefail
|
|
|
|
DOMAIN="${1:?Usage: netbird-add-domain.sh <domain> <backend_ip> [port] [protocol]}"
|
|
BACKEND_IP="${2:?Usage: netbird-add-domain.sh <domain> <backend_ip> [port] [protocol]}"
|
|
PORT="${3:-80}"
|
|
PROTOCOL="${4:-http}"
|
|
|
|
VPS="root@72.61.0.17"
|
|
DB_VOLUME="/var/lib/docker/volumes/root_netbird_data/_data"
|
|
DB="$DB_VOLUME/store.db"
|
|
|
|
echo "=== Adding Netbird proxy route ==="
|
|
echo "Domain: $DOMAIN"
|
|
echo "Backend: $BACKEND_IP:$PORT ($PROTOCOL)"
|
|
echo ""
|
|
|
|
ssh "$VPS" bash << REMOTESCRIPT
|
|
set -euo pipefail
|
|
|
|
# Generate unique ID using timestamp hash (Netbird format)
|
|
ID_SUFFIX=\$(date +%s | md5sum | head -c 16)
|
|
SVC_ID="d9\${ID_SUFFIX}ptsnc73\$(date +%s | md5sum | head -c 10)"
|
|
TGT_ID=\$(sqlite3 "$DB" "SELECT COALESCE(MAX(id), 100) + 1 FROM targets;")
|
|
ACCOUNT_ID="d88av3aptsnc73clmogg"
|
|
ZONE_ID="d8adqjaptsnc73fro5g0"
|
|
|
|
echo "Service ID: \$SVC_ID"
|
|
echo "Target ID: \$TGT_ID"
|
|
|
|
# Insert service
|
|
sqlite3 "$DB" "INSERT INTO services (id, account_id, name, domain, proxy_cluster, enabled, terminated, pass_host_header, rewrite_redirects, mode, source, port_auto_assigned, private) VALUES (\"\$SVC_ID\", \"\$ACCOUNT_ID\", \"$DOMAIN\", \"$DOMAIN\", \"netbird.sysloggh.net\", 1, 0, 1, 0, \"http\", \"permanent\", 0, 0);"
|
|
echo "Service: OK"
|
|
|
|
# Insert target
|
|
sqlite3 "$DB" "INSERT INTO targets (id, account_id, service_id, host, port, protocol, target_id, target_type, enabled, skip_tls_verify, request_timeout, session_idle_timeout, agent_network, disable_access_log) VALUES (\$TGT_ID, \"\$ACCOUNT_ID\", \"\$SVC_ID\", \"$BACKEND_IP\", $PORT, \"$PROTOCOL\", \"\$ZONE_ID\", \"subnet\", 1, 0, 0, 0, 0, 0);"
|
|
echo "Target: OK"
|
|
|
|
# Verify
|
|
sqlite3 -column "$DB" "SELECT s.name, t.host, t.port, t.protocol FROM services s JOIN targets t ON s.id=t.service_id WHERE s.name=\"$DOMAIN\";"
|
|
|
|
echo ""
|
|
echo "Restarting proxy stack..."
|
|
cd /root && docker compose restart netbird-server 2>/dev/null
|
|
sleep 15
|
|
docker compose restart proxy 2>/dev/null
|
|
echo "Done. Verify with: curl -sI https://$DOMAIN"
|
|
REMOTESCRIPT
|