Ensure we can also use the email to login via LDAP

This commit is contained in:
Johannes Zellner
2022-08-08 15:21:09 +02:00
parent 00f42d92c5
commit 3603182a84

View File

@@ -19,6 +19,7 @@ if [[ ! -f /app/data/traccar.xml ]]; then
disable_registration &
fi
echo "=> Ensure database settings"
# database (https://www.traccar.org/mysql/)
xmlstarlet ed --inplace \
--update '//properties/entry[@key="database.url"]' -v "jdbc:mysql://${CLOUDRON_MYSQL_HOST}:${CLOUDRON_MYSQL_PORT}/${CLOUDRON_MYSQL_DATABASE}?serverTimezone=UTC&allowPublicKeyRetrieval=true&useSSL=false&allowMultiQueries=true&autoReconnect=true&useUnicode=yes&characterEncoding=UTF-8&sessionVariables=sql_mode=''" \
@@ -31,12 +32,13 @@ xmlstarlet ed --inplace --update '//properties/entry[@key="web.url"]' -v "${CLOU
# ldap
if [[ -n "${CLOUDRON_LDAP_URL:-}" ]]; then
echo "=> Ensure LDAP settings"
xmlstarlet ed --inplace \
--update '//properties/entry[@key="ldap.enable"]' -v "true" \
--update '//properties/entry[@key="ldap.url"]' -v "${CLOUDRON_LDAP_URL}" \
--update '//properties/entry[@key="ldap.base"]' -v "${CLOUDRON_LDAP_USERS_BASE_DN}" \
--update '//properties/entry[@key="ldap.idAttribute"]' -v "username" \
--update '//properties/entry[@key="ldap.searchFilter"]' -v 'username=:login' \
--update '//properties/entry[@key="ldap.searchFilter"]' -v '(|(username=:login)(mail=:login))' \
--update '//properties/entry[@key="ldap.user"]' -v "${CLOUDRON_LDAP_BIND_DN}" \
--update '//properties/entry[@key="ldap.password"]' -v "${CLOUDRON_LDAP_BIND_PASSWORD}" \
/app/data/traccar.xml
@@ -45,6 +47,7 @@ else
fi
# email
echo "=> Ensure mail settings"
xmlstarlet ed --inplace \
--update '//properties/entry[@key="mail.smtp.host"]' -v "${CLOUDRON_MAIL_SMTP_SERVER}" \
--update '//properties/entry[@key="mail.smtp.port"]' -v "${CLOUDRON_MAIL_SMTP_PORT}" \