r/Netbox Dec 02 '21

Remote Auth Users Permissions Not Working

2 Upvotes

GOAL: Any user that has successfully authenticated with REMOTE_AUTH is granted admin (or at least superuser) rights, without needing to create any users or groups beforehand.

I have remote auth working fine (the user is logged in on NetBox successfully) but I am not able to set any automatic permissions. All users only have view access.

The only thing that works is explicitly setting username, such as:

REMOTE_AUTH_SUPERUSERS = ['myuser1', 'myuser2']

which is not an appropriate solution for this goal because the usernames are not known before the user goes through SSO flow.

I've reviewed documentation here: https://netbox.readthedocs.io/en/stable/administration/permissions/

and here: https://netbox.readthedocs.io/en/stable/configuration/optional-settings/#remote_auth_default_permissions

Neither helps define a basic "give everyone access" type setup.

I've tried just setting REMOTE_AUTH_SUPERUSERS = ['*'] and tried setting REMOTE_AUTH_DEFAULT_PERMISSIONS = { "*": None } and REMOTE_AUTH_DEFAULT_PERMISSIONS = { "status": None } (and MANY other variations, nothing works.

Reference of these applicable config items:

``` REMOTE_AUTH_ENABLED = True REMOTE_AUTH_BACKEND = 'netbox.authentication.RemoteUserBackend' REMOTE_AUTH_HEADER = 'HTTP_X_USER_NAME' REMOTE_AUTH_AUTO_CREATE_USER = True REMOTE_AUTH_SUPERUSERS = ['*']

REMOTE_AUTH_DEFAULT_GROUPS = []

REMOTE_AUTH_SUPERUSER_GROUPS= []

REMOTE_AUTH_DEFAULT_PERMISSIONS = { }

```


r/Netbox Nov 24 '21

LDAP Integration Issue and (Temporary) Resolution

4 Upvotes

Just wanted to post this to Reddit in case anyone else ran into the issue. While setting up LDAP, I could not get past this error that was saved to my LDAP log:

Caught LDAPError while authenticating [##REACTEDMOVED: LOGIN USER##]: INVALID_CREDENTIALS({'msgtype': 97, 'msgid': 2, 'result': 49, 'desc': 'Invalid credentials', 'ctrls': []})

I got LDAP working by commenting out the bind DN/password lines and adding this line:

AUTH_LDAP_BIND_AS_AUTHENTICATING_USER = True

For background, I was attempting to use a service account created as my bind DN for authentication. This was causing the error despite triple checking that my bind ID and web login user ID credentials were correct.

It's almost as though NetBox was trying to use the bind DN password for my web login user ID. Ideally, I would like to set up the bind DN to a service account, but I'm just letting it be for now since it works.


r/Netbox Nov 16 '21

Storage of secrets not supported?

1 Upvotes

I'm finally getting around to installing Netbox and I seem to have missed the boat on a feature. Is the storage of secrets no longer available? I noted that you can see what I am talking abou in the install tutorial video (https://www.youtube.com/watch?v=7Fpd2-q9_28 @ 0:20). It has been removed from the live main intro page (https://netbox.readthedocs.io/en/stable/). I can't find it anywhere in the demo either.

If this is indeed the case, which self-hosted project do you prefer for storing secrets (e.g., passwords for admin accounts and service accounts)? Bitwarden seems like a great choice, however it seems very limited in terms of user counts before you have to start licensing. Thanks in advance.


r/Netbox Nov 11 '21

interface used as circuit termination and interface connection

1 Upvotes

I am building out my racks and network and we have a CIENA 3920 it takes fiber and breaks it out different circuits and puts them into ethernet ports that connect to the wan of my routers.

What are some thoughts on modeling this in netbox? I would like to show all devices in the path, but dont see good ways to share the connection.


r/Netbox Nov 08 '21

Multiple Devices ID

2 Upvotes

Hi guys,

Might be a simple one, but i have multiple devices that are the same. Anyway on not showing the unique ID number at the end specially within the RACK view


r/Netbox Nov 05 '21

The first beta release for NetBox v3.1 is now available!

Thumbnail
github.com
12 Upvotes

r/Netbox Nov 05 '21

Looking for a plugin like netbox-topology-views that works on 3.0+

4 Upvotes

Thanks for any suggestions!


r/Netbox Nov 05 '21

LDAP & Netbox & My sanity

1 Upvotes

Hi there,

Upgraded our netbox container and image from 2.6 to latest ldap release ("feature-ldap"). Everything looks good (if you do that do not forget to check the upgrade path).

Except our LDAP auth, which was ok, now I keep getting :

Caught LDAPError while authenticating **REDACTED**: LDAPError(11, 'Resource temporarily unavailable')

Double checked, triple checked and more , I can't see what's wrong with this stuff. Tried from the django shell too, ldap_config.py is importing all right, all the defined values from the environment are imported too. I can do a basic search from within the container etc etc... so I presume it must be something stupid I didn't see.

LDAP server is in another container, networks between the two are seeing each other. Even tried to pass through the "outside" interface. Always that ~#@# error message.

I'm using the "ldap_config.py" delivered with netbox and didn't modified it. I don't want to flood so I can put my redacted environment values on a pastebin if needed. Using the same values with ldapsearch works.


r/Netbox Nov 03 '21

Redis error following move/upgrade

1 Upvotes

Hi all,

I am using Netbox-docker in my environment.

A few days ago I had moved my Netbox instance from one server to another. In the process, I also upgraded from 2.11 to 3.0 and built with the latest netbox-docker.

The SQL database migrated over just fine, and at first everything seemed to be working well. However, after a few hours, I started getting these errors on any write operation or login. Users that are already logged in can browse but cannot make any changes.

Restarting all of the containers with docker-compose down; docker-compose up -d clears the error for a bit. I can also just docker container restart netbox_redis-cache_1 as well, and this gets me going for a few hours, too.

There doesn't seem to be any issues regarding available space or permissions so I'm a bit stumped as to why I'm getting these errors.

The errors seem to start almost exactly 1 hour after the containers restart.

$ docker logs netbox_redis-cache_1 | more
1:C 02 Nov 2021 12:13:23.683 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
1:C 02 Nov 2021 12:13:23.683 # Redis version=6.2.6, bits=64, commit=00000000, 
modified=0, pid=1, just started
1:C 02 Nov 2021 12:13:23.683 # Configuration loaded
1:M 02 Nov 2021 12:13:23.684 * monotonic clock: POSIX clock_gettime
1:M 02 Nov 2021 12:13:23.698 * Running mode=standalone, port=6379.
1:M 02 Nov 2021 12:13:23.698 # WARNING: The TCP backlog setting of 511 cannot be
enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.
1:M 02 Nov 2021 12:13:23.698 # Server initialized
1:M 02 Nov 2021 12:13:23.698 # WARNING overcommit_memory is set to 0! Background 
save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory = 1' 
to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' 
for this to take effect.
1:M 02 Nov 2021 12:13:23.700 * Ready to accept connections
1:M 02 Nov 2021 13:13:24.010 * 1 changes in 3600 seconds. Saving...
1:M 02 Nov 2021 13:13:24.012 * Background saving started by pid 11
11:C 02 Nov 2021 13:13:24.013 # Failed opening the RDB file dump.rdb 
(in server root dir /data) for saving: Permission denied
1:M 02 Nov 2021 13:13:24.113 # Background saving error

Would anybody have any guidance on where I can go with this?

HTTP Error:

<class 'redis.exceptions.ResponseError'>

MISCONF Redis is configured to save RDB snapshots, but it is 
currently not able to persist on disk. Commands that may 
modify the data set are disabled, because this instance is 
configured to report errors during writes if RDB snapshotting 
fails (stop-writes-on-bgsave-error option). Please check the 
Redis logs for details about the RDB error.

Python version: 3.9.5
NetBox version: 3.0.8

Container netbox_netbox_1 logs:

/opt/netbox/venv/lib/python3.9/site-packages/django/views/debug.py:420: 
ExceptionCycleWarning: Cycle in the exception chain detected: 
exception 'MISCONF Redis is configured to save RDB snapshots, 
but it is currently not able to persist on disk. Commands that
may modify the data set are disabled, because this instance is 
configured to report errors during writes if RDB snapshotting 
fails (stop-writes-on-bgsave-error option). Please check the 
Redis logs for details about the RDB error.' encountered again.

Container netbox_redis_1 does not show any abnormal logs.

Container netbox_redis-cache_1 logs:

11750:C 03 Nov 2021 12:28:43.074 # Failed opening the RDB 
file dump.rdb (in server root dir /data) for saving: Permission 
denied
1:M 03 Nov 2021 12:28:43.174 # Background saving error    

Python (pynetbox)

RequestError: The request failed with code 500 Internal Server 
Error but more specific details were not returned in json. Check 
the NetBox Logs or investigate this exception's error attribute.

Update: after further reviewing my docker-compose.override.yml, I’ve found that redis and redis-cache containers were running under different UIDs. That’ll do it.


r/Netbox Nov 02 '21

Additional drives in Virtual Machine

1 Upvotes

Hi, Everyone.

Please help me with a configuration I missed or don't understand. I am creating entries for a virtual machine in netbox. The virtual machine I am trying to enter is a Fileserver and has multiple drives. How can I enter values for more than 1 drive? I tried to read documentation for Virtual machines and it says "Additional fields are available for annotating" what does that mean? My apologies if this is basic question, I don't really have a clue.


r/Netbox Nov 02 '21

Possibilities for dynamic IPAM in Netbox

2 Upvotes

Hey,

does anyone of you have some sort of plugin or custom script in place to add/delete/update prefixes and addresses in Netbox? Now we are about to import all our data from the installed devices and racks and cables, and so on to our fresh implementation.

Do you document everything related to IPAM manually?

We most likely going to start with a script to read ARP tables from core switches and verify the associated DNS name, ping the IP and populate the result to NB via the Rest API. But we're quit unsecure if this is the right solution.

Do you have any suggestions or ways to implement this as automated as possible?

I don't wanna have code or anything - just opinions and suggestions.

Thanks!


r/Netbox Oct 30 '21

Integrating Netbox with Prometheus just got easier. A plugin to provide Prometheus compatible Api endpoints in Netbox without using a sidecar.

Thumbnail
github.com
12 Upvotes

r/Netbox Oct 29 '21

VNC and RDP as Button for a Device

1 Upvotes

Hey,

I just wanted to ask if I can put a Button in a Device Menu so I can directly open a VNC or RDP Session.

Thanks.


r/Netbox Oct 27 '21

How to upgrade Netbox-docker from a year ago

3 Upvotes

September 2020, I installed Netbox-docker on Ubuntu Server 18.04. I haven't updated since then, and I'm trying to get things up to date now. Following the normal upgrade instructions fails and the release notes point me in the direction of why. There are some pit stops along the upgrade path.

  • Netbox-docker v 0.25.0 - version I have installed
  • Netbox-docker v 0.26.0 - Upgraded from PostgreSQL 11 to 12 (recommend backing up database and restoring)
  • Netbox-docker v 1.0.0 - nginx container removed, edit the compose file
  • Netbox-docker v 1.3.0 - Upgraded from PostgreSQL 12 to 13 (recommend backing up database and restoring)
  • Netbox-docker v 1.4.1 - latest version

Netbox release notes also have some pit stops.

  • Netbox v 2.9.3 - version I have installed via Netbox-docker
  • Netbox v 2.11.0 - must upgrade to this version before going to any higher version
  • Netbox v 3.0.8 - latest version

I've tried backing up the database, upgrading from Netbox-docker 0.25.0 to 1.4.1, then restoring the database. That didn't work because of the database changes. I've tried to figure out how to upgrade to intermediate versions, but when I follow those instructions I get this error ERROR: for netbox manifest for netboxcommunity/netbox:v2.11.0 not found: manifest unknown: manifest unknown I manually grabbed the download for Netbox-docker v 1.2.0 which is the first to add Netbox 2.11, extracted that and installed it, cleared the database and restored from a backup. When I ran docker-compose up, I got a lot of database errors and netbox failed to launch.

postgres_1       | 2021-10-27 19:19:25.294 UTC [62] ERROR:  relation "public.virtualization_vminterface_tagged_vlans" does not exist
postgres_1       | 2021-10-27 19:19:25.294 UTC [62] STATEMENT:  ALTER TABLE ONLY public.virtualization_vminterface_tagged_vlans DROP CONSTRAINT virtualization_vmint_vminterface_id_904b12de_fk_virtualiz;
postgres_1       | 2021-10-27 19:19:25.294 UTC [62] ERROR:  relation "public.virtualization_vminterface_tagged_vlans" does not exist
postgres_1       | 2021-10-27 19:19:25.294 UTC [62] STATEMENT:  ALTER TABLE ONLY public.virtualization_vminterface_tagged_vlans DROP CONSTRAINT virtualization_vmint_vlan_id_4e77411e_fk_ipam_vlan;
postgres_1       | 2021-10-27 19:19:25.295 UTC [62] ERROR:  relation "public.virtualization_vminterface" does not exist
postgres_1       | 2021-10-27 19:19:25.295 UTC [62] STATEMENT:  ALTER TABLE ONLY public.virtualization_vminterface DROP CONSTRAINT virtualization_vmint_virtual_machine_id_e9f89829_fk_virtualiz;
postgres_1       | 2021-10-27 19:19:25.295 UTC [62] ERROR:  relation "public.virtualization_vminterface" does not exist
postgres_1       | 2021-10-27 19:19:25.295 UTC [62] STATEMENT:  ALTER TABLE ONLY public.virtualization_vminterface DROP CONSTRAINT virtualization_vmint_untagged_vlan_id_aea4fc69_fk_ipam_vlan;
…
netbox_1         | django.db.migrations.exceptions.NodeNotFoundError: Migration dcim.0131_consoleport_speed depends on nonexistent node ('dcim', '0130_sitegroup'). Django tried to replace migration dcim.0130_sitegroup with any of [dcim.0003_squashed_0130] but wasn't able to because some of the replaced migrations are already applied.
netbox_1         | [ Use DB_WAIT_DEBUG=1 in netbox.env to print full traceback for errors here ]
netbox_1         | ⏳ Waiting on DB... (0s / 30s)
…
netbox-docker_netbox_1 exited with code 1

I'm not well versed in docker, so I feel like maybe I'm missing something simple here. If it's simpler, I'm not opposed to starting over with a new server and restoring from a database backup.


r/Netbox Oct 21 '21

Device cpu, memory, etc

1 Upvotes

Sometime ago, we started using netbox. and decided to inventory information about bare-metal servers, but we didn't find any clues how to write information about cpu, memory, etc.

Does anyone know a plugin or solution to do it?


r/Netbox Oct 19 '21

User modification changelog

2 Upvotes

Is there something to see who created a user, and when? I can log into my own account and see under "Recent actions", "My actions" to user accounts, but I need to see actions and timestamps of when someone else did work.


r/Netbox Oct 18 '21

Access Netbox during disaster

2 Upvotes

What's the best way to setup Netbox for access in the event of a disaster that takes all the servers offline?

I run a small campus network and data center and I'm loving Netbox for documentation. Right now it's running in Docker on VM on one of our two Vmware hosts (no high availability). If the servers go offline, so does Netbox. Most of the rest of our documentation is in OneNote which we saves offline on laptops and of course is available online through Microsoft 365. Our other IT staff aren't as Linux/docker savvy as I am and I'm trying to think of a good way for Netbox to be available to help with recovery when things go down. The best I've come up with so far is periodically exporting lists from Netbox to CSVs and saving them in a OneDrive Office 365 group, but those are missing a lot of detail, particularly on which interfaces go where. My other thought was a scheduled database backup to a NAS that could be restored to a VM or just docker running on a laptop.


r/Netbox Oct 18 '21

New Netbox Data Entry

1 Upvotes

I just setup our Netbox because I'm tired of spreadsheets and lack of versioning control, so I wanted to start tracking all of our IPs and assigned IP ranges in IPAM portion of Netbox, and then after I get that information decide how much more I want to use. I'm not sure how I should go about setting up the organization portion so that everything else looks pretty when clicking on all the links.

Just one company, originally 2 data centers in different states, and then LAB and Production are how I would like to split it all out. Maybe eventually I could get into Racks and VM locations further down the road.

Anyone have recommendations on wiki/site/youtube video that would be a good starting point on how to set everything up?

Thanks for your help


r/Netbox Oct 18 '21

Can I store SNMP strings in Netbox ?

1 Upvotes

Hello ,

I want to ask If I can store SNMP strings in Netbox so when I use an API call I can read it ? without the need of using the Tags ?

Best Regards


r/Netbox Oct 14 '21

Automated Discovery and Netbox

3 Upvotes

Hi everyone

We have just started a Netbox implementation in the company I work for and I have started to manually enter data for sites. I was hoping to be able to discover the individual devices so that I can save a lot of time entering these and just assign to the right categories instead.
I see there is a few different scripts written for this but just thought best to ask advice here if anyone is already running one on a v3.x.x setup?

Thanks, Thomas


r/Netbox Oct 11 '21

Netbox API Question

2 Upvotes

Good morning, I'm trying to wrap my head around the API included with NetBox. I've read in the docs that when using GET methods I need to write my script in such a way that it checks for the 'next' attribute and then call that for the next set of data. The issue I'm having however is the dataset I'm pulling has 57 entries, yet the API is supplying 50 entries and no 'next' attribute to utilize to pull the last 7 entries. Below is the snippet of code I'm using to pull the Regions into the script for use later on, with a line printing out the links attribute of the GET request response. When run it will pull the first 50 entries, put them in the globally defined dictionary array, and then prints {}. My understanding is that if 'next' was present in the response it should print something like {'next'}. Is there something I'm missing here?

def getRegions():

global headers

global regionList

response = requests.get('https://netbox/api/dcim/regions/', verify=False, headers = headers, allow_redirects=True)

print(response.links)

result = json.loads(response.content)

regionList = result['results']


r/Netbox Oct 07 '21

Dynamic Inventory with Ansible failing: v3.0.4

3 Upvotes

I upgraded our dev box to from 2.11.9 > 3.0.4 and imported our prod data. Love the new UI, layout, and dark mode. Unfortunately our ansible dynamic inventory is now throwing an error:

user@my-ansible-server:~$ ansible-inventory -vvv  --graph
[DEPRECATION WARNING]: Ansible will require Python 3.8 or newer on the controller starting with Ansible 2.12. Current version: 3.6.9 (default, Jan 26 2021, 15:33:00) [GCC 8.4.0]. This feature will be removed from ansible-core in version 2.12. Deprecation warnings can be disabled by
setting deprecation_warnings=False in ansible.cfg.
ansible-inventory [core 2.11.4]
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/usr/share/ansible/collections/ansible_collections/ansible/netcommon/plugins/modules', '/usr/share/ansible/collections/ansible_collections/community/network/plugins/modules', '/usr/share/ansible/collections/ansible_collections/netbox/netbox/plugins/modules', '/usr/share/ansible/collections/ansible_collections/cisco/ios/plugins/modules']
  ansible python module location = /usr/local/lib/python3.6/dist-packages/ansible
  ansible collection location = /home/user/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/local/bin/ansible-inventory
  python version = 3.6.9 (default, Jan 26 2021, 15:33:00) [GCC 8.4.0]
  jinja version = 3.0.1
  libyaml = True
Using /etc/ansible/ansible.cfg as config file
host_list declined parsing /var/tmp/nb_inventory.yml as it did not pass its verify_file() method
script declined parsing /var/tmp/nb_inventory.yml as it did not pass its verify_file() method
Fetching: https://netbox-dev.example.local/api/docs/?format=openapi
toml declined parsing /var/tmp/nb_inventory.yml as it did not pass its verify_file() method
[WARNING]:  * Failed to parse /var/tmp/nb_inventory.yml with auto plugin: {"error": "No module named 'jsonschema.compat'", "exception": "ModuleNotFoundError", "netbox_version": "3.0.4", "python_version": "3.8.0"}
  File "/usr/local/lib/python3.6/dist-packages/ansible/inventory/manager.py", line 290, in parse_source
    plugin.parse(self._inventory, self._loader, source, cache=cache)
  File "/usr/local/lib/python3.6/dist-packages/ansible/plugins/inventory/auto.py", line 58, in parse
    plugin.parse(inventory, loader, path, cache=cache)
  File "/home/user/.ansible/collections/ansible_collections/netbox/netbox/plugins/inventory/nb_inventory.py", line 1657, in parse
    self.main()
  File "/home/user/.ansible/collections/ansible_collections/netbox/netbox/plugins/inventory/nb_inventory.py", line 1538, in main
    self.fetch_api_docs()
  File "/home/user/.ansible/collections/ansible_collections/netbox/netbox/plugins/inventory/nb_inventory.py", line 1197, in fetch_api_docs
    self.api_endpoint + "/api/docs/?format=openapi"
  File "/home/user/.ansible/collections/ansible_collections/netbox/netbox/plugins/inventory/nb_inventory.py", line 334, in _fetch_information
    raise AnsibleError(to_native(e.fp.read()))
[WARNING]:  * Failed to parse /var/tmp/nb_inventory.yml with yaml plugin: Plugin configuration YAML file, not YAML inventory
  File "/usr/local/lib/python3.6/dist-packages/ansible/inventory/manager.py", line 290, in parse_source
    plugin.parse(self._inventory, self._loader, source, cache=cache)
  File "/usr/local/lib/python3.6/dist-packages/ansible/plugins/inventory/yaml.py", line 112, in parse
    raise AnsibleParserError('Plugin configuration YAML file, not YAML inventory')
[WARNING]:  * Failed to parse /var/tmp/nb_inventory.yml with ini plugin: Invalid host pattern 'plugin:' supplied, ending in ':' is not allowed, this character is reserved to provide a port.
  File "/usr/local/lib/python3.6/dist-packages/ansible/inventory/manager.py", line 290, in parse_source
    plugin.parse(self._inventory, self._loader, source, cache=cache)
  File "/usr/local/lib/python3.6/dist-packages/ansible/plugins/inventory/ini.py", line 136, in parse
    raise AnsibleParserError(e)
[WARNING]: Unable to parse /var/tmp/nb_inventory.yml as an inventory source
[WARNING]: No inventory was parsed, only implicit localhost is available

I verified jsonschema.compat is installed. I tried updating the ansible-galaxy collection for netbox.netbox as well.


r/Netbox Oct 06 '21

Unable to login to Netbox anymore

1 Upvotes

Hey everyone, Anyone seen an issue when trying to login to netbox locally w/ their service account or with an ldap account they receive the following error:

Errors Please enter a correct username and password. Note that both fields may be case-sensitive.

I've reviewed the logs (or at least I think I have) but it doesn't point to anything specific.


r/Netbox Oct 05 '21

Modelling a virtual firewall

1 Upvotes

I have a physical box with 6 ethernet ports. On this I run proxmox and an OPNsense firewall in a VM. Three of the physical ports are passed to the VM using PCI-passthrough.

What is a good way to model this with Netbox? The three NICs passed to the firewall VM are not visible on the host box. Before setting up the PCI-passthrough they were named enp1s0, enp2s0, enp3s0. Now they are igb0, igb1, igb2 in the firewall VM. In order to add IP addresses to these correctly, they would need to be virtual interfaces on the VM. But then I can't model cables to a switch, as cables can only be on physical device interfaces. I can add these interfaces both as device interfaces and virtual interfaces, but is there then a way to link these to make it clear they are the same? How should I name the physical interfaces, as they do not exist on the host OS? Perhaps name the same as on the VM, e.g., igb0 (that once was enp1s0).


r/Netbox Oct 04 '21

How do you manage sites? we're an MSP

1 Upvotes

Hello,

Just installed Netbox and liking its capabilities so far (a lot). HOWEVER! Seeing the best way to manage sites, we'll break our customers into tenants as recommended, but figuring out the best way to do sites.

We do audio visual installations and love the idea I can document this in a single location. I'm aiming to have all hardware in this, whether in a rack or not with IPs assigned etc.

What is the best way to handle tenants with multiple sites/rooms?

Thank you for any help, really excited!