NetBox LDAP Troubleshooting/logging

3,726 views
Skip to first unread message

David Abarca

unread,
Aug 29, 2018, 5:04:21 AM8/29/18
to NetBox
Hi!

I've been trying to get the LDAP integration to work but with little success.

So far I haven't even got the logging to work properly, and I'm starting to wonder if I've even configured my ldap_config.py at the right path.

/opt/netbox/netbox/netbox/ldap_config.py

Logging Contents
...
# Logging details
import logging, logging.handlers
logfile
= "/var/log/netbox/django-ldap-debug.log"
my_logger
= logging.getLogger('django_auth_ldap')
my_logger
.setLevel(logging.DEBUG)
handler
= logging.handlers.RotatingFileHandler(
logfile
, maxBytes=1024 * 500, backupCount=5)
my_logger
.addHandler(handler)

User rights (/var/log/netbox)
drwxr-xr-x   2 www-data  domain_grp            4096 Aug 29 10:49 netbox/

Do I need to enforce LDAP authentication other than just adding the file to the /opt/netbox/netbox/netbox/ldap_config.py path?

I've also noticed this on the Django debug output when looking at the settings for the site, and currently "LDAP_IGNORE_CERT_ERRORS = True" is configured.

LDAP_CONFIGUREDFalse
LDAP_IGNORE_CERT_ERRORSFalse

Any help is greatly appreciated.

// David

Andrew Hunkin

unread,
Aug 29, 2018, 5:19:12 AM8/29/18
to david.a...@gmail.com, netbox-...@googlegroups.com
I assume you've followed this? Installed all the required packages?

Also, if you stop netbox and run: 
gunicorn -c /opt/netbox/gunicorn_config.py netbox.wsgi

And then try to log in, does it give you any errors on the console?



--
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 post to this group, send email to netbox-...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/netbox-discuss/72bdd5fb-3706-4bfb-a1cf-a086a88d2c91%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Message has been deleted

David Abarca

unread,
Aug 29, 2018, 6:21:21 AM8/29/18
to NetBox
Yes the packages are installed properly without any errors.

Regarding the command below it does produce errors:
user@ipm01:/opt/netbox/netbox$ gunicorn -/opt/netbox/gunicorn_config.py netbox.wsgi
[2018-08-29 12:01:52 +0200] [10996] [INFO] Starting gunicorn 19.9.0
[2018-08-29 12:01:52 +0200] [10996] [ERROR] Connection in use: ('127.0.0.1', 8001)
[2018-08-29 12:01:52 +0200] [10996] [ERROR] Retrying in 1 second.
[2018-08-29 12:01:53 +0200] [10996] [ERROR] Connection in use: ('127.0.0.1', 8001)
[2018-08-29 12:01:53 +0200] [10996] [ERROR] Retrying in 1 second.
[2018-08-29 12:01:54 +0200] [10996] [ERROR] Connection in use: ('127.0.0.1', 8001)
[2018-08-29 12:01:54 +0200] [10996] [ERROR] Retrying in 1 second.
[2018-08-29 12:01:55 +0200] [10996] [ERROR] Connection in use: ('127.0.0.1', 8001)
[2018-08-29 12:01:55 +0200] [10996] [ERROR] Retrying in 1 second.
[2018-08-29 12:01:56 +0200] [10996] [ERROR] Connection in use: ('127.0.0.1', 8001)
[2018-08-29 12:01:56 +0200] [10996] [ERROR] Retrying in 1 second.
[2018-08-29 12:01:57 +0200] [10996] [ERROR] Can't connect to ('127.0.0.1', 8001)

Digging bit more into nginx I see the following:
2018/08/29 09:54:47 [error] 2893#2893: *14 connect() failed (111: Connection refused) while connecting to upstream, client: 172.23.100.10, server: netbox.domain.nu, request: "GET /login/ HTTP/1.1", upstream: "http://127.0.0.1:8001/login/", host: "netbox.domain.nu"
2018/08/29 09:54:52 [error] 2893#2893: *14 connect() failed (111: Connection refused) while connecting to upstream, client: 172.23.100.10, server: netbox.domain.nu, request: "GET / HTTP/1.1", upstream: "http://127.0.0.1:8001/", host: "netbox.domain.nu"

Other than the LDAP-auth the server appears to be functioning with local accounts and adding/removing objects.

// David

Andrew Hunkin

unread,
Aug 29, 2018, 6:26:38 AM8/29/18
to David Abarca, NetBox
That's odd. 

Did you stop Netbox before running that?
(If so, ignore the below)

You'll need to do: 
sudo supervisorctl stop netbox


Then you'll need to run: 
gunicorn -/opt/netbox/gunicorn_config.py netbox.wsgi 


Then try logging in with ldap again and see what it says .

David Abarca

unread,
Aug 29, 2018, 7:16:28 AM8/29/18
to NetBox
I just stopped the netbox service and now there are no errors with the command.

user@ipm01:/var/log/netbox$ sudo supervisorctl stop netbox

user@ipm01:/var/log/netbox$ sudo gunicorn -c /opt/netbox/gunicorn_config.py netbox.wsgi
[2018-08-29 13:08:50 +0200] [11558] [INFO] Starting gunicorn 19.9.0
[2018-08-29 13:08:50 +0200] [11558] [INFO] Listening at: http://127.0.0.1:8001 (11558)
[2018-08-29 13:08:50 +0200] [11558] [INFO] Using worker: sync
[2018-08-29 13:08:50 +0200] [11561] [INFO] Booting worker with pid: 11561
[2018-08-29 13:08:50 +0200] [11562] [INFO] Booting worker with pid: 11562
[2018-08-29 13:08:50 +0200] [11565] [INFO] Booting worker with pid: 11565

Same output from Django:
DAP_CONFIGUREDFalse
LDAP_IGNORE_CERT_ERRORSFalse

// David
Reply all
Reply to author
Forward
0 new messages