diff --git a/manifest.json b/manifest.json index b92f6f1..2c99641 100644 --- a/manifest.json +++ b/manifest.json @@ -4,7 +4,7 @@ "packaging_format": 1, "license": "LGPL-2.1,GPL-2.0", "url": "https://sogo.nu/", - "version": "3.2.6-2~ynh1", + "version": "3.2.6-3~ynh1", "description": { "en": "Sogo is an opensource groupware for E-Mail, Contacts and Calender.", "fr": "Sogo est un groupware opensource pour les e-mail, contacts et calendrier" diff --git a/scripts/_common.sh b/scripts/_common.sh index 492b68a..ca96a84 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -71,16 +71,17 @@ location /Microsoft-Server-ActiveSync/ { } " >> "$nginx_config_path" - - grep "/.well-known/caldav" $nginx_domain_path || echo "location /.well-known/caldav { + grep "/.well-known/caldav" $nginx_domain_path || echo "# For Caldav +location /.well-known/caldav { rewrite ^ https://\$server_name/SOGo/dav/; } - " >> "$nginx_config_path" +" >> "$nginx_config_path" - grep "/.well-known/carddav" $nginx_domain_path || echo "location /.well-known/carddav { + grep "/.well-known/carddav" $nginx_domain_path || echo "# For Carddav +location /.well-known/carddav { rewrite ^ https://\$server_name/SOGo/dav/; } - " >> "$nginx_config_path" +" >> "$nginx_config_path" ynh_store_file_checksum "$nginx_config_path" diff --git a/scripts/add_sso_conf.py b/scripts/add_sso_conf.py new file mode 100644 index 0000000..1fb9922 --- /dev/null +++ b/scripts/add_sso_conf.py @@ -0,0 +1,16 @@ +#!/usr/bin/python3 + +import json + +with open("/etc/ssowat/conf.json.persistent", "r", encoding='utf-8') as jsonFile: + try: + data = json.load(jsonFile) + except: + print("File /etc/ssowat/conf.json.persistent corrupt, make a new file") + data = {} + if not "skipped_urls" in data: + data["skipped_urls"] = [] + data["skipped_urls"] = list(set(data["skipped_urls"]) | set(["/Microsoft-Server-ActiveSync", "/principals"])) + +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 3eed672..640dde5 100755 --- a/scripts/install +++ b/scripts/install @@ -80,6 +80,7 @@ then # Retire l'accès public else ynh_app_setting_set $app unprotected_uris "/" fi +python3 add_sso_conf.py # SETUP LOGROTATE ynh_use_logrotate /var/log/$app/sogo.log --non-append diff --git a/scripts/remove b/scripts/remove index 3c56dfa..07da02b 100755 --- a/scripts/remove +++ b/scripts/remove @@ -39,5 +39,8 @@ ynh_secure_remove "/etc/$app" # Remove stunnel config ynh_secure_remove "/etc/stunnel/$app.conf" +# Remove custom SSO config +python3 remove_sso_conf.py + # Remove the app-specific logrotate config ynh_remove_logrotate diff --git a/scripts/remove_sso_conf.py b/scripts/remove_sso_conf.py new file mode 100644 index 0000000..26b7420 --- /dev/null +++ b/scripts/remove_sso_conf.py @@ -0,0 +1,11 @@ +#!/usr/bin/python3 + +import json + +with open("/etc/ssowat/conf.json.persistent", "r", encoding='utf-8') as jsonFile: + data = json.load(jsonFile) + data["skipped_urls"].remove("/Microsoft-Server-ActiveSync") + data["skipped_urls"].remove("/principals") + +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/restore b/scripts/restore index 521ff39..c84fca8 100755 --- a/scripts/restore +++ b/scripts/restore @@ -48,6 +48,8 @@ ynh_replace_string "ENABLED=0" "ENABLED=1" /etc/default/stunnel4 # SECURE FILES AND DIRECTORIES set_permission +python3 ../settings/scripts/add_sso_conf.py + # SETUP LOGROTATE ynh_use_logrotate /var/log/$app/sogo.log --non-append diff --git a/scripts/upgrade b/scripts/upgrade index e84aeae..589a7e7 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -103,6 +103,7 @@ then # Retire l'accès public else ynh_app_setting_set $app unprotected_uris "/" fi +python3 add_sso_conf.py # SETUP LOGROTATE ynh_use_logrotate /var/log/$app/sogo.log --non-append