NetBox's web UI through Rollcall, and links to it from the web UI
With NetBox as the IPAM under a path (its BASE_PATH) and ipam.url carrying it, Rollcall serves NetBox's UI at that same path, for admins only (the admin certificate, as for the API); NetBox keeps its own login. Redirects that name NetBox's own address are turned back to Rollcall's, Rollcall's credentials are not passed on. NetBox opens wherever Rollcall does: a lab NetBox on a segment the browser cannot reach, say. The web UI links to NetBox: the sidebar, sites, rooms, racks, switches and a machine's device (by its rollcall_machine field). ipam.ui_url points the links at NetBox directly instead. NetBox paging under a BASE_PATH doubled the path on the next page (the next link carries it already); fixed. The lab NetBox moves under /netbox/ and trusts the region's addresses for its forms. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
c31a89482e
commit
cc1245da1e
11 files changed
+214
-12
No files matched your search
@@ -3,6 +3,9 @@
|
||||
# container on the lab segment, so tests never write to a real NetBox.
|
||||
# Same install as netops (altyapi hosts/netops/kurulum.sh) without PowerDNS,
|
||||
# ACME and backups; plain HTTP on :80 (the segment is isolated).
|
||||
# NetBox lives under /netbox/ (BASE_PATH) so the region can serve its UI
|
||||
# through Rollcall (cmd/rollcall/nbproxy.go): Rollcall's ipam url is then
|
||||
# http://$MYIP/netbox/, and ROLLCALL_ORIGINS are where browsers post from.
|
||||
#
|
||||
# Run as root inside the container; rerunnable. Secrets are generated here:
|
||||
# /etc/lab-netbox/secrets.env (admin password, Rollcall's API token)
|
||||
@@ -16,6 +19,7 @@ set -euo pipefail
|
||||
NETBOX_VERSION=${NETBOX_VERSION:-4.7.4}
|
||||
MYIP=${MYIP:-10.213.77.6}
|
||||
SITE=${SITE:-lab}
|
||||
ROLLCALL_ORIGINS=${ROLLCALL_ORIGINS:-"https://10.0.0.234 https://10.213.77.1"}
|
||||
PREFIXES=${PREFIXES:-"10.213.77.0/24 10.213.78.0/24 10.213.79.0/24 fd00:213:77::/64 fd00:213:78::/64"}
|
||||
export DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
@@ -69,7 +73,8 @@ REDIS = {
|
||||
SECRET_KEY = '$NETBOX_SECRET_KEY'
|
||||
API_TOKEN_PEPPERS = {1: '$NETBOX_PEPPER'}
|
||||
TIME_ZONE = 'Europe/Stockholm'
|
||||
CSRF_TRUSTED_ORIGINS = ['http://$MYIP']
|
||||
BASE_PATH = 'netbox/'
|
||||
CSRF_TRUSTED_ORIGINS = ['http://$MYIP'$(for o in $ROLLCALL_ORIGINS; do printf ", '%s'" "$o"; done)]
|
||||
EOF
|
||||
chown -R netbox:netbox $D/netbox/media $D/netbox/reports $D/netbox/scripts 2>/dev/null || true
|
||||
cd /opt/netbox && PYTHON=/usr/bin/python3 ./upgrade.sh >/var/log/netbox-upgrade.log 2>&1 || { tail -40 /var/log/netbox-upgrade.log; exit 1; }
|
||||
@@ -84,7 +89,8 @@ systemctl restart netbox netbox-rq
|
||||
cat > /etc/caddy/Caddyfile <<EOF
|
||||
# pxestuff lab/netbox/install.sh
|
||||
http://$MYIP, http://localhost {
|
||||
handle_path /static/* {
|
||||
redir / /netbox/
|
||||
handle_path /netbox/static/* {
|
||||
root * /opt/netbox/netbox/static
|
||||
file_server
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user