Netbox 3.0.2 with LDAP - local accounts not able to login after upgrade #7258
Replies: 3 comments 12 replies
-
I recently upgraded my instance from 2.11.12 to 3.0.2 as well, and I am using a mixture of LDAP and local accounts. No problems with either after upgrade. If you can post your configuration.py and ldap_config.py (with your domain names and passwords obfuscated), I can try to reproduce the problem. |
Beta Was this translation helpful? Give feedback.
-
The issue seems to be with authentication between Netbox and Redis. Is your Redis server configured to require authentication? And if so, does the REDIS block in configuration.py have the correct settings? You could test this further by exercising something else which requires redis, e.g. webhooks. There is a smoking gun here in your backtrace:
Now, this should say
I suggest the problem isn't really the difference between LDAP users and local users; it's the difference between staff/superuser and non-staff/non-superuser. And it's this redis query which is causing the problem. (*) When quoting console captures in github, put three backticks ( |
Beta Was this translation helpful? Give feedback.
-
I have a similar issue without the tracebacks. I can login to a local account in the GUI, but if I try to use a token assigned to them I get "User inactive" and it immediately deactivates the local account. I wonder if the order of the check in TokenAuthentication authenticate_credentials might be reversed? It's doing an 'is_active' check before finding if a user exists in ldap. I think the ldap backend might be returning no for 'is_active' because the user doesn't exist in LDAP. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Netbox version: 3.0.2
Python: 3.9.5
Redis: 4.0.14
So, we upgraded our first instance of 2.11.12 (dev and training instances) that have LDAP connectivity, and all seems to work fine, using AD-accounts logging in.
However, we have a few local accounts that we use for various reasons, and trying to login with these generates the following error:

Disabling LDAP, and the local accounts works as they should.
Are there any changes in parameters that are needed to be able to log in with both LDAP and local accounts? trace below:
`Django Version: 3.2.7
Python Version: 3.9.5
Installed Applications:
['django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.humanize',
'corsheaders',
'debug_toolbar',
'graphiql_debug_toolbar',
'django_filters',
'django_tables2',
'django_prometheus',
'graphene_django',
'mptt',
'rest_framework',
'taggit',
'timezone_field',
'circuits',
'dcim',
'ipam',
'extras',
'tenancy',
'users',
'utilities',
'virtualization',
'django_rq',
'drf_yasg']
Installed Middleware:
['graphiql_debug_toolbar.middleware.DebugToolbarMiddleware',
'django_prometheus.middleware.PrometheusBeforeMiddleware',
'corsheaders.middleware.CorsMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
'django.middleware.security.SecurityMiddleware',
'netbox.middleware.ExceptionHandlingMiddleware',
'netbox.middleware.RemoteUserMiddleware',
'netbox.middleware.LoginRequiredMiddleware',
'netbox.middleware.APIVersionMiddleware',
'netbox.middleware.ObjectChangeMiddleware',
'django_prometheus.middleware.PrometheusAfterMiddleware']
Traceback (most recent call last):
The above exception (Authentication required.) was the direct cause of the following exception:
File "/opt/netbox/venv/lib/python3.9/site-packages/django_redis/cache.py", line 31, in _decorator
return method(self, *args, **kwargs)
File "/opt/netbox/venv/lib/python3.9/site-packages/django_redis/cache.py", line 98, in _get
return self.client.get(key, default=default, version=version, client=client)
File "/opt/netbox/venv/lib/python3.9/site-packages/django_redis/client/default.py", line 260, in get
raise ConnectionInterrupted(connection=client) from e
During handling of the above exception (Redis AuthenticationError: Authentication required.), another exception occurred:
File "/opt/netbox/venv/lib/python3.9/site-packages/django/core/handlers/exception.py", line 47, in inner
response = get_response(request)
File "/opt/netbox/venv/lib/python3.9/site-packages/django/core/handlers/base.py", line 181, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/opt/netbox/venv/lib/python3.9/site-packages/django/views/generic/base.py", line 70, in view
return self.dispatch(request, *args, **kwargs)
File "/opt/netbox/venv/lib/python3.9/site-packages/django/views/generic/base.py", line 98, in dispatch
return handler(request, *args, **kwargs)
File "/opt/netbox/netbox/netbox/views/init.py", line 136, in get
latest_release = cache.get('latest_release')
File "/opt/netbox/venv/lib/python3.9/site-packages/django_redis/cache.py", line 91, in get
value = self._get(key, default, version, client)
File "/opt/netbox/venv/lib/python3.9/site-packages/django_redis/cache.py", line 38, in _decorator
raise e.cause
File "/opt/netbox/venv/lib/python3.9/site-packages/django_redis/client/default.py", line 258, in get
value = client.get(key)
File "/opt/netbox/venv/lib/python3.9/site-packages/redis/client.py", line 1606, in get
return self.execute_command('GET', name)
File "/opt/netbox/venv/lib/python3.9/site-packages/redis/client.py", line 898, in execute_command
conn = self.connection or pool.get_connection(command_name, **options)
File "/opt/netbox/venv/lib/python3.9/site-packages/redis/connection.py", line 1192, in get_connection
connection.connect()
File "/opt/netbox/venv/lib/python3.9/site-packages/redis/connection.py", line 567, in connect
self.on_connect()
File "/opt/netbox/venv/lib/python3.9/site-packages/redis/connection.py", line 664, in on_connect
if nativestr(self.read_response()) != 'OK':
File "/opt/netbox/venv/lib/python3.9/site-packages/redis/connection.py", line 739, in read_response
response = self._parser.read_response()
File "/opt/netbox/venv/lib/python3.9/site-packages/redis/connection.py", line 340, in read_response
raise error
Exception Type: AuthenticationError at /ipam-dev/
Exception Value: Authentication required.`
Beta Was this translation helpful? Give feedback.
All reactions