mirror of
https://github.com/YunoHost-Apps/rainloop_ynh.git
synced 2024-09-03 20:16:18 +02:00
Fix SSO
This commit is contained in:
parent
77599194d1
commit
814da2ff4f
3 changed files with 21 additions and 38 deletions
|
@ -9,11 +9,11 @@ location __PATH__/ {
|
||||||
rewrite ^ https://$server_name$request_uri? permanent;
|
rewrite ^ https://$server_name$request_uri? permanent;
|
||||||
}
|
}
|
||||||
|
|
||||||
location ^~ __PATH__/data {
|
location ^~ __PATH__/app/data {
|
||||||
deny all;
|
deny all;
|
||||||
}
|
}
|
||||||
|
|
||||||
location ^~ __PATH__/pgpback/keys {
|
location ^~ __PATH__/app/pgpback/keys {
|
||||||
deny all;
|
deny all;
|
||||||
}
|
}
|
||||||
### Example PHP configuration (remove it if not used)
|
### Example PHP configuration (remove it if not used)
|
||||||
|
|
|
@ -24,11 +24,6 @@ ynh_abort_if_errors
|
||||||
# RETRIEVE ARGUMENTS FROM THE MANIFEST
|
# RETRIEVE ARGUMENTS FROM THE MANIFEST
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
|
|
||||||
rainloop_version=$(cat ../sources/rainloop_version)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Retrieve arguments
|
# Retrieve arguments
|
||||||
domain=$YNH_APP_ARG_DOMAIN
|
domain=$YNH_APP_ARG_DOMAIN
|
||||||
path_url=$YNH_APP_ARG_PATH
|
path_url=$YNH_APP_ARG_PATH
|
||||||
|
@ -58,6 +53,8 @@ app=$YNH_APP_INSTANCE_NAME
|
||||||
### If the app provides an internal web server (or uses another application server such as uwsgi), the final path should be "/opt/yunohost/$app"
|
### If the app provides an internal web server (or uses another application server such as uwsgi), the final path should be "/opt/yunohost/$app"
|
||||||
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"
|
||||||
|
rainloop_path=${final_path}/app
|
||||||
|
|
||||||
|
|
||||||
# Normalize the url path syntax
|
# Normalize the url path syntax
|
||||||
path_url=$(ynh_normalize_url_path $path_url)
|
path_url=$(ynh_normalize_url_path $path_url)
|
||||||
|
@ -132,8 +129,9 @@ ynh_mysql_setup_db $db_name $db_name
|
||||||
### `ynh_setup_source` use the file conf/app.src
|
### `ynh_setup_source` use the file conf/app.src
|
||||||
|
|
||||||
ynh_app_setting_set $app final_path $final_path
|
ynh_app_setting_set $app final_path $final_path
|
||||||
|
ynh_app_setting_set $app rainloop_path $rainloop_path
|
||||||
# Download, check integrity, uncompress and patch the source from app.src
|
# Download, check integrity, uncompress and patch the source from app.src
|
||||||
ynh_setup_source "$final_path"
|
ynh_setup_source "$rainloop_path"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# NGINX CONFIGURATION
|
# NGINX CONFIGURATION
|
||||||
|
@ -176,29 +174,29 @@ ynh_add_fpm_config
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
# Install plugins
|
# Install plugins
|
||||||
sudo mkdir -p $final_path/data/_data_/_default_/plugins
|
sudo mkdir -p $rainloop_path/data/_data_/_default_/plugins
|
||||||
sudo cp -rf ../sources/plugins/auto-domain-grab $final_path/data/_data_/_default_/plugins/.
|
sudo cp -rf ../sources/plugins/auto-domain-grab $rainloop_path/data/_data_/_default_/plugins/.
|
||||||
sudo cp -rf ../sources/plugins/ynh-login-mapping $final_path/data/_data_/_default_/plugins/.
|
sudo cp -rf ../sources/plugins/ynh-login-mapping $rainloop_path/data/_data_/_default_/plugins/.
|
||||||
sudo cp -rf ../sources/plugins/ynh-ldap-suggestions $final_path/data/_data_/_default_/plugins/.
|
sudo cp -rf ../sources/plugins/ynh-ldap-suggestions $rainloop_path/data/_data_/_default_/plugins/.
|
||||||
|
|
||||||
# Autoconfig
|
# Autoconfig
|
||||||
sudo mkdir -p $final_path/data/_data_/_default_/configs/
|
sudo mkdir -p $rainloop_path/data/_data_/_default_/configs/
|
||||||
application_file=$final_path/data/_data_/_default_/configs/application.ini
|
application_file=$rainloop_path/data/_data_/_default_/configs/application.ini
|
||||||
sudo cp ../conf/data/configs/application.ini $application_file
|
sudo cp ../conf/data/configs/application.ini $application_file
|
||||||
|
|
||||||
# Set admin password
|
# Set admin password
|
||||||
sudo php ../conf/config.php --index="$final_path/index.php" --password="$password"
|
sudo php ../conf/config.php --index="$rainloop_path/index.php" --password="$password"
|
||||||
ynh_app_setting_set "$app" password "$password"
|
ynh_app_setting_set "$app" password "$password"
|
||||||
|
|
||||||
# Add default domain configs by looping through all the domains already added
|
# Add default domain configs by looping through all the domains already added
|
||||||
sudo mkdir -p $final_path/data/_data_/_default_/domains/
|
sudo mkdir -p $rainloop_path/data/_data_/_default_/domains/
|
||||||
# get list of ldap domains
|
# get list of ldap domains
|
||||||
alldomains=`ldapsearch -LLL -x -b ou=domains,dc=yunohost,dc=org -s one "objectclass=top" virtualdomain | grep -v "dn:" | sed "s/virtualdomain://" `
|
alldomains=`ldapsearch -LLL -x -b ou=domains,dc=yunohost,dc=org -s one "objectclass=top" virtualdomain | grep -v "dn:" | sed "s/virtualdomain://" `
|
||||||
for ldomain in $alldomains ; do
|
for ldomain in $alldomains ; do
|
||||||
sudo cp ../conf/data/domains/domain.tld.ini $final_path/data/_data_/_default_/domains/$ldomain.ini
|
sudo cp ../conf/data/domains/domain.tld.ini $rainloop_path/data/_data_/_default_/domains/$ldomain.ini
|
||||||
done
|
done
|
||||||
# Add wildcard domain for auto-grab
|
# Add wildcard domain for auto-grab
|
||||||
sudo cp ../conf/data/domains/default.ini $final_path/data/_data_/_default_/domains/default.ini
|
sudo cp ../conf/data/domains/default.ini $rainloop_path/data/_data_/_default_/domains/default.ini
|
||||||
|
|
||||||
# Install SSO - at the moment the index is the SSO and rainloop is installed in /app
|
# Install SSO - at the moment the index is the SSO and rainloop is installed in /app
|
||||||
sudo cp ../sources/sso/sso.php $final_path/index.php
|
sudo cp ../sources/sso/sso.php $final_path/index.php
|
||||||
|
|
|
@ -1,24 +1,9 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
if (!defined('APP_VERSION'))
|
|
||||||
{
|
|
||||||
define('APP_VERSION', '1.12.1');
|
|
||||||
define('APP_VERSION_TYPE', 'community');
|
|
||||||
define('APP_INDEX_ROOT_FILE', __FILE__);
|
|
||||||
define('APP_INDEX_ROOT_PATH', str_replace('\\', '/', rtrim(dirname(__FILE__), '\\/').'/'));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (file_exists(APP_INDEX_ROOT_PATH.'rainloop/v/'.APP_VERSION.'/include.php'))
|
|
||||||
{
|
|
||||||
include APP_INDEX_ROOT_PATH.'rainloop/v/'.APP_VERSION.'/include.php';
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
echo '[105] Missing version directory';
|
|
||||||
exit(105);
|
|
||||||
}
|
|
||||||
$_ENV['RAINLOOP_INCLUDE_AS_API'] = true;
|
$_ENV['RAINLOOP_INCLUDE_AS_API'] = true;
|
||||||
|
|
||||||
|
|
||||||
|
include '__FINAL_PATH__/app/index.php';
|
||||||
|
|
||||||
// Retrieve email and password
|
// Retrieve email and password
|
||||||
if (isset($_SERVER['HTTP_EMAIL']) && isset($_SERVER['PHP_AUTH_PW'])) {
|
if (isset($_SERVER['HTTP_EMAIL']) && isset($_SERVER['PHP_AUTH_PW'])) {
|
||||||
$email = $_SERVER['HTTP_EMAIL'];
|
$email = $_SERVER['HTTP_EMAIL'];
|
||||||
|
@ -26,8 +11,8 @@ if (isset($_SERVER['HTTP_EMAIL']) && isset($_SERVER['PHP_AUTH_PW'])) {
|
||||||
$ssoHash = \RainLoop\Api::GetUserSsoHash($email, $password);
|
$ssoHash = \RainLoop\Api::GetUserSsoHash($email, $password);
|
||||||
|
|
||||||
// redirect to webmail sso url
|
// redirect to webmail sso url
|
||||||
\header('Location: https://__URL__/index.php?sso&hash='.$ssoHash);
|
\header('Location: https://__URL__/app/index.php?sso&hash='.$ssoHash);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
\header('Location: https://__URL__/index.php');
|
\header('Location: https://__URL__/app/index.php');
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue