Introduction
This package is an opinionated implementation of role based access control for NetBox.
It completely replaces the default authentication backend, using Active Directory for authentication and determining group membership. A user's roles are updated only on login, and are stored in the database.
Once installed, a user may view their roles.
Installation
$ pip3 install netbox-rbac
Configuration
Add the following to urls.py.
_patterns += [
path('', include('netbox_rbac.urls') ),
]
Add the following to settings.py. Either the LDAP or MOCK driver can be used, but not both.
AUTHENTICATION_BACKENDS = [
'netbox_rbac.backend.Backend',
]
INSTALLED_APPS += (
'netbox_rbac',
)
MIDDLEWARE += (
'netbox_rbac.middleware.Middleware',
)
REST_FRAMEWORK.update({
'DEFAULT_PERMISSION_CLASSES': (
'netbox_rbac.api.TokenPermissions',
'netbox.api.TokenPermissions',
)
})
LOGGING.update({
'loggers': {
'netbox_rbac': {
'handlers': ['console'],
'level': 'INFO',
},
},
})
LDAP
RBAC = {
'AUTH': {
'LDAP': {
'domain': 'COMPANY.COM',
'server': 'ldap://ldap.company.com:3268',
'search': {
'group': {
'base': 'OU=Groups,DC=company,DC=com',
'filter': '(&(sAMAccountName=%s)(objectClass=group))',
},
'member': {
'base': 'OU=Accounts,DC=company,DC=com',
'filter': '(&(sAMAccountName=%s)(memberOf:1.2.840.113556.1.4.1941:=%s))',
},
'user': {
'base': 'OU=Accounts,DC=company,DC=com',
'filter': '(&(sAMAccountName=%s)(objectClass=user))',
},
},
},
},
'RULE': [
'/opt/netbox-rules/rules.yaml',
'https://rules.company.com/rules.yaml',
],
}
Mock
RBAC = {
'AUTH': {
'MOCK': {
'users': [{
'username': 'ebusto',
'password': 'pw12345',
'email': 'ebusto@nvidia.com',
'first_name': 'Eric',
'last_name': 'Busto',
'groups': ['Access-NetBox-Read', 'Access-NetBox-Admin-DCIM'],
}],
},
},
'RULE': [
'/opt/netbox-rules/rules.yaml',
'https://rules.company.com/rules.yaml',
],
}
Database
Generate and apply RBAC model migrations.
$ ./manage.py makemigrations netbox_rbac
$ ./manage.py showmigrations
$ ./manage.py migrate
Rules
See the example rules, and documentation. The rule paths can be local files or URLs, and the backend will try each path in turn until it succeeds.
Metadata
Release files for netbox-rbac 1.0.18
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| netbox-rbac-1.0.18.tar.gz | 12.3 kB | Without provenance | Details for netbox-rbac-1.0.18.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| netbox_rbac-1.0.18-py3-none-any.whl | Python 3 | none | any | Details for netbox_rbac-1.0.18-py3-none-any.whl |
Total release size: 27.3 kB
Release files / netbox-rbac-1.0.18.tar.gz
| Download URL | netbox-rbac-1.0.18.tar.gz |
|---|---|
| Size | 12.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
84078bfcb88988b36c5a702ded6cb5843a9f498f61b9b2382f7eb28e90d1c41a
|
|
BLAKE2b-256 checksum How to use checksums |
44a8943084456895f36a14f94c1e2e4512bbf48d6ff381d22450c2d78576dd8d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/57.0.0 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.9.6
|
Release files / netbox_rbac-1.0.18-py3-none-any.whl
| Download URL | netbox_rbac-1.0.18-py3-none-any.whl |
|---|---|
| Size | 15.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
878e9a55e53778c121f96270811fc1e9d07648bd2d15dc95d2c8a78108e72720
|
|
BLAKE2b-256 checksum How to use checksums |
2912505ae7c5cf08964c883668188cf6cb3d60e9f8b792249bc60bd911891f14
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/57.0.0 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.9.6
|
Security for netbox-rbac 1.0.18
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.