From 4c49cad744978262e4f84e7b1801bf9d468d4770 Mon Sep 17 00:00:00 2001 From: Nicolas Boufidjeline Date: Wed, 11 Jul 2018 16:50:02 +0200 Subject: [PATCH 1/4] Add auth-ldap-user-dn-template in ldap_config.py --- configuration/ldap_config.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/configuration/ldap_config.py b/configuration/ldap_config.py index c7e0d3b..51eed08 100644 --- a/configuration/ldap_config.py +++ b/configuration/ldap_config.py @@ -15,6 +15,9 @@ AUTH_LDAP_CONNECTION_OPTIONS = { AUTH_LDAP_BIND_DN = os.environ.get('AUTH_LDAP_BIND_DN', '') AUTH_LDAP_BIND_PASSWORD = os.environ.get('AUTH_LDAP_BIND_PASSWORD', '') +# Set AUTH_LDAP_USER_DN_TEMPLATE +AUTH_LDAP_USER_DN_TEMPLATE = os.environ.get('AUTH_LDAP_USER_DN_TEMPLATE', '') + # Include this setting if you want to ignore certificate errors. This might be needed to accept a self-signed cert. # Note that this is a NetBox-specific setting which sets: # ldap.set_option(ldap.OPT_X_TLS_REQUIRE_CERT, ldap.OPT_X_TLS_NEVER) From 5f24972bb78775814d78c916f988735a03db6fa8 Mon Sep 17 00:00:00 2001 From: Nicolas Boufidjeline Date: Fri, 20 Jul 2018 12:21:47 +0200 Subject: [PATCH 2/4] Change default value of AUTH_LDAP_USER_DN_TEMPLATE --- configuration/ldap_config.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configuration/ldap_config.py b/configuration/ldap_config.py index 51eed08..86442d5 100644 --- a/configuration/ldap_config.py +++ b/configuration/ldap_config.py @@ -16,7 +16,7 @@ AUTH_LDAP_BIND_DN = os.environ.get('AUTH_LDAP_BIND_DN', '') AUTH_LDAP_BIND_PASSWORD = os.environ.get('AUTH_LDAP_BIND_PASSWORD', '') # Set AUTH_LDAP_USER_DN_TEMPLATE -AUTH_LDAP_USER_DN_TEMPLATE = os.environ.get('AUTH_LDAP_USER_DN_TEMPLATE', '') +AUTH_LDAP_USER_DN_TEMPLATE = os.environ.get('AUTH_LDAP_USER_DN_TEMPLATE', None) # Include this setting if you want to ignore certificate errors. This might be needed to accept a self-signed cert. # Note that this is a NetBox-specific setting which sets: From 9d1a602f71ec192ceb43de4809d6170617b06357 Mon Sep 17 00:00:00 2001 From: Nicolas Boufidjeline Date: Fri, 20 Jul 2018 12:24:17 +0200 Subject: [PATCH 3/4] Update ldap_config.py --- configuration/ldap_config.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configuration/ldap_config.py b/configuration/ldap_config.py index 86442d5..0465c45 100644 --- a/configuration/ldap_config.py +++ b/configuration/ldap_config.py @@ -15,7 +15,7 @@ AUTH_LDAP_CONNECTION_OPTIONS = { AUTH_LDAP_BIND_DN = os.environ.get('AUTH_LDAP_BIND_DN', '') AUTH_LDAP_BIND_PASSWORD = os.environ.get('AUTH_LDAP_BIND_PASSWORD', '') -# Set AUTH_LDAP_USER_DN_TEMPLATE +# Set a string template that describes any user’s distinguished name based on the username. AUTH_LDAP_USER_DN_TEMPLATE = os.environ.get('AUTH_LDAP_USER_DN_TEMPLATE', None) # Include this setting if you want to ignore certificate errors. This might be needed to accept a self-signed cert. From cb37e3ba92db4cc3d323f01d47997510839ba589 Mon Sep 17 00:00:00 2001 From: Stefan Schlesinger Date: Tue, 24 Jul 2018 10:56:46 +0200 Subject: [PATCH 4/4] Update docker-entrypoint.sh MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Make netbox-docker function with v2.4-beta1 again, fixes #84. > The shell --plain option is deprecated in favor of -i python or --interface python. > The shell --interface option now accepts python to force use of the “plain” Python interpreter. https://docs.djangoproject.com/en/2.0/releases/1.10/#deprecated-features-1-10 --- docker/docker-entrypoint.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docker/docker-entrypoint.sh b/docker/docker-entrypoint.sh index a921bd9..4cef815 100755 --- a/docker/docker-entrypoint.sh +++ b/docker/docker-entrypoint.sh @@ -31,7 +31,7 @@ fi echo "💡 Username: ${SUPERUSER_NAME}, E-Mail: ${SUPERUSER_EMAIL}" -./manage.py shell --plain << END +./manage.py shell --interface python << END from django.contrib.auth.models import User from users.models import Token if not User.objects.filter(username='${SUPERUSER_NAME}'): @@ -41,7 +41,7 @@ END for script in /opt/netbox/startup_scripts/*.py; do echo "⚙️ Executing '$script'" - ./manage.py shell --plain < "${script}" + ./manage.py shell --interface python < "${script}" done # copy static files