This project provides a custom remote authentication backend for NetBox that authenticates users directly against TACACS+ or RADIUS servers (Cisco ISE, FreeRADIUS, ACS, NPS, etc.).
Unlike NetBoxβs builtβin RemoteUserBackend, this backend communicates directly with your AAA server, receives authorization attributes, and maps them to NetBox user groups automatically β no reverse proxy, no HTTP headers, no SSO required.
- Overview & How It Works
- Key Features
- Requirements
- Installation
- NetBox Docker Installation
- Bare-Metal Installation
- Configuration File:
netboxauth_config.py - NetBox Docker Usage
- Bare-Metal NetBox Usage
- AAA Server Configuration
- Group Mapping Behaviour
- Troubleshooting
- Advanced Notes
- User enters username & password into NetBox login page.
- NetBox invokes this backend instead of the default RemoteUser backend.
- Credentials are sent to TACACS+ or RADIUS.
- AAA validates the credentials and returns attributes/roles.
- Backend:
- Creates/updates NetBox local users,
- Assigns NetBox groups based on AAA roles,
- Applies staff/superuser flags,
- Ensures
is_active = True, - Optionally updates first name, last name, and email.
AAA fully controls whether the user is granted access.
- β TACACS+ and RADIUS authentication
- β Multi-server failover (try servers in order)
- β Automatic user creation
- β Automatic group creation based on AAA roles
- β Optional name/email attribute sync
- β Works with NetBox Docker and bare-metal
- β No configuration changes required in
configuration.py - β All settings live in one file:
netboxauth_config.py
Install required Python packages:
pip install tacacs-plus pyrad typing_extensionsThe backend package must be installed into the Python environment where NetBox runs.
NetBox Docker does not provide an extensions folder by default.
To install this backend, follow these steps.
git clone https://github.com/aliimani/netbox-remote-auth.gitReplace the repository URL with yours.
CID=$(sudo docker compose ps -q netbox)
sudo docker cp netbox-remote-auth "$CID":/tmp/netbox-remote-authThis copies your backend to:
/tmp/netbox-remote-auth
inside the container.
sudo docker exec -it -u root -w /tmp/netbox-remote-auth "$CID" uv pip install .This installs your backend as a Python module in NetBoxβs environment.
sudo docker compose restart netbox netbox-workergit clone https://github.com/aliimani/netbox-remote-auth.gitcd netbox-remote-auth
source /opt/netbox/venv/bin/activate
pip install .
deactivateThe backend will be installed automatically at:
/opt/netbox/venv/lib/python3.x/site-packages/netboxauth/
sudo systemctl restart netbox netbox-rqAll backend configuration lives in this file.
No edits to configuration.py are required.
π Example file:
π netboxauth_config_example.py
Replace this link with your real repo location.
# NetBox Remote Auth Configuration (TACACS+ / RADIUS)
REMOTE_AUTH_ENABLED = True
REMOTE_AUTH_BACKEND = "netboxauth.backend.NetBoxRemoteAuthBackend"
REMOTE_AUTH_AUTO_CREATE_USER = True
REMOTE_AUTH_DEFAULT_GROUPS = ["netbox-staff"]
REMOTE_AUTH_GROUP_SYNC_ENABLED = True
REMOTE_AUTH_SUPERUSER_GROUPS = ["netbox-admin"]
REMOTE_AUTH_STAFF_GROUPS = ["netbox-staff"]
NETBOX_REMOTE_AUTH_METHOD = "tacacs" # or "radius"
# -------------------------------------------------------
# TACACS+ CONFIGURATION (Enable only if using TACACS)
# The backend will try each server in order. If the first fails (connection/timeouts),
# it will try the next one.
# -------------------------------------------------------
#
# NETBOX_REMOTE_AUTH_TACACS = {
# "SERVERS": [
# {"HOST": "10.10.10.10", "PORT": 49},
# {"HOST": "10.10.10.11", "PORT": 49}, # Optional second server, if you only have one TACACS server, remove the second entry.
# ],
# "SECRET": "SecretKey",
# "TIMEOUT": 5,
# }
# -------------------------------------------------------
# RADIUS CONFIGURATION (Enable only if using RADIUS)
# The backend will try each server in order. If the first fails (connection/timeouts),
# it will try the next one.
# -------------------------------------------------------
#
# NETBOX_REMOTE_AUTH_RADIUS = {
# "SERVERS": [
# {"HOST": "10.10.20.10", "PORT": 1812},
# {"HOST": "10.10.20.11", "PORT": 1812}, # Optional second server, if you only have one RADIUS server, remove the second entry.
# ],
# "SECRET": "SecretKey",
# "TIMEOUT": 5,
# # "NAS_IDENTIFIER": "netbox", # Optional NAS-Identifier override used in RADIUS requests
# }
# Optional attribute mapping
REMOTE_AUTH_USER_FIRST_NAME = "givenName"
REMOTE_AUTH_USER_LAST_NAME = "sn"
REMOTE_AUTH_USER_EMAIL = "mail"Place file here:
netbox-docker/configuration/netboxauth_config.py
This becomes inside the container:
/etc/netbox/config/netboxauth_config.py
Restart containers:
sudo docker compose restart netbox netbox-workerPut file here:
/opt/netbox/netbox/netbox/netboxauth_config.py
Restart:
sudo systemctl restart netbox netbox-rqrole = netbox-adminCisco-AVPair = shell:role="netbox-admin"priv-lvl = 15β maps totacacs-priv-15
role = netbox-adminCisco-AVPair = "shell:role=netbox-admin"Class = netbox-admin
Each AAA role becomes a NetBox group name.
- Add default groups
- Add AAA role-based groups
- If sync enabled β clear old groups
- Apply staff/superuser group mapping
The recommended flow is:
- First check what NetBox sees in
django.conf.settings - Then check what the backend reads via
_cfg(), which mergesnetbox.configuration,settings, andnetboxauth_config.py.
sudo docker exec -it netbox-docker-netbox-1 bash
cd /opt/netbox/netbox
python manage.py shellfrom django.conf import settings
print("REMOTE_AUTH_BACKEND:", settings.REMOTE_AUTH_BACKEND)
print("REMOTE_AUTH_ENABLED:", settings.REMOTE_AUTH_ENABLED)
print("REMOTE_AUTH_SUPERUSER_GROUPS:", getattr(settings, "REMOTE_AUTH_SUPERUSER_GROUPS", None))
print("REMOTE_AUTH_STAFF_GROUPS:", getattr(settings, "REMOTE_AUTH_STAFF_GROUPS", None))If these values are not what you expect, the issue is in your NetBox/Docker config (e.g. wrong config file, bad mount).
from netboxauth.backend import _cfg
print("NETBOX_REMOTE_AUTH_METHOD:", _cfg("NETBOX_REMOTE_AUTH_METHOD"))
print("TACACS config:", _cfg("NETBOX_REMOTE_AUTH_TACACS"))
print("RADIUS config:", _cfg("NETBOX_REMOTE_AUTH_RADIUS"))
print("REMOTE_AUTH_USER_FIRST_NAME:", _cfg("REMOTE_AUTH_USER_FIRST_NAME"))
print("REMOTE_AUTH_USER_LAST_NAME:", _cfg("REMOTE_AUTH_USER_LAST_NAME"))
print("REMOTE_AUTH_USER_EMAIL:", _cfg("REMOTE_AUTH_USER_EMAIL"))If _cfg(...) returns None or {}:
- Confirm
netboxauth_config.pyexists inside the container in/etc/netbox/config/. - Check for syntax errors in the file.
- Ensure you restarted the NetBox containers after creating or editing the file.
On the NetBox host:
cd /opt/netbox/netbox
python manage.py shellfrom django.conf import settings
print("REMOTE_AUTH_BACKEND:", settings.REMOTE_AUTH_BACKEND)
print("REMOTE_AUTH_ENABLED:", settings.REMOTE_AUTH_ENABLED)
print("REMOTE_AUTH_SUPERUSER_GROUPS:", getattr(settings, "REMOTE_AUTH_SUPERUSER_GROUPS", None))
print("REMOTE_AUTH_STAFF_GROUPS:", getattr(settings, "REMOTE_AUTH_STAFF_GROUPS", None))from netboxauth.backend import _cfg
print("NETBOX_REMOTE_AUTH_METHOD:", _cfg("NETBOX_REMOTE_AUTH_METHOD"))
print("TACACS config:", _cfg("NETBOX_REMOTE_AUTH_TACACS"))
print("RADIUS config:", _cfg("NETBOX_REMOTE_AUTH_RADIUS"))
print("REMOTE_AUTH_USER_FIRST_NAME:", _cfg("REMOTE_AUTH_USER_FIRST_NAME"))
print("REMOTE_AUTH_USER_LAST_NAME:", _cfg("REMOTE_AUTH_USER_LAST_NAME"))
print("REMOTE_AUTH_USER_EMAIL:", _cfg("REMOTE_AUTH_USER_EMAIL"))If settings looks correct but _cfg() does not:
- Check the location of
netboxauth_config.py - Ensure NetBox has been restarted
- Confirm there are no import errors (check NetBox logs)
If _cfg() looks correct but users still cannot authenticate:
- Check TACACS+/RADIUS secrets, ports, and reachability
- Check AAA server policies/logs (Cisco ISE, FreeRADIUS, NPS)
The backend tries all servers listed in "SERVERS" in order.
If the first is down or unreachable, it logs a warning and tries the next.
If you remove a user or revoke their NetBox access in the AAA policy:
- AAA denies authentication
- Backend returns
None - NetBox login fails even if the local user object still exists
- Direct TACACS+/RADIUS login
- Multi-server failover
- Automatic user/group management
- Optional AAA β NetBox attribute sync
- Works for both NetBox Docker and bare-metal
- All settings in one file
Pull requests and feature suggestions welcome!