From b5a75dea5ab121cdde03049713ee471f3c061b77 Mon Sep 17 00:00:00 2001 From: Aleksandr Bogdanov Date: Wed, 31 Oct 2018 13:55:50 +0100 Subject: [PATCH] Enabling LDAP --- CloudronManifest.json | 3 ++- Dockerfile | 3 +++ mastodon.env.template | 3 ++- patches/Remove_LDAP_encryption.patch | 18 ++++++++++++++++++ 4 files changed, 25 insertions(+), 2 deletions(-) create mode 100644 patches/Remove_LDAP_encryption.patch diff --git a/CloudronManifest.json b/CloudronManifest.json index 301ff8c..f491528 100644 --- a/CloudronManifest.json +++ b/CloudronManifest.json @@ -13,7 +13,8 @@ "localstorage": {}, "postgresql": {}, "redis": {}, - "sendmail": {} + "sendmail": {}, + "ldap": {} }, "minBoxVersion": "1.8.1", "manifestVersion": 1, diff --git a/Dockerfile b/Dockerfile index 9d2d709..1a3dd7d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -28,6 +28,9 @@ RUN git init && \ git fetch --depth=1 origin $(git ls-remote --tags | grep refs/tags | grep -v 'rc[0-9]*$' | cut -f2 | sort -V | tail -n 1 | cut -d '/' -f3-) && \ git checkout FETCH_HEAD +COPY patches /app/code/patches +RUN for patch in /app/code/patches/*; do patch -N -p0 < $patch; done + RUN bundle install -j$(getconf _NPROCESSORS_ONLN) --deployment --without development test && \ yarn install --pure-lockfile diff --git a/mastodon.env.template b/mastodon.env.template index 3583a69..40151fe 100644 --- a/mastodon.env.template +++ b/mastodon.env.template @@ -30,7 +30,8 @@ LDAP_PORT=${LDAP_PORT} LDAP_BASE=${LDAP_USERS_BASE_DN} LDAP_BIND_DN=${LDAP_BIND_DN} LDAP_PASSWORD=${LDAP_BIND_PASSWORD} -LDAP_UID=mail +LDAP_UID=username +LDAP_SEARCH_FILTER=(|(%{uid}=%{email})(mail=%{email})) # the following is generated by start.sh END diff --git a/patches/Remove_LDAP_encryption.patch b/patches/Remove_LDAP_encryption.patch new file mode 100644 index 0000000..b8792c3 --- /dev/null +++ b/patches/Remove_LDAP_encryption.patch @@ -0,0 +1,18 @@ +Index: lib/devise/ldap_authenticatable.rb +IDEA additional info: +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +<+>UTF-8 +=================================================================== +--- lib/devise/ldap_authenticatable.rb (date 1539296558000) ++++ lib/devise/ldap_authenticatable.rb (date 1540988096000) +@@ -12,10 +12,6 @@ + host: Devise.ldap_host, + port: Devise.ldap_port, + base: Devise.ldap_base, +- encryption: { +- method: Devise.ldap_method, +- tls_options: tls_options, +- }, + auth: { + method: :simple, + username: Devise.ldap_bind_dn,