diff --git a/conf/add_sso_conf.py b/conf/add_sso_conf.py deleted file mode 100644 index f6b7d41..0000000 --- a/conf/add_sso_conf.py +++ /dev/null @@ -1,28 +0,0 @@ -import json -import sys - -domain = sys.argv[1] -server_name = sys.argv[2] - -with open("/etc/ssowat/conf.json.persistent", "r", encoding='utf-8') as jsonFile: - data = json.load(jsonFile) - - if "skipped_urls" not in data: - data["skipped_urls"] = [] - if "protected_urls" not in data: - data["protected_urls"] = [] - - # Remove entry without the domain specified - if "/_matrix" in data["skipped_urls"]: - data["skipped_urls"].remove("/_matrix") - - if domain + "/_matrix" not in data["skipped_urls"]: - data["skipped_urls"].append(domain + "/_matrix") - if server_name + "/.well-known/matrix/" not in data["skipped_urls"]: - data["skipped_urls"].append(server_name + "/.well-known/matrix/") - - if domain + "/_matrix/cas_server.php/login" not in data["protected_urls"]: - data["protected_urls"].append(domain + "/_matrix/cas_server.php/login") - -with open("/etc/ssowat/conf.json.persistent", "w", encoding='utf-8') as jsonFile: - jsonFile.write(json.dumps(data, indent=4, sort_keys=True)) diff --git a/conf/remove_sso_conf.py b/conf/remove_sso_conf.py deleted file mode 100644 index d1aca96..0000000 --- a/conf/remove_sso_conf.py +++ /dev/null @@ -1,15 +0,0 @@ -import json -import sys - -domain = sys.argv[1] -server_name = sys.argv[2] - -with open("/etc/ssowat/conf.json.persistent", "r", encoding='utf-8') as jsonFile: - data = json.load(jsonFile) - - data["skipped_urls"].remove(domain + "/_matrix") - data["skipped_urls"].remove(server_name + "/.well-known/matrix/") - data["protected_urls"].remove(domain + "/_matrix/cas_server.php/login") - -with open("/etc/ssowat/conf.json.persistent", "w", encoding='utf-8') as jsonFile: - jsonFile.write(json.dumps(data, indent=4, sort_keys=True)) diff --git a/scripts/install b/scripts/install index ceaf927..d5b84c4 100644 --- a/scripts/install +++ b/scripts/install @@ -383,10 +383,9 @@ ynh_replace_string --match_string=__APP__ --replace_string=$app --target_file="$ #================================================= ynh_script_progression --message="Configuring SSOwat..." --weight=1 -# Open access to server without a button the home -# The script "add_sso_conf.py" will just add en entry for the path "/_matrix" in the sso conf.json.persistent file in the cathegory "skipped_urls". -python3 ../conf/add_sso_conf.py $domain $server_name || ynh_die --message="Your file /etc/ssowat/conf.json.persistent doesn't respect the json syntax. Please fix the syntax to install this app. For more information see here: https://github.com/YunoHost-Apps/synapse_ynh/issues/32" -ynh_permission_url --permission main --url $domain/_matrix/cas_server.php/login +ynh_permission_create --permission "_matrix" --url "/_matrix" --allowed "visitors" --label "Matrix API (leave it open to visitors!)" +ynh_permission_create --permission "well-known" --url "/.well-known/matrix/" --allowed "visitors" --label "Matrix's well-known URI (helps federation)" +ynh_permission_create --permission "login" --url "/_matrix/cas_server.php/login" --allowed "all_users" --label "Which users should be allowed to log into your Matrix server" #================================================= # UPDATE HOOKS diff --git a/scripts/remove b/scripts/remove index 34ed766..42ab29d 100755 --- a/scripts/remove +++ b/scripts/remove @@ -75,13 +75,6 @@ ynh_script_progression --message="Removing dependencies" --weight=15 # Remove metapackage and its dependencies ynh_remove_app_dependencies -#================================================= -# SETUP SSOWAT -#================================================= - -# Remove the skipped url -python3 ../conf/remove_sso_conf.py $domain $server_name - #================================================= # REMOVE APP MAIN DIR #================================================= diff --git a/scripts/restore b/scripts/restore index 9b27ca4..ada2671 100644 --- a/scripts/restore +++ b/scripts/restore @@ -216,9 +216,9 @@ ynh_exec_warn_less yunohost firewall allow Both $turnserver_alt_tls_port #================================================= ynh_script_progression --message="Configuring SSOwat..." -# Open access to server without a button the home -# The script "add_sso_conf.py" will just add en entry for the path "/_matrix" in the sso conf.json.persistent file in the cathegory "skipped_urls". -python3 ../settings/conf/add_sso_conf.py $domain $server_name || ynh_die --message="Your file /etc/ssowat/conf.json.persistent doesn't respect the json syntax. Please fix the syntax to install this app. For more information see here: https://github.com/YunoHost-Apps/synapse_ynh/issues/32" +ynh_permission_create --permission "_matrix" --url "/_matrix" --allowed "visitors" --label "Matrix API (leave it open to visitors!)" +ynh_permission_create --permission "well-known" --url "/.well-known/matrix/" --allowed "visitors" --label "Matrix's well-known URI (helps federation)" +ynh_permission_create --permission "login" --url "/_matrix/cas_server.php/login" --allowed "all_users" --label "Which users should be allowed to log into your Matrix server" #================================================= # SETUP LOGROTATE diff --git a/scripts/upgrade b/scripts/upgrade index b3682fd..2cceb74 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -148,7 +148,7 @@ if [ -e "/var/lib/matrix-$app" ]; then fi mv "/var/lib/matrix-$app" "$data_path" # matrix-synapse:x:994:994::/var/lib/matrix-synapse:/usr/sbin/nologin - sed --in-place -r "s@matrix-$app\:x\:(\n*:\n*)\:\:/var/lib/matrix-$app\:/usr/sbin/nologin@matrix-$app\:x\:(\n*:\n*)\:\:$final_path\:/usr/sbin/nologin@g" /etc/passwd + ynh_replace_string "s@matrix-$app\:x\:(\n*:\n*)\:\:/var/lib/matrix-$app\:/usr/sbin/nologin@matrix-$app\:x\:(\n*:\n*)\:\:$final_path\:/usr/sbin/nologin@g" /etc/passwd fi #================================================= @@ -451,10 +451,9 @@ ynh_add_fail2ban_config --use_template #================================================= ynh_script_progression --message="Configuring SSOwat..." --weight=1 -# Open access to server without a button the home -# The script "add_sso_conf.py" will just add en entry for the path "/_matrix" in the sso conf.json.persistent file in the cathegory "skipped_urls". -python3 ../conf/add_sso_conf.py $domain $server_name || ynh_die --message="Your file /etc/ssowat/conf.json.persistent doesn't respect the json syntax. Please fix the syntax to install this app. For more information see here: https://github.com/YunoHost-Apps/synapse_ynh/issues/32" -ynh_permission_url --permission main --url $domain/_matrix/cas_server.php/login +ynh_permission_create --permission "_matrix" --url "/_matrix" --allowed "visitors" --label "Matrix API (leave it open to visitors!)" +ynh_permission_create --permission "well-known" --url "/.well-known/matrix/" --allowed "visitors" --label "Matrix's well-known URI (helps federation)" +ynh_permission_create --permission "login" --url "/_matrix/cas_server.php/login" --allowed "all_users" --label "Which users should be allowed to log into your Matrix server" #================================================= # SECURE FILES AND DIRECTORIES