mirror of
https://github.com/YunoHost-Apps/yourls_ynh.git
synced 2024-09-03 20:35:59 +02:00
Removed the LDAP support
This commit is contained in:
parent
f53585b566
commit
7d31df1cc4
9 changed files with 37 additions and 37 deletions
|
@ -25,7 +25,7 @@
|
||||||
Level 1=auto
|
Level 1=auto
|
||||||
Level 2=auto
|
Level 2=auto
|
||||||
Level 3=auto
|
Level 3=auto
|
||||||
# Level 4:
|
# Level 4:
|
||||||
Level 4=0
|
Level 4=0
|
||||||
# Level 5:
|
# Level 5:
|
||||||
Level 5=auto
|
Level 5=auto
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
INSERT INTO `yourls_options` ( `option_name`, `option_value`) VALUES
|
INSERT INTO `yourls_options` ( `option_name`, `option_value`) VALUES
|
||||||
('active_plugins', 'a:1:{i:0;s:24:"yunohost_auth/plugin.php";}');
|
('active_plugins', 'a:1:{i:0;s:29:"yourls-ldap-plugin/plugin.php";}');
|
||||||
|
|
||||||
|
|
|
@ -57,6 +57,7 @@ define( 'YOURLS_COOKIEKEY', 'modify this text with something random' );
|
||||||
** YOURLS will auto encrypt plain text passwords in this file
|
** YOURLS will auto encrypt plain text passwords in this file
|
||||||
** Read http://yourls.org/userpassword for more information */
|
** Read http://yourls.org/userpassword for more information */
|
||||||
$yourls_user_passwords = array(
|
$yourls_user_passwords = array(
|
||||||
|
'yourlsuser' => 'yourpassword',
|
||||||
);
|
);
|
||||||
|
|
||||||
/** Debug mode to output some internal information
|
/** Debug mode to output some internal information
|
||||||
|
@ -87,4 +88,8 @@ $yourls_reserved_URL = array(
|
||||||
** Personal settings would go after here.
|
** Personal settings would go after here.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
define( 'YOURLS_YUNOHOST_AUTH_ADMIN', 'yourlsuser' );
|
//define( 'LDAPAUTH_HOST', 'localhost' );
|
||||||
|
//define( 'LDAPAUTH_PORT', '389' );
|
||||||
|
//define( 'LDAPAUTH_BASE', 'dc=yunohost,dc=org' );
|
||||||
|
//define( 'LDAPAUTH_USERNAME_FIELD', 'uid');
|
||||||
|
|
||||||
|
|
|
@ -56,7 +56,13 @@
|
||||||
"fr": "Administrateur du site Yourls (doit être un utilisateur Yunohost existant)"
|
"fr": "Administrateur du site Yourls (doit être un utilisateur Yunohost existant)"
|
||||||
},
|
},
|
||||||
"example": "yoda"
|
"example": "yoda"
|
||||||
}
|
},
|
||||||
|
{
|
||||||
|
"name": "pass",
|
||||||
|
"type": "password",
|
||||||
|
"ask": {
|
||||||
|
"en": "Password for the admin account (At least 6 characters long)"
|
||||||
|
}
|
||||||
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,6 +23,7 @@ ynh_abort_if_errors
|
||||||
domain=$YNH_APP_ARG_DOMAIN
|
domain=$YNH_APP_ARG_DOMAIN
|
||||||
path_url=$YNH_APP_ARG_PATH
|
path_url=$YNH_APP_ARG_PATH
|
||||||
admin=$YNH_APP_ARG_ADMIN
|
admin=$YNH_APP_ARG_ADMIN
|
||||||
|
pass=$YNH_APP_ARG_PASS
|
||||||
|
|
||||||
# This is a multi-instance app, meaning it can be installed several times independently
|
# This is a multi-instance app, meaning it can be installed several times independently
|
||||||
# The id of the app as stated in the manifest is available as $YNH_APP_ID
|
# The id of the app as stated in the manifest is available as $YNH_APP_ID
|
||||||
|
@ -50,6 +51,10 @@ ynh_webpath_register $app $domain $path_url
|
||||||
final_path=/var/www/$app
|
final_path=/var/www/$app
|
||||||
test ! -e "$final_path" || ynh_die "This path already contains a folder"
|
test ! -e "$final_path" || ynh_die "This path already contains a folder"
|
||||||
|
|
||||||
|
# Check password strength
|
||||||
|
[[ ${#pass} -gt 6 ]] || ynh_die \
|
||||||
|
"The password is too weak, it must be longer than 6 characters"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# STORE SETTINGS FROM MANIFEST
|
# STORE SETTINGS FROM MANIFEST
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -97,9 +102,6 @@ ynh_system_user_create $app
|
||||||
# Create a dedicated php-fpm config
|
# Create a dedicated php-fpm config
|
||||||
ynh_add_fpm_config
|
ynh_add_fpm_config
|
||||||
|
|
||||||
sudo cp ../conf/index.php $final_path/
|
|
||||||
sudo cp -r ../sources/patches/yunohost_auth $final_path/user/plugins
|
|
||||||
|
|
||||||
|
|
||||||
# Change variable in yourls configuration
|
# Change variable in yourls configuration
|
||||||
sudo cp ../conf/config.php $final_path/user/config.php
|
sudo cp ../conf/config.php $final_path/user/config.php
|
||||||
|
@ -107,9 +109,10 @@ ynh_replace_string "yunouser" "$db_name" "$final_path/user/config.php"
|
||||||
ynh_replace_string "yunopass" "$db_pwd" "$final_path/user/config.php"
|
ynh_replace_string "yunopass" "$db_pwd" "$final_path/user/config.php"
|
||||||
ynh_replace_string "yunobase" "$db_name" "$final_path/user/config.php"
|
ynh_replace_string "yunobase" "$db_name" "$final_path/user/config.php"
|
||||||
ynh_replace_string "yunodomain" "$domain" "$final_path/user/config.php"
|
ynh_replace_string "yunodomain" "$domain" "$final_path/user/config.php"
|
||||||
ynh_replace_string "yourlsuser" "$admin" "$final_path/user/config.php"
|
|
||||||
ynh_replace_string "_yourlspath" "${path_url%/}" "$final_path/user/config.php"
|
ynh_replace_string "_yourlspath" "${path_url%/}" "$final_path/user/config.php"
|
||||||
ynh_replace_string "modify this text with something randomr" "$(ynh_string_random 24)$(ynh_string_random 24)" "$final_path/user/config.php"
|
ynh_replace_string "yourlsuser" "$admin" "$final_path/user/config.php"
|
||||||
|
ynh_replace_string "yourpassword" "$pass" "$final_path/user/config.php"
|
||||||
|
ynh_replace_string "modify this text with something random" "$(ynh_string_random 24)$(ynh_string_random 24)" "$final_path/user/config.php"
|
||||||
|
|
||||||
# Set permissions
|
# Set permissions
|
||||||
sudo chown -R $app: $final_path
|
sudo chown -R $app: $final_path
|
||||||
|
@ -125,11 +128,13 @@ systemctl reload nginx
|
||||||
# Start Yourls install (database table creation)
|
# Start Yourls install (database table creation)
|
||||||
ynh_local_curl "/admin/install.php" "install=dummy"
|
ynh_local_curl "/admin/install.php" "install=dummy"
|
||||||
|
|
||||||
# Activate auth plugin
|
|
||||||
ynh_mysql_connect_as "$db_name" "$db_pwd" "$db_name" < "../conf/activate_plugins.sql"
|
|
||||||
|
|
||||||
# Calculate and store the config file checksum into the app settings
|
# Calculate and store the config file checksum into the app settings
|
||||||
ynh_store_file_checksum "$final_path/user/config.php"
|
ynh_store_file_checksum "$final_path/user/config.php"
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# SETUP SSOWAT
|
||||||
|
#=================================================
|
||||||
|
|
||||||
sudo service nginx reload
|
sudo service nginx reload
|
||||||
sudo yunohost app ssowatconf
|
sudo yunohost app ssowatconf
|
||||||
|
|
|
@ -31,6 +31,7 @@ domain=$(ynh_app_setting_get $app domain)
|
||||||
path_url=$(ynh_app_setting_get $app path)
|
path_url=$(ynh_app_setting_get $app path)
|
||||||
final_path=$(ynh_app_setting_get $app final_path)
|
final_path=$(ynh_app_setting_get $app final_path)
|
||||||
db_name=$(ynh_app_setting_get $app db_name)
|
db_name=$(ynh_app_setting_get $app db_name)
|
||||||
|
admin=$(ynh_app_setting_get $app admin)
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CHECK IF THE APP CAN BE RESTORED
|
# CHECK IF THE APP CAN BE RESTORED
|
||||||
|
@ -92,6 +93,13 @@ ynh_restore_file "/etc/php5/fpm/conf.d/20-$app.ini"
|
||||||
#=================================================
|
#=================================================
|
||||||
sudo yunohost app setting $app unprotected_uris -v "/"
|
sudo yunohost app setting $app unprotected_uris -v "/"
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# SETUP SSOWAT
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
# Restrict access to admin only
|
||||||
|
yunohost app addaccess --users=$admin $app
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# GENERIC FINALIZATION
|
# GENERIC FINALIZATION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -62,11 +62,9 @@ path_url=$(ynh_normalize_url_path $path_url)
|
||||||
# Download, check integrity, uncompress and patch the source from app.src
|
# Download, check integrity, uncompress and patch the source from app.src
|
||||||
# Create a temporary directory along with /user/plugin sub directory in it
|
# Create a temporary directory along with /user/plugin sub directory in it
|
||||||
tmpdir="$(mktemp -d)"
|
tmpdir="$(mktemp -d)"
|
||||||
mkdir -p "$tmpdir/user/plugins"
|
mkdir -p "$tmpdir/user"
|
||||||
|
|
||||||
# Backup the app files in the temp dir
|
# Backup the app files in the temp dir
|
||||||
sudo cp -a "$final_path/index.php" "$tmpdir"
|
|
||||||
sudo cp -a "$final_path/user/plugins/yunohost_auth" "$tmpdir/user/plugins"
|
|
||||||
sudo cp -a "$final_path/.htaccess" "$tmpdir"
|
sudo cp -a "$final_path/.htaccess" "$tmpdir"
|
||||||
sudo cp -a "$final_path/user/config.php" "$tmpdir/user"
|
sudo cp -a "$final_path/user/config.php" "$tmpdir/user"
|
||||||
|
|
||||||
|
@ -77,8 +75,6 @@ ynh_secure_remove "$final_path"
|
||||||
ynh_setup_source "$final_path"
|
ynh_setup_source "$final_path"
|
||||||
|
|
||||||
# Copy the app files from tmp to final_path
|
# Copy the app files from tmp to final_path
|
||||||
sudo cp -a "$tmpdir/index.php" "$final_path"
|
|
||||||
sudo cp -a "$tmpdir/user/plugins/yunohost_auth" "$final_path/user/plugins"
|
|
||||||
sudo cp -a "$tmpdir/.htaccess" "$final_path"
|
sudo cp -a "$tmpdir/.htaccess" "$final_path"
|
||||||
sudo cp -a "$tmpdir/user/config.php" "$final_path/user"
|
sudo cp -a "$tmpdir/user/config.php" "$final_path/user"
|
||||||
|
|
||||||
|
|
1
sources/patches/yourls-ldap-plugin
Submodule
1
sources/patches/yourls-ldap-plugin
Submodule
|
@ -0,0 +1 @@
|
||||||
|
Subproject commit f562a093f85081a6c9c0ec4a352456f7da3aabb2
|
|
@ -1,21 +0,0 @@
|
||||||
<?php
|
|
||||||
/*
|
|
||||||
Plugin Name: YunoHost Auth plugin
|
|
||||||
Plugin URI: http://yourls.org/
|
|
||||||
Description: Authentification plugin for YunoHost
|
|
||||||
Version: 0.1
|
|
||||||
Author: ju
|
|
||||||
Author URI: http://github.com/julienmalik
|
|
||||||
*/
|
|
||||||
|
|
||||||
// No direct call
|
|
||||||
if( !defined( 'YOURLS_ABSPATH' ) ) die();
|
|
||||||
|
|
||||||
yourls_add_filter( 'shunt_is_valid_user', 'yunohost_auth_is_valid_user' );
|
|
||||||
|
|
||||||
function yunohost_auth_is_valid_user( $value ) {
|
|
||||||
return $_SERVER['PHP_AUTH_USER'] == YOURLS_YUNOHOST_AUTH_ADMIN;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* And that's it. Activate the plugin and notice how the page title changes */
|
|
||||||
|
|
Loading…
Reference in a new issue