From dc578361b7dab650c2ef9fcbc05da66c28f733c4 Mon Sep 17 00:00:00 2001 From: magikcypress Date: Sun, 5 Mar 2017 19:42:06 +0100 Subject: [PATCH] Ajout l'utilisation de LDAP --- README.md | 6 ++++++ check_process | 2 +- conf/connect.php | 2 +- conf/ldap.php | 7 +++++++ manifest.json | 11 ++++++++++- scripts/install | 40 +++++++++++++++++++++++++--------------- sources/source_md5 | 2 +- 7 files changed, 51 insertions(+), 19 deletions(-) create mode 100644 conf/ldap.php diff --git a/README.md b/README.md index f0af581..4222a78 100644 --- a/README.md +++ b/README.md @@ -10,6 +10,7 @@ Source: [spip.net](http://www.spip.net/fr_rubrique91.html) - Installation de la base sans passer par le système d'installation - Support multilingue +- Support LDAP ### Installation @@ -45,9 +46,14 @@ Request a "forgotten password" to change your password, you will receive an emai - Database install without going through the system install - Multilanguage support +- LDAP support ## Versionning +### Version 1.1.4 (05/03/17) + +- Support LDAP + ### Version 1.1.3 (22/02/17) - Update scripts for passing package_linter diff --git a/check_process b/check_process index ac257c4..c6c6846 100644 --- a/check_process +++ b/check_process @@ -53,7 +53,7 @@ Level 1=auto Level 2=auto Level 3=auto - Level 4=0 + Level 4=1 Level 5=auto Level 6=auto Level 7=auto diff --git a/conf/connect.php b/conf/connect.php index c376802..3a17b4b 100644 --- a/conf/connect.php +++ b/conf/connect.php @@ -1,5 +1,5 @@ \ No newline at end of file diff --git a/conf/ldap.php b/conf/ldap.php new file mode 100644 index 0000000..da5552a --- /dev/null +++ b/conf/ldap.php @@ -0,0 +1,7 @@ + array('sAMAccountName','uid','login','userid','cn','sn'),'nom' => 'cn','email' => 'mail','bio' => 'description',); diff --git a/manifest.json b/manifest.json index 758bbed..ae81996 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "SPIP - publishing system for the Internet", "fr": "SPIP - Système de publication pour l’Internet" }, - "version": "1.1.3", + "version": "1.1.4", "url": "http://www.spip.net/", "license": "free", "maintainer": { @@ -69,6 +69,15 @@ }, "choices": ["en_EN", "fr_FR"], "default": "fr_FR" + }, + { + "name": "ldap", + "ask": { + "en": "LDAP Connection", + "fr": "Connexion LDAP" + }, + "choices": ["Yes", "No"], + "default": "No" } ] } diff --git a/scripts/install b/scripts/install index 9a0f7ca..3bc3c3e 100644 --- a/scripts/install +++ b/scripts/install @@ -18,6 +18,7 @@ admin_spip=$YNH_APP_ARG_ADMIN language=$YNH_APP_ARG_LANGUAGE #multisite=$YNH_APP_ARG_MULTISITE is_public=$YNH_APP_ARG_IS_PUBLIC +ldap=$YNH_APP_ARG_LDAP app=$YNH_APP_INSTANCE_NAME @@ -39,6 +40,7 @@ ynh_app_setting_set $app path $path ynh_app_setting_set $app admin $admin_spip ynh_app_setting_set $app is_public $is_public ynh_app_setting_set $app language $language +ynh_app_setting_set $app ldap $ldap #ynh_app_setting_set $app multisite $multisite GENERATE_DB $app # Créer une base de données et un utilisateur dédié au nom de l'app. @@ -49,7 +51,7 @@ ynh_app_setting_set $app final_path $final_path SETUP_SOURCE "spip-3.1.zip" -# Set permissions to spip directory +# Set permissions du répertoire spip sudo chown -R www-data: $final_path echo -e "127.0.0.1 $domain #SPIP" | sudo tee -a /etc/hosts @@ -70,12 +72,12 @@ fi POOL_FPM sudo cp ../conf/connect.php $final_path/config/connect.php -sudo cp ../conf/mes_options.php $final_path/config/mes_options.php +sudo cp ../conf/mes_options.php $final_path/config/mes_options.php + +# Changer les variables du fichier de configuration de SPIP +sudo sed -i "s@__DB_USER__@$db_user@g" $final_path/config/connect.php +sudo sed -i "s@__DB_PWD__@$db_pwd@g" $final_path/config/connect.php -# Changer les variables du ficher de configuration de SPIP -sudo sed -i "s/__DB_USER__/$db_user/g" $final_path/config/connect.php -sudo sed -i "s/__DB_PWD__/$db_pwd/g" $final_path/config/connect.php - db_md5=$(echo $db_pwd | md5sum | awk '{print $1}') db_sha=$(echo $db_pwd | openssl dgst -sha1 -hmac "key" | awk -F'= ' {'print $2'}) language="$(echo $language | head -c 2)" @@ -105,8 +107,23 @@ done # Charger la structure des tables dans la base. mysql --debug-check -u $db_user -p$db_pwd $db_user < ../conf/sql/spip.sql -# Donne un accès public pour curl -ynh_app_setting_set $app unprotected_uris "/" +# Utilisation de LDAP pour SPIP +if [ "$ldap" = "Yes" ]; +then + sudo cp ../conf/ldap.php $final_path/config/ldap.php + sudo sed -i "s/__LDAP__/ldap/g" $final_path/config/connect.php + sudo mysql -e "INSERT INTO spip_meta (nom, valeur, impt) VALUES ('ldap_statut_import', '1comite', 'oui');" -u $db_user -p$db_pwd $db_user + +else + sudo sed -i "s@__LDAP__@@g" $final_path/config/connect.php +fi + +# Setup SSOwat +ynh_app_setting_set "$app" is_public "$is_public" +if [ "$is_public" = "Yes" ]; +then + ynh_app_setting_set "$app" unprotected_uris "/" +fi # Régénère la configuration de SSOwat sudo yunohost app ssowatconf @@ -115,12 +132,5 @@ sudo yunohost app ssowatconf sudo service php5-fpm restart sudo service nginx reload -if [ "$is_public" = "No" ]; -then - # Retire l'accès public - ynh_app_setting_delete $app unprotected_uris - sudo yunohost app ssowatconf -fi - # Nettoyer hosts sudo sed -i '/#SPIP/d' /etc/hosts \ No newline at end of file diff --git a/sources/source_md5 b/sources/source_md5 index 2ad97b6..dc9909e 100644 --- a/sources/source_md5 +++ b/sources/source_md5 @@ -1 +1 @@ -acc291ee449c6c86eb9276ec1f59f476 spip-3.1.zip +2369689c6b387c417ea42506a9ea68b1 spip-3.1.zip