NetBox: Difference between revisions
imported>Vater |
imported>Vater No edit summary |
||
Line 1: | Line 1: | ||
[https://netbox.dev/ {{PAGENAME}}] (<s>[[wikipedia:en:{{PAGENAME}}]]</s>) is available as a [[module]]. | [https://netbox.dev/ {{PAGENAME}}] (<s>[[wikipedia:en:{{PAGENAME}}]]</s>) is available as a [[module]]. | ||
== configuration examples == | == configuration examples == | ||
==== minimal configuration ==== | ==== minimal configuration ==== | ||
<syntaxhighlight lang="bash">mkdir -p /var/lib/netbox/</syntaxhighlight> | |||
<syntaxhighlight lang="bash">$EDITOR /var/lib/netbox/passwordFile</syntaxhighlight> | |||
<syntaxhighlight lang="bash">cat /var/lib/netbox/passwordFile</syntaxhighlight> | |||
<syntaxhighlight lang="bash"> | |||
this-is-an-initial-password-for-netbox | |||
</syntaxhighlight> | |||
<!-- | <!-- | ||
Line 12: | Line 18: | ||
services.netbox.enable = true; | services.netbox.enable = true; | ||
services.netbox.secretKeyFile = "/var/lib/netbox/passwordFile"; | |||
networking.firewall.allowedTCPPorts = [ 8001 ]; | networking.firewall.allowedTCPPorts = [ 8001 ]; | ||
Line 23: | Line 30: | ||
!--> | !--> | ||
==== basic configuration ==== | ==== basic configuration ==== | ||
<syntaxhighlight lang="nix"> | <syntaxhighlight lang="nix"> | ||
Line 34: | Line 40: | ||
services.netbox.enable = true; | services.netbox.enable = true; | ||
services.netbox.secretKeyFile = "/var/lib/netbox/passwordFile"; | |||
services.nginx.enable = true; | services.nginx.enable = true; | ||
Line 41: | Line 48: | ||
# services.nginx.recommendedProxySettings = true; | # services.nginx.recommendedProxySettings = true; | ||
services.nginx.virtualHosts."${config.networking.fqdn}" = { | services.nginx.virtualHosts."${config.networking.fqdn}" = { | ||
locations | locations = { | ||
# | "/" = { | ||
# extraConfig = '' | |||
## proxy_pass http://127.0.0.1:8001; | |||
# proxy_pass http://[::1]:8001; | |||
# proxy_set_header X-Forwarded-Host $http_host; | |||
# proxy_set_header X-Real-IP $remote_addr; | |||
# proxy_set_header X-Forwarded-Proto $scheme; | |||
# ''; | |||
# proxyPass = "http://127.0.0.1:8001"; | |||
proxyPass = "http://[::1]:8001"; | |||
#### proxyPass = "http://${config.services.netbox.listenAddress}:${config.services.netbox.port}"; | |||
}; | |||
"/static/" = { | |||
# extraConfig = '' | |||
# alias /var/lib/netbox/static/; | |||
# ''; | |||
# alias = "/var/lib/netbox/static/"; | |||
alias = "${config.services.netbox.dataDir}/static/"; | |||
}; | |||
}; | }; | ||
forceSSL = true; | forceSSL = true; | ||
enableACME = true; | enableACME = true; | ||
}; | }; | ||
services.nginx.user = "netbox"; | |||
# services.nginx.recommendedTlsSettings = true; | # services.nginx.recommendedTlsSettings = true; | ||
security.acme.defaults.email = "acme@${config.networking.domain}"; | security.acme.defaults.email = "acme@${config.networking.domain}"; | ||
Line 60: | Line 85: | ||
https://netbox.domain.tld | https://netbox.domain.tld | ||
<!-- | <!-- | ||
Revision as of 05:50, 9 November 2022
NetBox (wikipedia:en:NetBox) is available as a module.
configuration examples
minimal configuration
mkdir -p /var/lib/netbox/
$EDITOR /var/lib/netbox/passwordFile
cat /var/lib/netbox/passwordFile
this-is-an-initial-password-for-netbox
basic configuration
# system.stateVersion = "22.05";
# networking.hostName = "netbox";
# networking.domain = "domain.tld";
services.netbox.enable = true;
services.netbox.secretKeyFile = "/var/lib/netbox/passwordFile";
services.nginx.enable = true;
# services.nginx.recommendedOptimisation = true;
# services.nginx.recommendedGzipSettings = true;
# services.nginx.recommendedProxySettings = true;
services.nginx.virtualHosts."${config.networking.fqdn}" = {
locations = {
"/" = {
# extraConfig = ''
## proxy_pass http://127.0.0.1:8001;
# proxy_pass http://[::1]:8001;
# proxy_set_header X-Forwarded-Host $http_host;
# proxy_set_header X-Real-IP $remote_addr;
# proxy_set_header X-Forwarded-Proto $scheme;
# '';
# proxyPass = "http://127.0.0.1:8001";
proxyPass = "http://[::1]:8001";
#### proxyPass = "http://${config.services.netbox.listenAddress}:${config.services.netbox.port}";
};
"/static/" = {
# extraConfig = ''
# alias /var/lib/netbox/static/;
# '';
# alias = "/var/lib/netbox/static/";
alias = "${config.services.netbox.dataDir}/static/";
};
};
forceSSL = true;
enableACME = true;
};
services.nginx.user = "netbox";
# services.nginx.recommendedTlsSettings = true;
security.acme.defaults.email = "acme@${config.networking.domain}";
security.acme.acceptTerms = true;
# networking.firewall.allowedTCPPorts = [ 80 443 8001 ];
networking.firewall.allowedTCPPorts = [ 80 443 ];
login
no (initial) account is create by default
tl;dr: No login is possible after installing and running NetBox. No account is created. You have to #create an initial account.
reenact that there is no initial account created by default
su postgres
psql
postgres=#
\l
List of databases
Name | Owner | Encoding | Collate | Ctype | Access privileges
-----------+----------+----------+-------------+-------------+-----------------------
netbox | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =Tc/postgres +
| | | | | postgres=CTc/postgres+
| | | | | netbox=CTc/postgres
postgres | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 |
template0 | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =c/postgres +
| | | | | postgres=CTc/postgres
template1 | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =c/postgres +
| | | | | postgres=CTc/postgres
(4 rows)
postgres=#
\c netbox
You are now connected to database "netbox" as user "postgres".
netbox=#
\dt
netbox=#
SELECT * FROM auth_user;
id | password | last_login | is_superuser | username | first_name | last_name | email | is_staff | is_active | date_joined
----+----------+------------+--------------+----------+------------+-----------+-------+----------+-----------+-------------
(0 rows)
netbox=#
\q
exit
create an initial account
(first you have to) create an initial account (on the cli)
- this initial account will get highest privileges
netbox-manage createsuperuser
Username (leave blank to use 'netbox'):
Email address:
Password:
Password (again):
Superuser created successfully.
first login
https://netbox.domain.tld/login/
- Login
- netbox
- Password
- …
- Sign In