LDAP error

72 views
Skip to first unread message

Sea Stone

unread,
Jan 6, 2021, 8:06:27 PM1/6/21
to NetBox
Try to set up LDAP access. I get the following error.

There was a problem with your request. Please contact an administrator.

The complete exception is provided below:

<class 'django.core.exceptions.ImproperlyConfigured'>
LDAP authentication has been configured, but django-auth-ldap is not installed. Python version: 3.8.5 NetBox version: 2.9.11 

But I do install the   django-auth-ldap module, following the instructions.

source /opt/netbox/venv/bin/activate 
pip3 install django-auth-ldap 

The only error I got was if I used "pip3 install django-auth-ldap"
.....
Installing collected packages: pyasn1, pyasn1-modules, python-ldap, django-auth-ldap
ERROR: Could not install packages due to an EnvironmentError: [Errno 13] Permission denied: '/opt/netbox-2.9.11/venv/lib/python3.8/site-packages/pyasn1'
Consider using the `--user` option or check the permissions.

but I used "sudo pip3 install django-auth-ldap", I do not get any error.
(venv) xuan@fre-netbox-2:/opt/netbox/netbox/netbox$ sudo pip3 install django-auth-ldap
Requirement already satisfied: django-auth-ldap in /usr/local/lib/python3.8/dist-packages (2.2.0)
Requirement already satisfied: Django>=1.11 in /usr/local/lib/python3.8/dist-packages (from django-auth-ldap) (3.1.5)
Requirement already satisfied: python-ldap>=3.1 in /usr/local/lib/python3.8/dist-packages (from django-auth-ldap) (3.3.1)
Requirement already satisfied: asgiref<4,>=3.2.10 in /usr/local/lib/python3.8/dist-packages (from Django>=1.11->django-auth-ldap) (3.3.1)
Requirement already satisfied: pytz in /usr/local/lib/python3.8/dist-packages (from Django>=1.11->django-auth-ldap) (2020.5)
Requirement already satisfied: sqlparse>=0.2.2 in /usr/local/lib/python3.8/dist-packages (from Django>=1.11->django-auth-ldap) (0.4.1)
Requirement already satisfied: pyasn1>=0.3.7 in /usr/lib/python3/dist-packages (from python-ldap>=3.1->django-auth-ldap) (0.4.2)
Requirement already satisfied: pyasn1-modules>=0.1.5 in /usr/lib/python3/dist-packages (from python-ldap>=3.1->django-auth-ldap) (0.2.1)

How to fix this issue ?

Thanks a lot


 

Rob Duffy

unread,
Jan 6, 2021, 9:20:31 PM1/6/21
to Sea Stone, NetBox
Try running it with sudo. You're getting a permissions error during the install. 

--
You received this message because you are subscribed to the Google Groups "NetBox" group.
To unsubscribe from this group and stop receiving emails from it, send an email to netbox-discus...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/netbox-discuss/f431a419-4b86-4651-9552-7f9387eeacfen%40googlegroups.com.

Brian Candler

unread,
Jan 7, 2021, 5:04:32 AM1/7/21
to NetBox
Note, you will need "sudo -E" if you activate the venv before running pip:

source /opt/netbox/venv/bin/activate 
sudo -E pip3 install django-auth-ldap 

The other way is to start with a root shell (or ssh directly in as root):

sudo -s
source /opt/netbox/venv/bin/activate 
pip3 install django-auth-ldap 

And remember to add this to local_requirements.txt, so that on upgrade when the venv is rebuilt, the package is re-added.

Sea Stone

unread,
Jan 7, 2021, 12:02:49 PM1/7/21
to NetBox
Thanks Brian

The second method works. I do not see the error again.

But the authentication over LDAP is still not working, only work on the local account.

Where shall I start to troubleshoot this issue ?

Regards
Reply all
Reply to author
Forward
0 new messages