Merge branch 'mryauch-patch-1' of https://github.com/mryauch/netbox-docker into mryauch-mryauch-patch-1
This commit is contained in:
commit
8f39034014
@ -104,6 +104,7 @@ If a secret is defined by an environment variable and in the respective file at
|
|||||||
* `EMAIL_PASSWORD`: `/run/secrets/email_password`
|
* `EMAIL_PASSWORD`: `/run/secrets/email_password`
|
||||||
* `NAPALM_PASSWORD`: `/run/secrets/napalm_password`
|
* `NAPALM_PASSWORD`: `/run/secrets/napalm_password`
|
||||||
* `REDIS_PASSWORD`: `/run/secrets/redis_password`
|
* `REDIS_PASSWORD`: `/run/secrets/redis_password`
|
||||||
|
* `AUTH_LDAP_BIND_PASSWORD`: `/run/secrets/auth_ldap_bind_password`
|
||||||
|
|
||||||
Please also consider [the advice about running Netbox in production](#production) above!
|
Please also consider [the advice about running Netbox in production](#production) above!
|
||||||
|
|
||||||
|
@ -3,6 +3,16 @@ import os
|
|||||||
|
|
||||||
from django_auth_ldap.config import LDAPSearch, GroupOfNamesType
|
from django_auth_ldap.config import LDAPSearch, GroupOfNamesType
|
||||||
|
|
||||||
|
# Read secret from file
|
||||||
|
def read_secret(secret_name):
|
||||||
|
try:
|
||||||
|
f = open('/run/secrets/' + secret_name, 'r', encoding='utf-8')
|
||||||
|
except EnvironmentError:
|
||||||
|
return ''
|
||||||
|
else:
|
||||||
|
with f:
|
||||||
|
return f.readline().strip()
|
||||||
|
|
||||||
# Server URI
|
# Server URI
|
||||||
AUTH_LDAP_SERVER_URI = os.environ.get('AUTH_LDAP_SERVER_URI', '')
|
AUTH_LDAP_SERVER_URI = os.environ.get('AUTH_LDAP_SERVER_URI', '')
|
||||||
|
|
||||||
@ -13,7 +23,7 @@ AUTH_LDAP_CONNECTION_OPTIONS = {
|
|||||||
|
|
||||||
# Set the DN and password for the NetBox service account.
|
# Set the DN and password for the NetBox service account.
|
||||||
AUTH_LDAP_BIND_DN = os.environ.get('AUTH_LDAP_BIND_DN', '')
|
AUTH_LDAP_BIND_DN = os.environ.get('AUTH_LDAP_BIND_DN', '')
|
||||||
AUTH_LDAP_BIND_PASSWORD = os.environ.get('AUTH_LDAP_BIND_PASSWORD', '')
|
AUTH_LDAP_BIND_PASSWORD = os.environ.get('AUTH_LDAP_BIND_PASSWORD', read_secret('auth_ldap_bind_password'))
|
||||||
|
|
||||||
# Set a string template that describes any user’s distinguished name based on the username.
|
# 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)
|
AUTH_LDAP_USER_DN_TEMPLATE = os.environ.get('AUTH_LDAP_USER_DN_TEMPLATE', None)
|
||||||
|
Loading…
Reference in New Issue
Block a user