Commit 0b30b0a5 authored by Jens Langhammer's avatar Jens Langhammer

apply LDAP settings

parent 27b9a29e
Pipeline #3376 failed with stage
in 4 minutes and 56 seconds
......@@ -16,14 +16,16 @@ import socket
import sys
from urllib.parse import urlparse
import ldap
from django_auth_ldap.config import LDAPSearch
from pyazo import __version__
from pyazo.utils.config import CONFIG
LOGGER = logging.getLogger(__name__)
SECURE_PROXY_SSL_HEADER = tuple(CONFIG.get('secure_proxy_header', {}).items())[0]
SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
......@@ -84,6 +86,18 @@ CELERY_IMPORTS = ('pyazo.core.tasks', )
# INFLUXDB_TIMEOUT = 5
# INFLUXDB_USE_CELERY = True
# LDAP Settings
with CONFIG.cd('ldap'):
if CONFIG.get('enabled'):
AUTH_LDAP_SERVER_URI = CONFIG.get('server').get('uri')
AUTH_LDAP_START_TLS = CONFIG.get('server').get('tls')
AUTH_LDAP_BIND_DN = CONFIG.get('bind').get('dn')
AUTH_LDAP_BIND_PASSWORD = CONFIG.get('bind').get('password')
AUTH_LDAP_USER_SEARCH = LDAPSearch(CONFIG.get('search_base'),
ldap.SCOPE_SUBTREE, CONFIG.get('filter'))
if CONFIG.get('require_group'):
AUTH_LDAP_REQUIRE_GROUP = CONFIG.get('require_group')
ACCOUNT_EMAIL_VERIFICATION = 'none'
with CONFIG.cd('web'):
......@@ -278,6 +292,11 @@ with CONFIG.cd('log'):
'level': 'WARNING',
'propagate': True,
},
'django_auth_ldap': {
'handlers': ['console', 'file'],
'level': 'DEBUG',
'propagate': True,
},
}
}
......
......@@ -21,8 +21,6 @@ web:
port: 8000
threads: 30
debug: false
secure_proxy_header:
HTTP_X_FORWARDED_PROTO: https
redis: localhost
# Error reporting, disabled by default
error_report_enabled: false
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment