NetBox: Difference between revisions
m Added basic documentation for using plugins based on https://github.com/NixOS/nixpkgs/issues/261522 |
→Plugins: define existing plugins (from official netboxlabs page) and add warning about dependencies or incompabilities, not tracked or covered by a module yet. |
||
| (8 intermediate revisions by 5 users not shown) | |||
| Line 1: | Line 1: | ||
[https://netbox.dev/ {{PAGENAME}}] is | [https://netbox.dev/ {{PAGENAME}}] is a network infrastructure documentation tool. It is a web application and this [[Module]] can be installed and configured via several options. | ||
== Setup == | == Setup == | ||
| Line 11: | Line 11: | ||
nix-shell -p openssl | nix-shell -p openssl | ||
openssl rand -hex 50 > /var/lib/netbox/secret-key-file | openssl rand -hex 50 > /var/lib/netbox/secret-key-file | ||
# For netbox 4.5 | |||
$(find /nix/store -name generate_secret_key.py) > /var/lib/netbox/api-token-peppers-file | |||
</syntaxhighlight> | </syntaxhighlight> | ||
| Line 24: | Line 26: | ||
enable = true; | enable = true; | ||
secretKeyFile = "/var/lib/netbox/secret-key-file"; | secretKeyFile = "/var/lib/netbox/secret-key-file"; | ||
# For netbox 4.5 | |||
apiTokenPeppersFile = "/var/lib/netbox/api-token-peppers-file"; | |||
settings = { | |||
# DEBUG = true; # use this if you hit the CSRF error. | |||
ALLOWED_HOSTS = [ "[::1]" ]; # from proxyPass (below) | |||
CSRF_TRUSTED_ORIGINS = [ "http://__YOUR_HOSTNAME_HERE__" ]; # CSRF error fix | |||
}; | |||
}; | }; | ||
| Line 34: | Line 43: | ||
"/" = { | "/" = { | ||
proxyPass = "http://[::1]:8001"; | proxyPass = "http://[::1]:8001"; | ||
# proxyPass = "http://${config.services.netbox.listenAddress}:${config.services.netbox.port}"; | # proxyPass = "http://${config.services.netbox.listenAddress}:${toString config.services.netbox.port}"; | ||
}; | }; | ||
"/static/" = { alias = "${config.services.netbox.dataDir}/static/"; }; | "/static/" = { alias = "${config.services.netbox.dataDir}/static/"; }; | ||
| Line 65: | Line 74: | ||
"/" = { | "/" = { | ||
proxyPass = "http://[::1]:8001"; | proxyPass = "http://[::1]:8001"; | ||
# proxyPass = "http://${config.services.netbox.listenAddress}:${config.services.netbox.port}"; | # proxyPass = "http://${config.services.netbox.listenAddress}:${toString config.services.netbox.port}"; | ||
}; | }; | ||
"/static/" = { alias = "${config.services.netbox.dataDir}/static/"; }; | "/static/" = { alias = "${config.services.netbox.dataDir}/static/"; }; | ||
| Line 83: | Line 92: | ||
=== Plugins === | === Plugins === | ||
The NixOS module supports plugins from nixpkgs. | The NixOS module supports plugins from nixpkgs; currently about half of the [https://netboxlabs.com/plugins/ existing NetBox plugins] are packaged there. Until 26.05 these plugins are available as part of [https://search.nixos.org/packages?type=packages&query=python3Packages+netbox python3Packages]. Since 26.05 plugins can be found in the [https://search.nixos.org/packages?type=packages&query=netboxPlugins. netboxPlugins] package set. The documentation for plugins is being worked on and discussed in [https://github.com/NixOS/nixpkgs/issues/261522 #261522]. | ||
To include a plugin:<syntaxhighlight lang="nix"> | To include a plugin:<syntaxhighlight lang="nix"> | ||
| Line 92: | Line 101: | ||
}; | }; | ||
} | } | ||
</syntaxhighlight>The plugin identifier | </syntaxhighlight>The plugin identifier for <source lang="nix" enclose="none">services.netbox.settings.PLUGINS</source> is usually contained in the official documentation for the plugin. It usually is slightly different from the package name. | ||
Some plugins depend on other plugins (e. g. netbox-config-backup on netbox-napalm-plugin, or netbox-peering-manager on netbox-routing) and some are incompatible with each other (e. g. netbox-bgp and netbox-routing). | |||
=== Setup Superuser === | === Setup Superuser === | ||
| Line 115: | Line 126: | ||
==== CSRF aborted message at login ==== | ==== CSRF aborted message at login ==== | ||
If you still get an CSRF aborted message while trying to log in after doing everything above, | If you still get an CSRF aborted message while trying to log in after doing everything above, enable DEBUG mode to get a detailed description of the problem. | ||
It could be these problem https://stackoverflow.com/questions/11516635/django-does-not-send-csrf-token-again-after-browser-cookies-has-been-cleared but I'm not sure. | It could be these problem https://stackoverflow.com/questions/11516635/django-does-not-send-csrf-token-again-after-browser-cookies-has-been-cleared but I'm not sure. | ||
| Line 126: | Line 137: | ||
[[Category:Guide]] | [[Category:Guide]] | ||
[[Category:Applications]] | [[Category:Applications]] | ||
[[Category:Web Applications]] | |||
[[Category:Server]] | |||