Enable ldap support

This commit is contained in:
Girish Ramakrishnan 2019-07-18 09:50:17 -07:00
parent 2a276924dd
commit 756f203006
2 changed files with 20 additions and 8 deletions

View file

@ -22,14 +22,14 @@ SMTP_PASSWORD=
SMTP_AUTH_METHOD=plain SMTP_AUTH_METHOD=plain
SMTP_OPENSSL_VERIFY_MODE=none SMTP_OPENSSL_VERIFY_MODE=none
# LDAP_ENABLED=$([ -z "${CLOUDRON_LDAP_SERVER}" ] && echo "false" || echo "true") LDAP_ENABLED=
# LDAP_HOST=${CLOUDRON_LDAP_SERVER} LDAP_HOST=
# LDAP_PORT=${CLOUDRON_LDAP_PORT} LDAP_PORT=
# LDAP_BASE=${CLOUDRON_LDAP_USERS_BASE_DN} LDAP_BASE=
# LDAP_BIND_DN=${CLOUDRON_LDAP_BIND_DN} LDAP_BIND_DN=
# LDAP_PASSWORD=${CLOUDRON_LDAP_BIND_PASSWORD} LDAP_PASSWORD=
# LDAP_UID=username LDAP_UID=username
# LDAP_SEARCH_FILTER=(|(%{uid}=%{email})(mail=%{email})) LDAP_SEARCH_FILTER=(|(%{uid}=%{email})(mail=%{email}))
SECRET_KEY_BASE= SECRET_KEY_BASE=
OTP_SECRET= OTP_SECRET=

View file

@ -26,6 +26,18 @@ sed -e "s/DB_HOST=.*/DB_HOST=${CLOUDRON_POSTGRESQL_HOST}/g" \
-e "s/LOCAL_DOMAIN=.*/LOCAL_DOMAIN=${CLOUDRON_APP_DOMAIN}/g" \ -e "s/LOCAL_DOMAIN=.*/LOCAL_DOMAIN=${CLOUDRON_APP_DOMAIN}/g" \
-i /app/data/env.production -i /app/data/env.production
if [[ -n "${CLOUDRON_LDAP_SERVER:-}" ]]; then
sed -e "s/LDAP_ENABLED=.*/LDAP_ENABLED=true/g" \
-e "s/LDAP_HOST=.*/LDAP_HOST=${CLOUDRON_LDAP_SERVER}/g" \
-e "s/LDAP_PORT=.*/LDAP_PORT=${CLOUDRON_LDAP_PORT}/g" \
-e "s/LDAP_BASE=.*/LDAP_HOST=${CLOUDRON_LDAP_USERS_BASE_DN}/g" \
-e "s/LDAP_BIND_DN=.*/LDAP_BIND_DN=${CLOUDRON_LDAP_BIND_DN}/g" \
-e "s/LDAP_BIND_PASSWORD=.*/LDAP_BIND_DN=${CLOUDRON_LDAP_BIND_PASSWORD}/g"
-i /app/data/env.production
else
sed -e "s/LDAP_ENABLED=.*/LDAP_ENABLED=false/g" -i /app/data/env.production
fi
if grep -q "^SECRET_KEY_BASE=$" /app/data/env.production; then if grep -q "^SECRET_KEY_BASE=$" /app/data/env.production; then
echo "==> Generating secrets" echo "==> Generating secrets"
export RANDFILE=/tmp/.rnd export RANDFILE=/tmp/.rnd