Fix SSO authentication

This commit is contained in:
Josué Tille 2019-07-30 21:58:38 +02:00
parent aa2679881f
commit ecc8aae39d
No known key found for this signature in database
GPG key ID: 716A6C99B04194EF
3 changed files with 16 additions and 0 deletions

View file

@ -84,6 +84,8 @@ ynh_replace_string --match_string 'MEDIA_URL = "'"$old_path2"'media/"' --replace
ynh_replace_string --match_string "LOGIN_URL = '${old_path2}accounts/login/'" --replace_string "LOGIN_URL = '${path_url2}accounts/login/'" --target_file $final_path/conf/seahub_settings.py ynh_replace_string --match_string "LOGIN_URL = '${old_path2}accounts/login/'" --replace_string "LOGIN_URL = '${path_url2}accounts/login/'" --target_file $final_path/conf/seahub_settings.py
ynh_replace_string --match_string ' = "seafile@'"$old_domain"'"' --replace_string ' = "seafile@'"$domain"'"' --target_file $final_path/conf/seahub_settings.py ynh_replace_string --match_string ' = "seafile@'"$old_domain"'"' --replace_string ' = "seafile@'"$domain"'"' --target_file $final_path/conf/seahub_settings.py
sed --in-place "s@ALLOWED_HOSTS = \['${old_domain}'\]@ALLOWED_HOSTS = \['${domain}'\]@g" --target_file $final_path/conf/seahub_settings.py sed --in-place "s@ALLOWED_HOSTS = \['${old_domain}'\]@ALLOWED_HOSTS = \['${domain}'\]@g" --target_file $final_path/conf/seahub_settings.py
ynh_replace_string --match_string "REMOTE_USER_DOMAIN = '$old_domain'" --replace_string "REMOTE_USER_DOMAIN = '$domain'" --target_file $final_path/conf/seahub_settings.py
ynh_replace_string --match_string "REMOTE_USER_PROTECTED_PATH = ['$old_path', '$old_path/accounts/login']" --replace_string "REMOTE_USER_PROTECTED_PATH = ['$path_url', '$path_url/accounts/login']" --target_file $final_path/conf/seahub_settings.py
ynh_script_progression --message="Updating seafile database" --weight=7 ynh_script_progression --message="Updating seafile database" --weight=7

View file

@ -121,6 +121,12 @@ echo 'SERVER_EMAIL = "seafile@'$domain'"' | tee -a $final_path/conf/seahub_setti
echo 'EMAIL_HOST_PASSWORD = ""' | tee -a $final_path/conf/seahub_settings.py echo 'EMAIL_HOST_PASSWORD = ""' | tee -a $final_path/conf/seahub_settings.py
echo "TIME_ZONE = \"$(cat /etc/timezone)\"" | tee -a $final_path/conf/seahub_settings.py echo "TIME_ZONE = \"$(cat /etc/timezone)\"" | tee -a $final_path/conf/seahub_settings.py
# SSO authentication
echo 'ENABLE_REMOTE_USER_AUTHENTICATION = True' | tee -a $final_path/conf/seahub_settings.py
echo 'REMOTE_USER_CREATE_UNKNOWN_USER = False' | tee -a $final_path/conf/seahub_settings.py
echo "REMOTE_USER_DOMAIN = '$domain'" | tee -a $final_path/conf/seahub_settings.py
echo "REMOTE_USER_PROTECTED_PATH = ['$path_url', '$path_url/accounts/login']" | tee -a $final_path/conf/seahub_settings.py
# LDAP configuration # LDAP configuration
echo '[LDAP]' | tee -a $final_path/conf/ccnet.conf echo '[LDAP]' | tee -a $final_path/conf/ccnet.conf
echo 'HOST = ldap://localhost:389' | tee -a $final_path/conf/ccnet.conf echo 'HOST = ldap://localhost:389' | tee -a $final_path/conf/ccnet.conf

View file

@ -122,6 +122,14 @@ case $installed_version in
"6.3."* ) "6.3."* )
# Update seafile by script # Update seafile by script
expect_scripts/upgrade_7.0.exp $final_path/seafile-server-$seafile_version $root_pwd expect_scripts/upgrade_7.0.exp $final_path/seafile-server-$seafile_version $root_pwd
# SSO authentication
echo 'ENABLE_REMOTE_USER_AUTHENTICATION = True' | tee -a $final_path/conf/seahub_settings.py
echo 'REMOTE_USER_CREATE_UNKNOWN_USER = False' | tee -a $final_path/conf/seahub_settings.py
echo "REMOTE_USER_DOMAIN = '$domain'" | tee -a $final_path/conf/seahub_settings.py
echo "REMOTE_USER_PROTECTED_PATH = ['$path_url', '$path_url/accounts/login']" | tee -a $final_path/conf/seahub_settings.py
# Clean connexion from the SSO. If we don't do this we could have some when the user was loged by the old SSO auth mecanisme
ynh_mysql_execute_as_root --sql "DELETE FROM `django_session`" --database seahubdb
;& ;&
esac esac