From b17c8fd8629416af67fd8f09af2b2f456014a8c1 Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Mon, 26 Oct 2020 19:13:42 +0100 Subject: [PATCH] Fix ldap config + remove the need to define a password since authentication uses LDAP --- conf/ldap.exs | 9 +++++++-- manifest.json | 11 +---------- scripts/install | 6 +++++- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/conf/ldap.exs b/conf/ldap.exs index 692720e..eb484a5 100644 --- a/conf/ldap.exs +++ b/conf/ldap.exs @@ -1,11 +1,16 @@ + config :mobilizon, Mobilizon.Service.Auth.Authenticator, Mobilizon.Service.Auth.LDAPAuthenticator config :mobilizon, :ldap, enabled: true, - host: "localhost", + host: "127.0.0.1", port: 389, ssl: false, # sslopts: [], tls: false, # tlsopts: [], base: "ou=users,dc=yunohost,dc=org", - uid: "uid" + uid: "uid", + require_bind_for_search: false, + bind_uid: nil, + bind_password: nil + diff --git a/manifest.json b/manifest.json index 08f7b46..8e832cf 100644 --- a/manifest.json +++ b/manifest.json @@ -57,16 +57,7 @@ "fr": "Choisissez l'administrateur" }, "example": "johndoe" - }, - { - "name": "password", - "type": "password", - "ask": { - "en": "Set the administrator password", - "fr": "Définissez le mot de passe administrateur" - }, - "example": "Choose a password" - } + } ] } } diff --git a/scripts/install b/scripts/install index b16dfa0..88ed3f0 100644 --- a/scripts/install +++ b/scripts/install @@ -28,7 +28,6 @@ path_url="/" admin=$YNH_APP_ARG_ADMIN is_public=$YNH_APP_ARG_IS_PUBLIC language=$YNH_APP_ARG_LANGUAGE -password=$YNH_APP_ARG_PASSWORD admin_email=$(ynh_user_get_info $admin 'mail') @@ -161,8 +160,13 @@ cat "../conf/ldap.exs" >> "$config" pushd $final_path/$app chmod o-rwx $config + # Compile *again* because we added ldap conf in between... dunno if the first is relevant + sudo -u "$app" MIX_ENV=prod mix compile ynh_secure_remove --file="/tmp/setup_db.psql" sudo -u "$app" MIX_ENV=prod mix ecto.migrate + + # We generate a dummy password ... this will actually *not* be used because the admin is supposed to connect via the ldap + password=$(ynh_string_random --length=30) sudo -u "$app" MIX_ENV=prod mix mobilizon.users.new "$admin_email" --admin --password "$password" popd