NetBox through Rollcall: the admin certificate signs in to NetBox
With ipam.ui_login_secret_file, the proxy tells NetBox who the admin is (X-Rollcall-User: the certificate's admin name) together with a shared secret (X-Rollcall-Proxy-Secret). NetBox takes the user from that header (REMOTE_AUTH) and creates it on first use; the web server in front of NetBox drops the header from any request that lacks the secret or does not come from the region, so reaching NetBox directly claims no one. Both headers coming from a browser are always dropped by Rollcall; an admin signed in with a token instead of a certificate logs in to NetBox by hand. A secret under 16 characters or an unreadable file leaves the proxy off, with a log line. The lab NetBox install sets it up: REMOTE_AUTH settings, a guarded Caddyfile (readable by caddy only: the secret is in it), the secret in secrets.env, and a rollcall-admins group that may do everything. Rollcall's NetBox user may now view cables. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
a613014073
commit
44ac453bde
7 files changed
+146
-20
No files matched your search
@@ -892,6 +892,36 @@ BASE_PATH = 'netbox/'
|
||||
CSRF_TRUSTED_ORIGINS = ['https://rollcall.example'] # where browsers post from
|
||||
```
|
||||
|
||||
**Signing in with the admin certificate.** With `"ui_login_secret_file"` in the
|
||||
`ipam` block, the proxy tells NetBox who the admin is: `X-Rollcall-User` (the
|
||||
certificate's admin name) with the shared secret in `X-Rollcall-Proxy-Secret`.
|
||||
NetBox takes the user from that header and creates it on first use:
|
||||
|
||||
```python
|
||||
REMOTE_AUTH_ENABLED = True
|
||||
REMOTE_AUTH_BACKEND = 'netbox.authentication.RemoteUserBackend'
|
||||
REMOTE_AUTH_HEADER = 'HTTP_X_ROLLCALL_USER'
|
||||
REMOTE_AUTH_AUTO_CREATE_USER = True
|
||||
REMOTE_AUTH_DEFAULT_GROUPS = ['rollcall-admins'] # give this group the permissions admins should have
|
||||
```
|
||||
|
||||
The web server in front of NetBox must drop `X-Rollcall-User` from every
|
||||
request that does not come from Rollcall with the secret, or anyone who reaches
|
||||
NetBox directly could claim a user. With Caddy:
|
||||
|
||||
```
|
||||
@notrollcall not {
|
||||
remote_ip 10.0.0.5 # the region
|
||||
header X-Rollcall-Proxy-Secret "<secret>"
|
||||
}
|
||||
request_header @notrollcall -X-Rollcall-User
|
||||
request_header -X-Rollcall-Proxy-Secret
|
||||
```
|
||||
|
||||
Rollcall drops both headers when a browser sends them. An admin with a token
|
||||
instead of a certificate signs in to NetBox by hand. `lab/netbox/install.sh`
|
||||
sets all of this up for the lab NetBox.
|
||||
|
||||
The web UI then links to NetBox: the sidebar, a site, room and rack on the Sites
|
||||
pages, a switch, and a machine's device. `ipam.ui_url` points those links
|
||||
elsewhere (NetBox reached directly) when that is preferred; a NetBox at the root
|
||||
|
||||
Reference in new issue
Block a user