Improve sso config

Former-commit-id: 5ef86ebac4
This commit is contained in:
mbugeia 2015-03-18 17:34:29 +01:00
parent 9df8e5b078
commit 25bb354d14
4 changed files with 27 additions and 2 deletions

11
conf/add_sso_conf.py Normal file
View file

@ -0,0 +1,11 @@
import json
with open("/etc/ssowat/conf.json.persistent", "r") as jsonFile:
data = json.load(jsonFile)
if "unprotected_urls" in data:
data["unprotected_urls"].append("/seafhttp")
else:
data["unprotected_urls"] = ["/seafhttp"]
with open("/etc/ssowat/conf.json.persistent", "w") as jsonFile:
jsonFile.write(json.dumps(data, indent=4, sort_keys=True))

8
conf/remove_sso_conf.py Normal file
View file

@ -0,0 +1,8 @@
import json
with open("/etc/ssowat/conf.json.persistent", "r") as jsonFile:
data = json.load(jsonFile)
data["unprotected_urls"].remove("/seafhttp")
with open("/etc/ssowat/conf.json.persistent", "w") as jsonFile:
jsonFile.write(json.dumps(data, indent=4, sort_keys=True))

View file

@ -129,8 +129,11 @@ sudo yunohost firewall allow $seafile_port
sudo su - www-data -c "/var/www/seafile/seafile-server-4.0.6/seafile.sh start" sudo su - www-data -c "/var/www/seafile/seafile-server-4.0.6/seafile.sh start"
sudo su - www-data -c "$final_path/first_launch.exp $admin_email $admin_password" sudo su - www-data -c "$final_path/first_launch.exp $admin_email $admin_password"
#sudo yunohost app setting seafile skipped_urls -v "/media" # add sso config to unprotect domain.tld/seafhttp in /etc/ssowat/conf.json.persistent
#sudo yunohost app setting seafile unprotected_urls -v "/" sudo python ../conf/add_sso_config.py
# unprotect media
sudo yunohost app setting seafile unprotected_uris -v "/media"
if [ "$is_public" = "No" ] if [ "$is_public" = "No" ]
then then

View file

@ -20,6 +20,9 @@ sudo yunohost firewall disallow $seafile_port
sudo yunohost service remove seafile-server sudo yunohost service remove seafile-server
# remove sso config to unprotect domain.tld/seafhttp in /etc/ssowat/conf.json.persistent
sudo python ../conf/remove_sso_config.py
# Restart services # Restart services
sudo service nginx reload sudo service nginx reload
sudo yunohost app ssowatconf sudo yunohost app ssowatconf