From 91d980331a5531e425b76e592782c7ce8396ed83 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Sun, 12 Jan 2020 22:34:38 +0100 Subject: [PATCH 1/5] ldap --- README.md | 3 +-- conf/ldap.exs | 11 +++++++++++ scripts/install | 2 ++ scripts/upgrade | 5 +++++ 4 files changed, 19 insertions(+), 2 deletions(-) create mode 100644 conf/ldap.exs diff --git a/README.md b/README.md index 22bd18d..45c1c61 100644 --- a/README.md +++ b/README.md @@ -32,7 +32,6 @@ For user friendly details about Pleroma: [see here](https://blog.soykaf.com/post 1. **Pleroma** require a dedicated **root domain**, eg. pleroma.domain.tld 1. **Pleroma** require a valid **certificate** installed on the domain. Yunohost can **install Letsencrypt certificate** on the domain from **admin web-interface** or through **command-line**. 1. This package is **multi-instance** that means you can run **multiple Pleroma instances** on a **single server**. -1. There is **No LDAP** support for Pleroma yet. ## Screenshots @@ -78,7 +77,7 @@ You can make users **moderators**. They will then be able to **delete any post** #### Multi-users support -LDAP and HTTP auth are not supported. +LDAP supported but HTTP auth not. The app can be used by multiple users. diff --git a/conf/ldap.exs b/conf/ldap.exs new file mode 100644 index 0000000..50e8f82 --- /dev/null +++ b/conf/ldap.exs @@ -0,0 +1,11 @@ +config :pleroma, Pleroma.Web.Auth.Authenticator, Pleroma.Web.Auth.LDAPAuthenticator +config :pleroma, :ldap, + enabled: true, + host: "localhost", + port: 389, + ssl: false, + # sslopts: [], + tls: false, + # tlsopts: [], + base: "ou=users,dc=yunohost,dc=org", + uid: "cn" \ No newline at end of file diff --git a/scripts/install b/scripts/install index e443567..6f7b33c 100755 --- a/scripts/install +++ b/scripts/install @@ -214,6 +214,8 @@ pushd $final_path/$app --listen-ip 127.0.0.1 \ --listen-port $port" + cat "../conf/ldap.exs" "$config" + su "$app" -s $SHELL -lc "$final_path/$app/bin/pleroma_ctl migrate" ynh_systemd_action --service_name=$app --action="start" --log_path=systemd --line_match="Started $app" diff --git a/scripts/upgrade b/scripts/upgrade index 1d22f2e..30b007c 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -165,6 +165,11 @@ if ynh_version_gt "1.1.1~ynh1" "${previous_version}" ; then rm -r $final_path/$app/* fi +if ynh_version_gt "1.1.7~ynh1" "${previous_version}" ; then + config="/etc/$app/config.exs" + cat "../conf/ldap.exs" "$config" +fi + #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= From c867f2bfbcaef6ed59293438929c0df0b771e8d9 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Thu, 12 Mar 2020 22:29:21 +0100 Subject: [PATCH 2/5] fix install --- scripts/install | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/scripts/install b/scripts/install index 08eb098..67479b7 100755 --- a/scripts/install +++ b/scripts/install @@ -214,8 +214,11 @@ pushd $final_path/$app --listen-ip 127.0.0.1 \ --listen-port $port \ --db-configurable Y" +popd - cat "../conf/ldap.exs" "$config" +cat "../conf/ldap.exs" "$config" + +pushd $final_path/$app su "$app" -s $SHELL -lc "$final_path/$app/bin/pleroma_ctl migrate" From 8fe8600f6104a11f4bffa5eb0c67bd58b29053f4 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Thu, 28 May 2020 22:56:33 +0200 Subject: [PATCH 3/5] Update upgrade --- scripts/upgrade | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/upgrade b/scripts/upgrade index 60c5236..9bbf0ef 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -172,7 +172,7 @@ if ynh_version_gt "1.1.1~ynh1" "${previous_version}" ; then ynh_secure_remove --file="$final_path/$app" fi -if ynh_version_gt "1.1.7~ynh1" "${previous_version}" ; then +if ynh_version_gt "2.0.5~ynh1" "${previous_version}" ; then config="/etc/$app/config.exs" cat "../conf/ldap.exs" "$config" fi From 26cde22f598e3d50123d3f20ca96dbacf04c542a Mon Sep 17 00:00:00 2001 From: yalh76 Date: Fri, 29 May 2020 13:19:53 +0200 Subject: [PATCH 4/5] Fix ldap --- conf/ldap.exs | 2 +- conf/nginx.conf | 1 + scripts/install | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/conf/ldap.exs b/conf/ldap.exs index 50e8f82..b7e3272 100644 --- a/conf/ldap.exs +++ b/conf/ldap.exs @@ -8,4 +8,4 @@ config :pleroma, :ldap, tls: false, # tlsopts: [], base: "ou=users,dc=yunohost,dc=org", - uid: "cn" \ No newline at end of file + uid: "uid" \ No newline at end of file diff --git a/conf/nginx.conf b/conf/nginx.conf index e1fb8e7..3c252af 100755 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -10,6 +10,7 @@ proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; proxy_set_header Host $http_host; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_pass http://localhost:__PORT__; diff --git a/scripts/install b/scripts/install index 67479b7..a32a575 100755 --- a/scripts/install +++ b/scripts/install @@ -216,7 +216,7 @@ pushd $final_path/$app --db-configurable Y" popd -cat "../conf/ldap.exs" "$config" +cat "../conf/ldap.exs" >> "$config" pushd $final_path/$app From d99521b12f16104e3f02818455192aba53879b2f Mon Sep 17 00:00:00 2001 From: yalh76 Date: Fri, 29 May 2020 13:27:08 +0200 Subject: [PATCH 5/5] Fix #109 --- scripts/install | 2 ++ scripts/upgrade | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/scripts/install b/scripts/install index a32a575..4f97183 100755 --- a/scripts/install +++ b/scripts/install @@ -218,6 +218,8 @@ popd cat "../conf/ldap.exs" >> "$config" +ynh_replace_string --match_string="config :pleroma, configurable_from_database: false" --replace_string="config :pleroma, configurable_from_database: true" --target_file="$config" + pushd $final_path/$app su "$app" -s $SHELL -lc "$final_path/$app/bin/pleroma_ctl migrate" diff --git a/scripts/upgrade b/scripts/upgrade index 9bbf0ef..1871ea7 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -174,7 +174,8 @@ fi if ynh_version_gt "2.0.5~ynh1" "${previous_version}" ; then config="/etc/$app/config.exs" - cat "../conf/ldap.exs" "$config" + cat "../conf/ldap.exs" >> "$config" + ynh_replace_string --match_string="config :pleroma, configurable_from_database: false" --replace_string="config :pleroma, configurable_from_database: true" --target_file="$config" fi #=================================================