From 2459c86eb671478189b488478315cdb07f3cd381 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Fri, 14 Jan 2022 23:57:33 +0100 Subject: [PATCH 01/33] Fix --- check_process | 12 ++- conf/cron | 6 +- manifest.json | 37 ++++----- scripts/_common.sh | 3 + scripts/backup | 77 +++++++++++++------ scripts/change_url | 1 - scripts/experimental_helper.sh | 0 scripts/install | 135 ++++++++++++++++++++++----------- scripts/remove | 103 +++++++++++++++++-------- scripts/restore | 1 - scripts/upgrade | 58 ++++++++------ 11 files changed, 280 insertions(+), 153 deletions(-) delete mode 100644 scripts/experimental_helper.sh diff --git a/check_process b/check_process index 0a909a8..b3002dc 100644 --- a/check_process +++ b/check_process @@ -5,12 +5,12 @@ ;; Test complet ; Manifest - domain="domain.tld" (DOMAIN) - path="/SOGo" (PATH) - admin="john" (USER) + domain="domain.tld" + path="/SOGo" + admin="john" language="French" - is_public=1 (PUBLIC|public=1|private=0) - port="20000" (PORT) + is_public=1 + port="20000" ; Checks pkg_linter=1 setup_sub_dir=1 @@ -22,8 +22,6 @@ upgrade=1 from_commit=cc07f5da79498ef948c31a99f6ace9ad0a5b9ec1 backup_restore=1 multi_instance=0 - incorrect_path=1 - port_already_use=1 (8448) change_url=0 ;;; Upgrade options ; commit=cc07f5da79498ef948c31a99f6ace9ad0a5b9ec1 diff --git a/conf/cron b/conf/cron index 3e4484b..f770c98 100644 --- a/conf/cron +++ b/conf/cron @@ -2,17 +2,17 @@ # Vacation messages expiration # The credentials file should contain the sieve admin credentials (username:passwd) -0 0 * * * __APP__ /opt/yunohost/__APP__/sbin/sogo-tool update-autoreply -p /etc/sogo/sieve.creds +0 0 * * * __APP__ /opt/yunohost/__APP__/sbin/sogo-tool update-autoreply -p /etc/sogo/sieve.creds # Session cleanup - runs every minute # - Ajust the nbMinutes parameter to suit your needs # Example: Sessions without activity since 60 minutes will be dropped: -* * * * * __APP__ /opt/yunohost/__APP__/sbin/sogo-tool expire-sessions 60 > /dev/null 2>&1 +* * * * * __APP__ /opt/yunohost/__APP__/sbin/sogo-tool expire-sessions 60 > /dev/null 2>&1 # Email alarms - runs every minutes # If you need to use SMTP AUTH for outgoing mails, specify credentials to use # with '-p /path/to/credentialsFile' (same format as the sieve credentials) -* * * * * __APP__ /opt/yunohost/__APP__/sbin/sogo-ealarms-notify > /dev/null 2>&1 +* * * * * __APP__ /opt/yunohost/__APP__/sbin/sogo-ealarms-notify > /dev/null 2>&1 # Daily backups # - writes to ~sogo/backups/ by default diff --git a/manifest.json b/manifest.json index 872fd07..6e560eb 100644 --- a/manifest.json +++ b/manifest.json @@ -2,13 +2,20 @@ "name": "SOGo", "id": "sogo", "packaging_format": 1, - "license": "LGPL-2.1,GPL-2.0", - "url": "https://sogo.nu/", - "version": "4.0.7-1~ynh2", "description": { - "en": "An opensource groupware for E-Mail, Contacts and Calender.", - "fr": "Un groupware opensource pour les e-mail, contacts et calendrier" + "en": "Opensource groupware for E-Mail, Contacts and Calender", + "fr": "Groupware opensource pour les e-mail, contacts et calendrier" }, + "version": "5.4.0~ynh1", + "url": "https://sogo.nu/", + "upstream": { + "license": "LGPL-2.1,GPL-2.0", + "website": "https://sogo.nu/", + "demo": "https://demo.sogo.nu/SOGo/", + "admindoc": "https://www.sogo.nu/support.html#/documentation", + "code": "https://github.com/inverse-inc/sogo" + }, + "license": "LGPL-2.1,GPL-2.0", "maintainer": { "name": "Josué Tille", "email": "josue@tille.ch" @@ -24,35 +31,21 @@ "mysql" ], "requirements": { - "yunohost": ">= 4.1" + "yunohost": ">= 4.3.0" }, "arguments": { "install" : [ { "name": "domain", - "type": "domain", - "ask": { - "en": "Choose a domain name for SOGo", - "fr": "Choisissez un nom de domaine pour SOGo" - }, - "example": "example.com" + "type": "domain" }, { "name": "admin", - "type": "user", - "ask": { - "en": "Choose an admin user", - "fr": "Choisissez l’administrateur" - }, - "example": "johndoe" + "type": "user" }, { "name": "is_public", "type": "boolean", - "ask": { - "en": "Is it a public site ? To be able to use caldav and cardav you need to set as public.", - "fr": "Est-ce un site public ? Pour pouvoir utiliser caldav et cardav vous devz mettre en public." - }, "help": { "en": "If it's not public, everybody which want to access to any page of SOGo need to be authenticated on the SSO. On the public mode anybody can access to the authentication page. The shared calendar will be also accessible by anybody who has this link", "fr": "Si n'est pas publique, n'importe qui veux accéder à n'importe quelle page de SOGo doit être authentifié dans le SSO. Dans le mode publique n'importe qui peut accéder à la page d'authentification de SOGo. Les agenda partagé seront aussi accessible par n'import qui qui à ce liens." diff --git a/scripts/_common.sh b/scripts/_common.sh index 0f5273b..1fa5507 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -6,6 +6,9 @@ app=$YNH_APP_INSTANCE_NAME +# dependencies used by the app +pkg_dependencies="sogo stunnel4 memcached" + #================================================= # DEFINE ALL COMMON FONCTIONS #================================================= diff --git a/scripts/backup b/scripts/backup index 05d1216..4568644 100755 --- a/scripts/backup +++ b/scripts/backup @@ -3,47 +3,78 @@ #================================================= # GENERIC START #================================================= +# IMPORT GENERIC HELPERS +#================================================= -# Import common cmd -source ../settings/scripts/experimental_helper.sh +# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts source ../settings/scripts/_common.sh - -# Source YunoHost helpers source /usr/share/yunohost/helpers -# Stop script if errors +#================================================= +# MANAGE SCRIPT FAILURE +#================================================= + +ynh_clean_setup () { + ### Remove this function if there's nothing to clean before calling the remove script. + true +} +# Exit if an error occurs during the execution of the script ynh_abort_if_errors +#================================================= +# LOAD SETTINGS +#================================================= ynh_print_info --message="Loading installation settings..." -# retrieve useful param -domain=$(ynh_app_setting_get --app $app --key domain) -db_name=$(ynh_app_setting_get --app $app --key db_name) +app=$YNH_APP_INSTANCE_NAME + +domain=$(ynh_app_setting_get --app=$app --key=domain) +db_name=$(ynh_app_setting_get --app=$app --key=db_name) #================================================= -# STANDARD BACKUP STEPS +# DECLARE DATA AND CONF FILES TO BACKUP #================================================= +ynh_print_info --message="Declaring files to be backed up..." -ynh_print_info --message="Backing up configuration..." - +#================================================= # BACKUP THE NGINX CONFIGURATION -ynh_backup --src_path "/etc/nginx/conf.d/$domain.d/$app.conf" +#================================================= -# Backup SOGo config -ynh_backup --src_path "/etc/$app" +ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf" -# Backup stunnel config -ynh_backup --src_path "/etc/stunnel/$app.conf" +#================================================= +# BACKUP SOGo CONFIGURATION +#================================================= -# Backup Cron -ynh_backup --src_path "/etc/cron.d/$app" +ynh_backup --src_path="/etc/$app" -# Backup Logs -ynh_print_info --message="Backing up logs" -ynh_backup --src_path "/var/log/$app" +#================================================= +# BACKUP STUNNEL CONFIGURATION +#================================================= +ynh_backup --src_path="/etc/stunnel/$app.conf" + +#================================================= +# BACKUP CRON +#================================================= + +ynh_backup --src_path="/etc/cron.d/$app" + +#================================================= +# BACKUP LOGS +#================================================= + +ynh_backup --src_path="/var/log/$app" + +#================================================= # BACKUP THE MYSQL DATABASE -ynh_print_info --message="Backing up database" -ynh_mysql_dump_db "$db_name" > db.sql +#================================================= +ynh_print_info --message="Backing up the MySQL database..." + +ynh_mysql_dump_db --database="$db_name" > db.sql + +#================================================= +# END OF SCRIPT +#================================================= ynh_print_info --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)." diff --git a/scripts/change_url b/scripts/change_url index 1813e6b..90733ed 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -5,7 +5,6 @@ #================================================= # Import common cmd -source ./experimental_helper.sh source ./_common.sh # IMPORT GENERIC HELPERS diff --git a/scripts/experimental_helper.sh b/scripts/experimental_helper.sh deleted file mode 100644 index e69de29..0000000 diff --git a/scripts/install b/scripts/install index 8e6324d..b063666 100755 --- a/scripts/install +++ b/scripts/install @@ -3,24 +3,38 @@ #================================================= # GENERIC START #================================================= +# IMPORT GENERIC HELPERS +#================================================= -# Import common cmd -source ./experimental_helper.sh -source ./_common.sh - -# Source YunoHost helpers +source _common.sh source /usr/share/yunohost/helpers -# Stop script if errors +#================================================= +# MANAGE SCRIPT FAILURE +#================================================= + +ynh_clean_setup () { + ### Remove this function if there's nothing to clean before calling the remove script. + true +} +# Exit if an error occurs during the execution of the script ynh_abort_if_errors -ynh_script_progression --message="Validating installation parameters..." - +#================================================= # RETRIEVE ARGUMENTS FROM THE MANIFEST +#================================================= + domain=$YNH_APP_ARG_DOMAIN admin=$YNH_APP_ARG_ADMIN is_public=$YNH_APP_ARG_IS_PUBLIC +app=$YNH_APP_INSTANCE_NAME + +#================================================= +# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS +#================================================= +ynh_script_progression --message="Validating installation parameters..." --weight=1 + # Set variable path_url="/SOGo" # final_path="/opt/yunohost/$app" @@ -28,33 +42,45 @@ path_url="/SOGo" # Register (book) web path ynh_webpath_register --app $app --domain $domain --path_url $path_url -# Find a port for SOGo -ynh_script_progression --message="Finding available ports..." -port=$(ynh_find_port --port 20000) -smtp_port=$(ynh_find_port --port $((port+1))) - +#================================================= # STORE SETTINGS FROM MANIFEST -ynh_script_progression --message="Storing installation settings..." -ynh_app_setting_set --app $app --key admin --value $admin -ynh_app_setting_set --app $app --key is_public --value $is_public -ynh_app_setting_set --app $app --key smtp_port --value $smtp_port -ynh_app_setting_set --app $app --key web_port --value $port +#================================================= +ynh_script_progression --message="Storing installation settings..." --weight=1 + +ynh_app_setting_set --app=$app --key=domain --value=$domain +ynh_app_setting_set --app=$app --key=path --value=$path_url +ynh_app_setting_set --app=$app --key=admin --value=$admin +ynh_app_setting_set --app=$app --key=is_public --value=$is_public #================================================= # STANDARD MODIFICATIONS #================================================= +# FIND AND OPEN A PORT +#================================================= +ynh_script_progression --message="Finding an available port..." --weight=1 +port=$(ynh_find_port --port 20000) +ynh_app_setting_set --app=$app --key=web_port --value=$port + +smtp_port=$(ynh_find_port --port $((port+1))) +ynh_app_setting_set --app=$app --key=smtp_port --value=$smtp_port + +#================================================= # INSTALL DEPENDENCIES -ynh_script_progression --message="Installing dependencies..." --weight=7 -install_dependance +#================================================= +ynh_script_progression --message="Installing dependencies..." --weight=1 +ynh_install_app_dependencies $pkg_dependencies + +#================================================= # CREATE A MYSQL DATABASE -ynh_script_progression --message="Configuring MySQL database..." -db_name=$(ynh_sanitize_dbid $app) +#================================================= +ynh_script_progression --message="Creating a MySQL database..." --weight=1 + +db_name=$(ynh_sanitize_dbid --db_name=$app) db_user=$db_name -ynh_app_setting_set --app $app --key db_name --value $db_name -ynh_app_setting_set --app $app --key db_user --value $db_user -ynh_mysql_setup_db --db_name $db_name --db_user $db_user +ynh_app_setting_set --app=$app --key=db_name --value=$db_name +ynh_mysql_setup_db --db_user=$db_user --db_name=$db_name ynh_script_progression --message="Configuring application..." --weight=3 @@ -69,39 +95,60 @@ config_stunnel # Install crontab config_cron -#Configure Nginx -ynh_script_progression --message="Configuring nginx..." --weight=1 +#================================================= +# NGINX CONFIGURATION +#================================================= +ynh_script_progression --message="Configuring NGINX web server..." --weight=1 + config_nginx +#================================================= +# SECURE FILES AND DIRECTORIES +#================================================= +ynh_script_progression --message="Protecting directory..." --weight=1 + +set_permission + #================================================= # GENERIC FINALIZATION #================================================= +# SETUP LOGROTATE +#================================================= +ynh_script_progression --message="Configuring log rotation..." --weight=1 -# SECURE FILES AND DIRECTORIES -ynh_script_progression --message="Protecting directory..." -set_permission +ynh_use_logrotate --logfile /var/log/$app/sogo.log --nonappend -# configure the sso -ynh_script_progression --message="Configuring permissions..." -ynh_permission_create --permission="sync_client" --allowed='visitors' --auth_header=false\ - --label="Sync client" --protected=true --show_tile=false\ - --additional_urls="/Microsoft-Server-ActiveSync" "/principals" "/.well-known/caldav" "/.well-known/carddav" +#================================================= +# SETUP SSOWAT +#================================================= +ynh_script_progression --message="Configuring permissions..." --weight=1 if [ "$is_public" == '1' ]; then ynh_permission_update --permission "main" --add "visitors" fi -# SETUP LOGROTATE -ynh_script_progression --message="Configuring log rotation..." -ynh_use_logrotate --logfile /var/log/$app/sogo.log --nonappend +ynh_permission_create --permission="sync_client" --allowed='visitors' --auth_header=false\ + --label="Sync client" --protected=true --show_tile=false\ + --additional_urls="/Microsoft-Server-ActiveSync" "/principals" "/.well-known/caldav" "/.well-known/carddav" -# Register service -yunohost service add $app --log "/var/log/$app/sogo.log" +#================================================= +# INTEGRATE SERVICE IN YUNOHOST +#================================================= +ynh_script_progression --message="Integrating service in YunoHost..." --weight=1 -# Restart services -ynh_script_progression --message="Starting sogo services..." --weight=3 -systemctl restart sogo -systemctl restart stunnel4 +yunohost service add $app --description="A short description of the app" --log="/var/log/$app/$app.log" + +#================================================= +# START SYSTEMD SERVICE +#================================================= +ynh_script_progression --message="Starting a systemd service..." --weight=1 + +ynh_systemd_action --service_name=$app --action="restart" --log_path="systemd" +ynh_systemd_action --service_name=stunnel4 --action="restart" --log_path="systemd" + +#================================================= +# END OF SCRIPT +#================================================= ynh_script_progression --message="Installation of $app completed" --last diff --git a/scripts/remove b/scripts/remove index 13e6b77..a0845a3 100755 --- a/scripts/remove +++ b/scripts/remove @@ -3,57 +3,100 @@ #================================================= # GENERIC START #================================================= +# IMPORT GENERIC HELPERS +#================================================= -# Import common cmd -source ./experimental_helper.sh -source ./_common.sh - -# Source YunoHost helpers +source _common.sh source /usr/share/yunohost/helpers -ynh_script_progression --message="Loading installation settings..." +#================================================= +# LOAD SETTINGS +#================================================= +ynh_script_progression --message="Loading installation settings..." --weight=1 -# Retrieve app settings app=$YNH_APP_INSTANCE_NAME -domain=$(ynh_app_setting_get --app $app --key domain) -port=$(ynh_app_setting_get --app $app --key port) -db_name=$(ynh_app_setting_get --app $app --key db_name) -db_user=$(ynh_app_setting_get --app $app --key db_user) -final_path=$(ynh_app_setting_get --app $app --key final_path) + +domain=$(ynh_app_setting_get --app=$app --key=domain) +port=$(ynh_app_setting_get --app=$app --key=port) +db_name=$(ynh_app_setting_get --app=$app --key=db_name) +db_user=$db_name +final_path=$(ynh_app_setting_get --app=$app --key=final_path) #================================================= # STANDARD REMOVE #================================================= +# REMOVE SERVICE INTEGRATION IN YUNOHOST +#================================================= -# Remove metapackage and its dependencies -ynh_script_progression --message="Removing dependencies" --weight=10 -ynh_remove_app_dependencies +# Remove the service from the list of services known by YunoHost (added from `yunohost service add`) +if ynh_exec_warn_less yunohost service status $app >/dev/null +then + ynh_script_progression --message="Removing $app service integration..." --weight=1 + yunohost service remove $app +fi + +#================================================= +# STOP AND REMOVE SERVICE +#================================================= +ynh_script_progression --message="Stopping and removing the systemd service..." --weight=1 + +# Remove the dedicated systemd config +ynh_remove_systemd_config + +#================================================= +# REMOVE LOGROTATE CONFIGURATION +#================================================= +ynh_script_progression --message="Removing logrotate configuration..." --weight=1 + +# Remove the app-specific logrotate config +ynh_remove_logrotate + +#================================================= +# REMOVE THE MYSQL DATABASE +#================================================= +ynh_script_progression --message="Removing the MySQL database..." --weight=1 # Remove a database if it exists, along with the associated user -ynh_script_progression --message="Removing databases..." -ynh_mysql_remove_db --db_user $db_user --db_name $db_name +ynh_mysql_remove_db --db_user=$db_user --db_name=$db_name + +#================================================= +# REMOVE APP MAIN DIR +#================================================= +ynh_script_progression --message="Removing app main directory..." --weight=1 # Remove the app directory securely -ynh_script_progression --message="Removing user data..." ynh_secure_remove --file="$final_path" -ynh_script_progression --message="Removing configuration..." +#================================================= +# REMOVE NGINX CONFIGURATION +#================================================= +ynh_script_progression --message="Removing NGINX web server configuration..." --weight=1 + +# Remove the dedicated NGINX config +ynh_remove_nginx_config + +#================================================= +# REMOVE DEPENDENCIES +#================================================= +ynh_script_progression --message="Removing dependencies..." --weight=3 + +# Remove metapackage and its dependencies +ynh_remove_app_dependencies + +#================================================= +# SPECIFIC REMOVE +#================================================= +# REMOVE VARIOUS FILES +#================================================= +ynh_script_progression --message="Removing various files..." --weight=1 -# Remove sogo config ynh_secure_remove --file="/etc/$app" # Remove stunnel config ynh_secure_remove --file="/etc/stunnel/$app.conf" -# Remove nginx config -ynh_script_progression --message="Removing nginx configuration..." -ynh_remove_nginx_config - - -# Remove service -yunohost service remove $app - -# Remove the app-specific logrotate config -ynh_remove_logrotate +#================================================= +# END OF SCRIPT +#================================================= ynh_script_progression --message="Removal of $app completed" --last diff --git a/scripts/restore b/scripts/restore index 4731326..7b308b0 100755 --- a/scripts/restore +++ b/scripts/restore @@ -5,7 +5,6 @@ #================================================= # Import common cmd -source ../settings/scripts/experimental_helper.sh source ../settings/scripts/_common.sh # Source YunoHost helpers diff --git a/scripts/upgrade b/scripts/upgrade index 8e6e654..10edd1c 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -3,36 +3,45 @@ #================================================= # GENERIC START #================================================= - -# Import common cmd -source ./experimental_helper.sh -source ./_common.sh - # IMPORT GENERIC HELPERS +#================================================= + +source _common.sh source /usr/share/yunohost/helpers -# Exit if an error occurs during the execution of the script -ynh_abort_if_errors - -ynh_script_progression --message="Loading installation settings..." - +#================================================= # LOAD SETTINGS -domain=$(ynh_app_setting_get --app $app --key domain) -path_url=$(ynh_normalize_url_path --path_url $(ynh_app_setting_get --app $app --key path)) -admin=$(ynh_app_setting_get --app $app --key admin) -is_public=$(ynh_app_setting_get --app $app --key is_public) -port=$(ynh_app_setting_get --app $app --key web_port) -smtp_port=$(ynh_app_setting_get --app $app --key smtp_port) -db_name=$(ynh_app_setting_get --app $app --key db_name) -db_user=$(ynh_app_setting_get --app $app --key db_user) -db_pwd=$(ynh_app_setting_get --app $app --key mysqlpwd) +#================================================= +ynh_script_progression --message="Loading installation settings..." --weight=1 + +app=$YNH_APP_INSTANCE_NAME + +domain=$(ynh_app_setting_get --app=$app --key=domain) +path_url=$(ynh_app_setting_get --app=$app --key=path) +admin=$(ynh_app_setting_get --app=$app --key=admin) +is_public=$(ynh_app_setting_get --app=$app --key=is_public) +port=$(ynh_app_setting_get --app=$app --key=web_port) +smtp_port=$(ynh_app_setting_get --app=$app --key=smtp_port) +db_name=$(ynh_app_setting_get --app=$app --key=db_name) +db_user=$db_name +db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd) + +#================================================= +# CHECK VERSION +#================================================= + +upgrade_type=$(ynh_check_app_version_changed) + +#================================================= +# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP +#================================================= +ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --weight=1 # Backup the current version of the app ynh_backup_before_upgrade - ynh_clean_setup () { - # restore it if the upgrade fails - ynh_restore_upgradebackup + # Restore it if the upgrade fails + ynh_restore_upgradebackup } # Exit if an error occurs during the execution of the script ynh_abort_if_errors @@ -140,7 +149,12 @@ yunohost service add $app --log "/var/log/$app/sogo.log" # Restart services ynh_script_progression --message="Starting SOGo services..." --weight=3 + systemctl restart sogo systemctl restart stunnel4 +#================================================= +# END OF SCRIPT +#================================================= + ynh_script_progression --message="Upgrade of $app completed" --last From cfac9395094219568b4056b7dfddb2cf8a737c19 Mon Sep 17 00:00:00 2001 From: Yunohost-Bot <> Date: Fri, 14 Jan 2022 22:57:39 +0000 Subject: [PATCH 02/33] Auto-update README --- README.md | 124 ++++++++++----------------------------------------- README_fr.md | 39 ++++++++++++++++ 2 files changed, 62 insertions(+), 101 deletions(-) create mode 100644 README_fr.md diff --git a/README.md b/README.md index fcd763a..9cef796 100644 --- a/README.md +++ b/README.md @@ -1,107 +1,37 @@ -SOGo for Yunohost -================= + + +# SOGo for YunoHost [![Integration level](https://dash.yunohost.org/integration/sogo.svg)](https://dash.yunohost.org/appci/app/sogo) ![](https://ci-apps.yunohost.org/ci/badges/sogo.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/sogo.maintain.svg) -[![Install sogo with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=sogo) +[![Install SOGo with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=sogo) -> *This package allow you to install sogo quickly and simply on a YunoHost server. -If you don't have YunoHost, please see [here](https://yunohost.org/#/install) to know how to install and enjoy it.* +*[Lire ce readme en français.](./README_fr.md)* -Overview --------- +> *This package allows you to install SOGo quickly and simply on a YunoHost server. +If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/install) to learn how to install it.* -SOGo is an opensource groupware solution which has Webmail, a global address book and Calender and Contacts which can be synced via caldav or cardav. +## Overview -**Shipped version:** 4.0.7-1 +Opensource groupware for E-Mail, Contacts and Calender -Screenshots ------------ +**Shipped version:** 5.4.0~ynh1 -| Localized |Drag'n'Drop | Reminders | Delegation | -| :------------: | :------------: | :------------: | :------------: | -| ![](https://sogo.nu/img/features/localized.png) | ![](https://sogo.nu/img/features/dnd_01.png) | ![](https://sogo.nu/img/features/reminders.png) | ![](https://sogo.nu/img/features/delegation.png) | -| SOGo is available in over a dozen languages so you'll always feel at home. If your language is missing, you can easily contribute to the project and submit your translation. | Move messages to folders, drag contacts to address books, and modify events time and duration from the tip of your finger. Just like a desktop app. | Set alarms to important events and get alerted directly from your browser. | Set alarms to important events and get alerted directly from your browser. | Delegate access to your mail account or delegate an invitation to another person. | +**Demo:** https://demo.sogo.nu/SOGo/ -| Resource Reservation | HTML | Mail Return Receipt | Forward and Auto-Reply | -| :------------: | :------------: | :------------: | :------------: | -| ![](https://sogo.nu/img/features/resource.png) | ![](https://sogo.nu/img/features/html.png) | ![](https://sogo.nu/img/features/return-receipt.png) | ![](https://sogo.nu/img/features/auto-reply.png) | -| Define resources like projectors and conference rooms to automatically accept invitations for them while avoiding double-booking. | Compose HTML mail with the complete inline [rich-text editor](http://www.ckeditor.com). | Request or answer to return requests to confirm the arrival of messages. | Set an auto reply while on vacation or forward all your incoming mail to one ore many alternate email addresses. | +## Documentation and resources -| S/MIME | Mail Filtering | Sharing | Recurring Events | -| :------------: | :------------: | :------------: | :------------: | -| ![](https://sogo.nu/img/features/security.png) | ![](https://sogo.nu/img/features/mail-filters.png) | ![](https://sogo.nu/img/features/sharing.png) | ![](https://sogo.nu/img/features/recurring-events.png) | -| Sign and encrypt messages using your personal secure certificate. Automatically manage public certificates you receive by email. | Define powerful server-side filters to automatically act on new messages. Forward, discard, reject, flag or move incoming mail depending on complex criteria. | Share your mail, calendars and address books with other users. Define specific rights to each person or group of persons. | Define precise recurrence pattern for your repeating events and create exceptions if necessary. | +* Official app website: https://sogo.nu/ +* Official admin documentation: https://www.sogo.nu/support.html#/documentation +* Upstream app code repository: https://github.com/inverse-inc/sogo +* YunoHost documentation for this app: https://yunohost.org/app_sogo +* Report a bug: https://github.com/YunoHost-Apps/sogo_ynh/issues -| Free/Busy Time | Notifications | Categories | Multiple Mail Accounts | Export/Import | -| :------------: | :------------: | :------------: | :------------: | :------------: | -| ![](https://sogo.nu/img/features/freebusy.png) | ![](https://sogo.nu/img/features/notifications.png) | ![](https://sogo.nu/img/features/categories.png) | ![](https://sogo.nu/img/features/imap-accounts.png) | ![](https://sogo.nu/img/features/import.png) | -| Before sending an invitation, see the free/busy periods of attendees, either from the local SOGo server or a remote Microsoft Exchange server. Automatically set off-hours as busy if you like. | Be informed if someone modifies your calendar or automatically inform someone if your calendar changes. | Choose from a predefined set of categories or create your own categories and associate them to your events and contacts. | Configure all your mail accounts (IMAP) from SOGo and forget about login-in to multiple webmail services. | Export calendars or import events from a vCalendar file. Export contacts to LDIF or import cards from a LDIF of vCard file. Export a mailbox to zip archive. | +## Developer info - -Demo ----- - -* [Official demo](https://sogo.nu/) - - - -Documentation -------------- - - * Official documentation: https://sogo.nu/support.html#/documentation - * YunoHost documentation: There no other documentations, feel free to contribute. - -YunoHost specific features --------------------------- - -### Multi-users support - -LDAP and HTTP auth are supported. - -### Supported architectures - -* x86-64 - [![Build Status](https://ci-apps.yunohost.org/ci/logs/sogo%20%28Apps%29.svg)](https://ci-apps.yunohost.org/ci/apps/sogo/) -* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/sogo%20%28Apps%29.svg)](https://ci-apps-arm.yunohost.org/ci/apps/sogo/) - - - -Links ------ - - * Report a bug: https://github.com/YunoHost-Apps/sogo_ynh/issues - * App website: https://sogo.nu/ - * YunoHost website: https://yunohost.org/ - ---- - -Install -------- - -From command line: - -`sudo yunohost app install -l sogo https://github.com/YunoHost-Apps/sogo_ynh` - -Upgrade -------- - -From command line: - -`sudo yunohost app upgrade sogo -u https://github.com/YunoHost-Apps/sogo_ynh` - -Developers infos ----------------- - -Please do your pull request to the [testing branch](https://github.com/YunoHost-Apps/sogo_ynh/tree/testing). +Please send your pull request to the [testing branch](https://github.com/YunoHost-Apps/sogo_ynh/tree/testing). To try the testing branch, please proceed like that. ``` @@ -110,12 +40,4 @@ or sudo yunohost app upgrade sogo -u https://github.com/YunoHost-Apps/sogo_ynh/tree/testing --debug ``` -License -------- - -Sogo is published under the GPL-v2 and LGPL-v2 liencience : https://github.com/inverse-inc/sogo/blob/master/COPYING.GPL and https://github.com/inverse-inc/sogo/blob/master/COPYING.LGPL - -Todo ----- - --[ ] More Tests +**More info regarding app packaging:** https://yunohost.org/packaging_apps \ No newline at end of file diff --git a/README_fr.md b/README_fr.md new file mode 100644 index 0000000..64a4e88 --- /dev/null +++ b/README_fr.md @@ -0,0 +1,39 @@ +# SOGo pour YunoHost + +[![Niveau d'intégration](https://dash.yunohost.org/integration/sogo.svg)](https://dash.yunohost.org/appci/app/sogo) ![](https://ci-apps.yunohost.org/ci/badges/sogo.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/sogo.maintain.svg) +[![Installer SOGo avec YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=sogo) + +*[Read this readme in english.](./README.md)* +*[Lire ce readme en français.](./README_fr.md)* + +> *Ce package vous permet d'installer SOGo rapidement et simplement sur un serveur YunoHost. +Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour savoir comment l'installer et en profiter.* + +## Vue d'ensemble + +Groupware opensource pour les e-mail, contacts et calendrier + +**Version incluse :** 5.4.0~ynh1 + +**Démo :** https://demo.sogo.nu/SOGo/ + +## Documentations et ressources + +* Site officiel de l'app : https://sogo.nu/ +* Documentation officielle de l'admin : https://www.sogo.nu/support.html#/documentation +* Dépôt de code officiel de l'app : https://github.com/inverse-inc/sogo +* Documentation YunoHost pour cette app : https://yunohost.org/app_sogo +* Signaler un bug : https://github.com/YunoHost-Apps/sogo_ynh/issues + +## Informations pour les développeurs + +Merci de faire vos pull request sur la [branche testing](https://github.com/YunoHost-Apps/sogo_ynh/tree/testing). + +Pour essayer la branche testing, procédez comme suit. +``` +sudo yunohost app install https://github.com/YunoHost-Apps/sogo_ynh/tree/testing --debug +ou +sudo yunohost app upgrade sogo -u https://github.com/YunoHost-Apps/sogo_ynh/tree/testing --debug +``` + +**Plus d'infos sur le packaging d'applications :** https://yunohost.org/packaging_apps \ No newline at end of file From 66bd3b54f1618ce6b5f361f85636f7c553854c17 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Fri, 14 Jan 2022 23:58:52 +0100 Subject: [PATCH 03/33] Update change_url --- scripts/change_url | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/scripts/change_url b/scripts/change_url index 90733ed..c9a479d 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -1,18 +1,18 @@ #!/bin/bash #================================================= -# GENERIC START +# GENERIC STARTING +#================================================= +# IMPORT GENERIC HELPERS #================================================= -# Import common cmd -source ./_common.sh - -# IMPORT GENERIC HELPERS +source _common.sh source /usr/share/yunohost/helpers -# Exit if an error occurs during the execution of the script -ynh_abort_if_errors +#================================================= +# RETRIEVE ARGUMENTS +#================================================= ynh_script_progression --message="Loading installation settings..." # RETRIEVE ARGUMENTS @@ -51,4 +51,8 @@ ynh_store_file_checksum --file "/etc/nginx/conf.d/$domain.d/$app.conf" #Configure Nginx config_nginx +#================================================= +# END OF SCRIPT +#================================================= + ynh_script_progression --message="Change of URL completed for $app" --last From 60e8005d642df616e9963a4b05e40357cf960887 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sat, 15 Jan 2022 00:00:31 +0100 Subject: [PATCH 04/33] Update change_url --- scripts/change_url | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/scripts/change_url b/scripts/change_url index c9a479d..9845756 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -18,12 +18,18 @@ ynh_script_progression --message="Loading installation settings..." # RETRIEVE ARGUMENTS old_domain=$YNH_APP_OLD_DOMAIN domain=$YNH_APP_NEW_DOMAIN -path_url=$(ynh_normalize_url_path --path_url $YNH_APP_NEW_PATH) +path_url=$YNH_APP_NEW_PATH + app=$YNH_APP_INSTANCE_NAME -port=$(ynh_app_setting_get --app $app --key web_port) -admin=$(ynh_app_setting_get --app $app --key admin) -final_path=$(ynh_app_setting_get --app $app --key final_path) +#================================================= +# LOAD SETTINGS +#================================================= +ynh_script_progression --message="Loading installation settings..." --weight=1 + +port=$(ynh_app_setting_get --app=$app --key=web_port) +admin=$(ynh_app_setting_get --app=$app --key=admin) +final_path=$(ynh_app_setting_get --app=$app --key=final_path) # Check if the new path stay /SOGo if not exit From 2d1e0d1c1373a52f155c18336af2c3072ee2c44d Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sat, 15 Jan 2022 10:05:56 +0100 Subject: [PATCH 05/33] Fix --- scripts/backup | 6 +++ scripts/install | 12 ++++-- scripts/restore | 105 +++++++++++++++++++++++++++++++++--------------- scripts/upgrade | 11 ++++- 4 files changed, 97 insertions(+), 37 deletions(-) diff --git a/scripts/backup b/scripts/backup index 4568644..01bf979 100755 --- a/scripts/backup +++ b/scripts/backup @@ -42,6 +42,12 @@ ynh_print_info --message="Declaring files to be backed up..." ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf" +#================================================= +# BACKUP LOGROTATE +#================================================= + +ynh_backup --src_path="/etc/logrotate.d/$app" + #================================================= # BACKUP SOGo CONFIGURATION #================================================= diff --git a/scripts/install b/scripts/install index b063666..806c816 100755 --- a/scripts/install +++ b/scripts/install @@ -92,8 +92,14 @@ ynh_add_config --template="sogo.conf" --destination="/etc/$app/sogo.conf" # To fix the issue https://sogo.nu/bugs/view.php?id=31 we need stunnel to be able to connect correctly to the smtp server config_stunnel -# Install crontab -config_cron +#================================================= +# SETUP A CRON +#================================================= +ynh_script_progression --message="Setuping a cron..." --weight=1 + +ynh_add_config --template="../conf/cron" --destination="/etc/cron.d/$app" +chown root: "/etc/cron.d/$app" +chmod 644 "/etc/cron.d/$app" #================================================= # NGINX CONFIGURATION @@ -137,7 +143,7 @@ ynh_permission_create --permission="sync_client" --allowed='visitors' --auth_hea #================================================= ynh_script_progression --message="Integrating service in YunoHost..." --weight=1 -yunohost service add $app --description="A short description of the app" --log="/var/log/$app/$app.log" +yunohost service add $app --description="Groupware for E-Mail, Contacts and Calender" --log="/var/log/$app/$app.log" #================================================= # START SYSTEMD SERVICE diff --git a/scripts/restore b/scripts/restore index 7b308b0..e2f5cd8 100755 --- a/scripts/restore +++ b/scripts/restore @@ -3,68 +3,109 @@ #================================================= # GENERIC START #================================================= +# IMPORT GENERIC HELPERS +#================================================= -# Import common cmd +# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts source ../settings/scripts/_common.sh - -# Source YunoHost helpers source /usr/share/yunohost/helpers -# Stop script if errors +#================================================= +# MANAGE SCRIPT FAILURE +#================================================= + +ynh_clean_setup () { + #### Remove this function if there's nothing to clean before calling the remove script. + true +} +# Exit if an error occurs during the execution of the script ynh_abort_if_errors -ynh_script_progression --message="Loading settings..." +#================================================= +# LOAD SETTINGS +#================================================= +ynh_script_progression --message="Loading installation settings..." --weight=1 -domain=$(ynh_app_setting_get --app $app --key domain) -path_url=$(ynh_app_setting_get --app $app --key path) -final_path=$(ynh_app_setting_get --app $app --key final_path) -db_name=$(ynh_app_setting_get --app $app --key db_name) +app=$YNH_APP_INSTANCE_NAME +domain=$(ynh_app_setting_get --app=$app --key=domain) +path_url=$(ynh_app_setting_get --app=$app --key=path) +final_path=$(ynh_app_setting_get --app=$app --key=final_path) +db_name=$(ynh_app_setting_get --app=$app --key=db_name) +db_user=$db_name + +#================================================= # CHECK IF THE APP CAN BE RESTORED -ynh_webpath_available --domain $domain --path_url $path_url \ - || ynh_die --message "Path not available: ${domain}${path_url}" +#================================================= +ynh_script_progression --message="Validating restoration parameters..." --weight=1 + +test ! -d $final_path || ynh_die --message="There is already a directory: $final_path " #================================================= -# STANDARD RESTORATION STEPS +# REINSTALL DEPENDENCIES #================================================= +ynh_script_progression --message="Reinstalling dependencies..." --weight=1 # Define and install dependencies -ynh_script_progression --message="Reinstalling dependencies..." --weight=5 -install_dependance +ynh_install_app_dependencies $pkg_dependencies + # Restore all config and data ynh_script_progression --message="Restoring files..." --weight=10 + ynh_restore +#================================================= # RESTORE THE MYSQL DATABASE -ynh_script_progression --message="Restoring database..." --weight=3 -db_user=$db_name -db_pwd=$(ynh_app_setting_get --app $app --key mysqlpwd) -ynh_mysql_setup_db --db_name $db_name --db_user $db_user --db_pwd $db_pwd -ynh_mysql_connect_as --user $db_user --password $db_pwd --database $db_name < ./db.sql +#================================================= +ynh_script_progression --message="Restoring the MySQL database..." --weight=1 + +db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd) +ynh_mysql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd +ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./db.sql # Enable stunnel at startup ynh_replace_string --match_string "ENABLED=0" --replace_string "ENABLED=1" --target_file /etc/default/stunnel4 #================================================= -# GENERIC FINALIZATION -#================================================= - # SECURE FILES AND DIRECTORIES +#================================================= ynh_script_progression --message="Protecting directory..." + set_permission -# SETUP LOGROTATE -ynh_use_logrotate --logfile /var/log/$app/sogo.log --nonappend +#================================================= +# RESTORE THE LOGROTATE CONFIGURATION +#================================================= +ynh_script_progression --message="Restoring the logrotate configuration..." --weight=1 -# Register service -yunohost service add $app --log "/var/log/$app/sogo.log" +ynh_restore_file --origin_path="/etc/logrotate.d/$app" --nonappend + +#================================================= +# INTEGRATE SERVICE IN YUNOHOST +#================================================= +ynh_script_progression --message="Integrating service in YunoHost..." --weight=1 + +yunohost service add $app --description="Groupware for E-Mail, Contacts and Calender" --log="/var/log/$app/$app.log" + +#================================================= +# START SYSTEMD SERVICE +#================================================= +ynh_script_progression --message="Starting a systemd service..." --weight=3 + +ynh_systemd_action --service_name=$app --action="restart" --log_path="systemd" +ynh_systemd_action --service_name=stunnel4 --action="restart" --log_path="systemd" + +#================================================= +# RELOAD NGINX AND PHP-FPM +#================================================= +ynh_script_progression --message="Reloading NGINX web server..." --weight=1 + +ynh_systemd_action --service_name=nginx --action=reload + +#================================================= +# END OF SCRIPT +#================================================= -# Restart services -ynh_script_progression --message="Starting SOGo services..." --weight=3 -systemctl restart sogo -systemctl restart stunnel4 -systemctl reload nginx -systemctl restart cron ynh_script_progression --message="Restoration completed for $app" --last diff --git a/scripts/upgrade b/scripts/upgrade index 10edd1c..fcf46cc 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -111,8 +111,15 @@ ynh_add_config --template="sogo.conf" --destination="/etc/$app/sogo.conf" # Configure stunnel config_stunnel -# Install crontab -config_cron +#================================================= +# SETUP A CRON +#================================================= +ynh_script_progression --message="Setuping a cron..." --weight=1 + +ynh_add_config --template="../conf/cron" --destination="/etc/cron.d/$app" +chown root: "/etc/cron.d/$app" +chmod 644 "/etc/cron.d/$app" + #Configure Nginx config_nginx From 59fcf4135234740e25c904fce387aaffccd89ff9 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sat, 15 Jan 2022 10:09:18 +0100 Subject: [PATCH 06/33] Update upgrade --- scripts/upgrade | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/scripts/upgrade b/scripts/upgrade index fcf46cc..4a2baf3 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -121,6 +121,7 @@ chown root: "/etc/cron.d/$app" chmod 644 "/etc/cron.d/$app" + #Configure Nginx config_nginx @@ -151,14 +152,27 @@ fi ynh_script_progression --message="Configuring log rotation..." ynh_use_logrotate --logfile /var/log/$app/sogo.log --nonappend -# Register service -yunohost service add $app --log "/var/log/$app/sogo.log" +#================================================= +# INTEGRATE SERVICE IN YUNOHOST +#================================================= +ynh_script_progression --message="Integrating service in YunoHost..." --weight=1 -# Restart services -ynh_script_progression --message="Starting SOGo services..." --weight=3 +yunohost service add $app --description="Groupware for E-Mail, Contacts and Calender" --log="/var/log/$app/$app.log" -systemctl restart sogo -systemctl restart stunnel4 +#================================================= +# START SYSTEMD SERVICE +#================================================= +ynh_script_progression --message="Starting a systemd service..." --weight=1 + +ynh_systemd_action --service_name=$app --action="restart" --log_path="systemd" +ynh_systemd_action --service_name=stunnel4 --action="restart" --log_path="systemd" + +#================================================= +# RELOAD NGINX +#================================================= +ynh_script_progression --message="Reloading NGINX web server..." --weight=1 + +ynh_systemd_action --service_name=nginx --action=reload #================================================= # END OF SCRIPT From 8941854c831a8c82a1e64165baa68aae2e5c7931 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sat, 15 Jan 2022 10:11:21 +0100 Subject: [PATCH 07/33] Update upgrade --- scripts/upgrade | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/scripts/upgrade b/scripts/upgrade index 4a2baf3..687fe67 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -120,9 +120,11 @@ ynh_add_config --template="../conf/cron" --destination="/etc/cron.d/$app" chown root: "/etc/cron.d/$app" chmod 644 "/etc/cron.d/$app" +#================================================= +# NGINX CONFIGURATION +#================================================= +ynh_script_progression --message="Upgrading NGINX web server configuration..." --weight=1 - -#Configure Nginx config_nginx #================================================= @@ -148,9 +150,15 @@ else --add_url="/Microsoft-Server-ActiveSync" "/principals" "/.well-known/caldav" "/.well-known/carddav" fi +#================================================= +# GENERIC FINALIZATION +#================================================= # SETUP LOGROTATE -ynh_script_progression --message="Configuring log rotation..." -ynh_use_logrotate --logfile /var/log/$app/sogo.log --nonappend +#================================================= +ynh_script_progression --message="Upgrading logrotate configuration..." --time --weight=1 + +# Use logrotate to manage app-specific logfile(s) +ynh_use_logrotate --non-append #================================================= # INTEGRATE SERVICE IN YUNOHOST From aebd308481c3c70aa56288fadd91f6bb0daedb9b Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sat, 15 Jan 2022 10:12:54 +0100 Subject: [PATCH 08/33] Update upgrade --- scripts/upgrade | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/scripts/upgrade b/scripts/upgrade index 687fe67..61be0dd 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -99,14 +99,20 @@ fi # STANDARD MODIFICATIONS #================================================= -# INSTALL DEPENDENCIES -ynh_script_progression --message="Upgrading dependencies..." -install_dependance +#================================================= +# UPGRADE DEPENDENCIES +#================================================= +ynh_script_progression --message="Upgrading dependencies..." --time --weight=1 +ynh_install_app_dependencies $pkg_dependencies + +#================================================= +# UPDATE A CONFIG FILE +#================================================= ynh_script_progression --message="Configuring application..." # Configure SOGO -ynh_add_config --template="sogo.conf" --destination="/etc/$app/sogo.conf" +ynh_add_config --template="../conf/sogo.conf" --destination="/etc/$app/sogo.conf" # Configure stunnel config_stunnel From 522db2bec1cd3ff29221a41f0fb9fc23fd887931 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sat, 15 Jan 2022 10:15:24 +0100 Subject: [PATCH 09/33] Update _common.sh --- scripts/_common.sh | 2 -- 1 file changed, 2 deletions(-) diff --git a/scripts/_common.sh b/scripts/_common.sh index 1fa5507..26497e2 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -4,8 +4,6 @@ # SET ALL CONSTANTS #================================================= -app=$YNH_APP_INSTANCE_NAME - # dependencies used by the app pkg_dependencies="sogo stunnel4 memcached" From 5feddf721680125321ea7471390fbf5b27027691 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sat, 15 Jan 2022 10:16:51 +0100 Subject: [PATCH 10/33] Update install --- scripts/install | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/scripts/install b/scripts/install index 806c816..5937e72 100755 --- a/scripts/install +++ b/scripts/install @@ -90,7 +90,10 @@ ynh_add_config --template="sogo.conf" --destination="/etc/$app/sogo.conf" # Configure stunnel # To fix the issue https://sogo.nu/bugs/view.php?id=31 we need stunnel to be able to connect correctly to the smtp server -config_stunnel +ynh_add_config --template="../conf/stunnel.conf" --destination="/etc/stunnel/$app.conf" + +# Enable stunnel at startup +ynh_replace_string --match_string "ENABLED=0" --replace_string "ENABLED=1" --target_file /etc/default/stunnel4 #================================================= # SETUP A CRON From b523618eee85e7ad028a5bcdcda9fb60fb819c32 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sat, 15 Jan 2022 10:17:34 +0100 Subject: [PATCH 11/33] Update change_url --- scripts/change_url | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/scripts/change_url b/scripts/change_url index 9845756..513dfbc 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -9,7 +9,6 @@ source _common.sh source /usr/share/yunohost/helpers - #================================================= # RETRIEVE ARGUMENTS #================================================= @@ -41,8 +40,7 @@ fi #================================================= # STANDARD MODIFICATIONS #================================================= - -ynh_script_progression --message="Updating nginx configuration..." +ynh_script_progression --message="Updating NGINX configuration..." # MODIFY URL IN NGINX CONF nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf From ec21bef0c4a12086dd781882bbcfd3655a5067b8 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sat, 15 Jan 2022 10:19:18 +0100 Subject: [PATCH 12/33] Update install --- scripts/install | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/scripts/install b/scripts/install index 5937e72..58e7398 100755 --- a/scripts/install +++ b/scripts/install @@ -82,11 +82,14 @@ db_user=$db_name ynh_app_setting_set --app=$app --key=db_name --value=$db_name ynh_mysql_setup_db --db_user=$db_user --db_name=$db_name +#================================================= +# ADD A CONFIGURATION +#================================================= ynh_script_progression --message="Configuring application..." --weight=3 # Configure SOGO mkdir -p /etc/$app -ynh_add_config --template="sogo.conf" --destination="/etc/$app/sogo.conf" +ynh_add_config --template="../conf/sogo.conf" --destination="/etc/$app/sogo.conf" # Configure stunnel # To fix the issue https://sogo.nu/bugs/view.php?id=31 we need stunnel to be able to connect correctly to the smtp server From d6df1cb7f8aeae07dba1a6475b632763417c6d95 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sat, 15 Jan 2022 10:28:39 +0100 Subject: [PATCH 13/33] Update manifest.json --- manifest.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest.json b/manifest.json index 6e560eb..1c49bbb 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "Opensource groupware for E-Mail, Contacts and Calender", "fr": "Groupware opensource pour les e-mail, contacts et calendrier" }, - "version": "5.4.0~ynh1", + "version": "5.0.1~ynh1", "url": "https://sogo.nu/", "upstream": { "license": "LGPL-2.1,GPL-2.0", From 2f4d7f3c66ff0b60a813ca5e0c3a32e28cc7863c Mon Sep 17 00:00:00 2001 From: Yunohost-Bot <> Date: Sat, 15 Jan 2022 09:28:46 +0000 Subject: [PATCH 14/33] Auto-update README --- README.md | 2 +- README_fr.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 9cef796..de68322 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in Opensource groupware for E-Mail, Contacts and Calender -**Shipped version:** 5.4.0~ynh1 +**Shipped version:** 5.0.1~ynh1 **Demo:** https://demo.sogo.nu/SOGo/ diff --git a/README_fr.md b/README_fr.md index 64a4e88..2dc9c0b 100644 --- a/README_fr.md +++ b/README_fr.md @@ -13,7 +13,7 @@ Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour Groupware opensource pour les e-mail, contacts et calendrier -**Version incluse :** 5.4.0~ynh1 +**Version incluse :** 5.0.1~ynh1 **Démo :** https://demo.sogo.nu/SOGo/ From a38f1a8e8e76a891c3771cbe170b706b2d7d0c06 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sat, 15 Jan 2022 10:32:11 +0100 Subject: [PATCH 15/33] Fix --- scripts/install | 1 - scripts/remove | 8 -------- scripts/restore | 7 +++---- 3 files changed, 3 insertions(+), 13 deletions(-) diff --git a/scripts/install b/scripts/install index 58e7398..781dfb5 100755 --- a/scripts/install +++ b/scripts/install @@ -37,7 +37,6 @@ ynh_script_progression --message="Validating installation parameters..." --weigh # Set variable path_url="/SOGo" -# final_path="/opt/yunohost/$app" # Register (book) web path ynh_webpath_register --app $app --domain $domain --path_url $path_url diff --git a/scripts/remove b/scripts/remove index a0845a3..98d1b55 100755 --- a/scripts/remove +++ b/scripts/remove @@ -59,14 +59,6 @@ ynh_script_progression --message="Removing the MySQL database..." --weight=1 # Remove a database if it exists, along with the associated user ynh_mysql_remove_db --db_user=$db_user --db_name=$db_name -#================================================= -# REMOVE APP MAIN DIR -#================================================= -ynh_script_progression --message="Removing app main directory..." --weight=1 - -# Remove the app directory securely -ynh_secure_remove --file="$final_path" - #================================================= # REMOVE NGINX CONFIGURATION #================================================= diff --git a/scripts/restore b/scripts/restore index e2f5cd8..237e35a 100755 --- a/scripts/restore +++ b/scripts/restore @@ -35,11 +35,11 @@ db_name=$(ynh_app_setting_get --app=$app --key=db_name) db_user=$db_name #================================================= -# CHECK IF THE APP CAN BE RESTORED +# RESTORE THE NGINX CONFIGURATION #================================================= -ynh_script_progression --message="Validating restoration parameters..." --weight=1 +ynh_script_progression --message="Restoring the NGINX configuration..." --weight=1 -test ! -d $final_path || ynh_die --message="There is already a directory: $final_path " +ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" #================================================= # REINSTALL DEPENDENCIES @@ -107,5 +107,4 @@ ynh_systemd_action --service_name=nginx --action=reload # END OF SCRIPT #================================================= - ynh_script_progression --message="Restoration completed for $app" --last From 2c00f6783c68e6dde10b7bb27c2bbe5ffc9721a4 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sat, 15 Jan 2022 10:36:06 +0100 Subject: [PATCH 16/33] Fix --- conf/app.src | 6 ------ conf/nginx.conf | 1 + scripts/_common.sh | 4 ---- 3 files changed, 1 insertion(+), 10 deletions(-) delete mode 100644 conf/app.src diff --git a/conf/app.src b/conf/app.src deleted file mode 100644 index e4dd89f..0000000 --- a/conf/app.src +++ /dev/null @@ -1,6 +0,0 @@ -SOURCE_URL=url of app's source -SOURCE_SUM=sha256 checksum -SOURCE_SUM_PRG=sha256sum -SOURCE_FORMAT=tar.gz -SOURCE_IN_SUBDIR=true -SOURCE_FILENAME= diff --git a/conf/nginx.conf b/conf/nginx.conf index 9ee8171..6230e22 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -1,6 +1,7 @@ # SOGo Proxying #sub_path_only rewrite ^__PATH__$ __PATH__/ permanent; location ^~ __PATH__/ { + proxy_pass http://127.0.0.1:__PORT__; proxy_redirect http://127.0.0.1:__PORT__/SOGo/ /SOGo; # forward user's IP address diff --git a/scripts/_common.sh b/scripts/_common.sh index 26497e2..ddd0f8c 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -11,10 +11,6 @@ pkg_dependencies="sogo stunnel4 memcached" # DEFINE ALL COMMON FONCTIONS #================================================= -install_dependance() { - ynh_install_app_dependencies sogo stunnel4 memcached -} - config_stunnel() { ynh_add_config --template="stunnel.conf" --destination="/etc/stunnel/$app.conf" From 6cdd45fdca46fd4a9baa24ca8bea1e75d54855d4 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sat, 15 Jan 2022 11:55:45 +0100 Subject: [PATCH 17/33] Fix --- check_process | 2 -- scripts/install | 4 ++-- scripts/upgrade | 22 ++++------------------ 3 files changed, 6 insertions(+), 22 deletions(-) diff --git a/check_process b/check_process index b3002dc..5ae8b13 100644 --- a/check_process +++ b/check_process @@ -8,9 +8,7 @@ domain="domain.tld" path="/SOGo" admin="john" - language="French" is_public=1 - port="20000" ; Checks pkg_linter=1 setup_sub_dir=1 diff --git a/scripts/install b/scripts/install index 781dfb5..cffd8d4 100755 --- a/scripts/install +++ b/scripts/install @@ -58,10 +58,10 @@ ynh_app_setting_set --app=$app --key=is_public --value=$is_public #================================================= ynh_script_progression --message="Finding an available port..." --weight=1 -port=$(ynh_find_port --port 20000) +port=$(ynh_find_port --port=20000) ynh_app_setting_set --app=$app --key=web_port --value=$port -smtp_port=$(ynh_find_port --port $((port+1))) +smtp_port=$(ynh_find_port --port=$((port+1))) ynh_app_setting_set --app=$app --key=smtp_port --value=$smtp_port #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 61be0dd..74f1398 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -68,41 +68,27 @@ if [[ -z $port ]] then # Find a port for SOGo port=$(ynh_find_port --port 20000) - ynh_app_setting_set --app $app --key web_port --value $port + ynh_app_setting_set --app=$app --key=web_port --value=$port fi if [[ -z $db_name ]] then db_name=$app - ynh_app_setting_set --app $app --key db_name --value $db_name + ynh_app_setting_set --app=$app --key=db_name --value=$db_name fi if [[ -z $db_user ]] then db_user=$app - ynh_app_setting_set --app $app --key db_user --value $db_user -fi - -# Manage migration form SOGo 3.x to SOGo 4.x (Debian stretch -> Buster) -ynh_script_progression --message="Migrating database if needed..." - -# FIXME use the new way to manage version when available on the core -app_previous_version="$(jq -r .version /etc/yunohost/apps/$app/manifest.json | cut -d~ -f1)" -if [[ "$app_previous_version" == 3.2.* ]]; then - ynh_replace_string --match_string __APP__ --replace_string $app --target_file migrations/3.2-4.0.sh - ynh_replace_string --match_string __DBUSER__ --replace_string $db_user --target_file migrations/3.2-4.0.sh - ynh_replace_string --match_string __DBPASS__ --replace_string $db_pwd --target_file migrations/3.2-4.0.sh - bash migrations/3.2-4.0.sh + ynh_app_setting_set --app=$app --key=db_user --value=$db_user fi #================================================= # STANDARD MODIFICATIONS -#================================================= - #================================================= # UPGRADE DEPENDENCIES #================================================= -ynh_script_progression --message="Upgrading dependencies..." --time --weight=1 +ynh_script_progression --message="Upgrading dependencies..." --weight=1 ynh_install_app_dependencies $pkg_dependencies From 72c1363e7ca59e57bfa491dfd0f9caf5bb1cb777 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sat, 15 Jan 2022 11:58:38 +0100 Subject: [PATCH 18/33] Fix --- scripts/install | 4 ++-- scripts/upgrade | 14 ++++++++++++++ 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/scripts/install b/scripts/install index cffd8d4..374fc7f 100755 --- a/scripts/install +++ b/scripts/install @@ -134,9 +134,9 @@ ynh_use_logrotate --logfile /var/log/$app/sogo.log --nonappend #================================================= ynh_script_progression --message="Configuring permissions..." --weight=1 -if [ "$is_public" == '1' ]; +if [ $is_public -eq 1 ] then - ynh_permission_update --permission "main" --add "visitors" + ynh_permission_update --permission="main" --add="visitors" fi ynh_permission_create --permission="sync_client" --allowed='visitors' --auth_header=false\ diff --git a/scripts/upgrade b/scripts/upgrade index 74f1398..c875abe 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -83,6 +83,20 @@ then ynh_app_setting_set --app=$app --key=db_user --value=$db_user fi +# Cleaning legacy permissions +if ynh_legacy_permissions_exists; then + ynh_legacy_permissions_delete_all + + ynh_app_setting_delete --app=$app --key=is_public +fi + +if ! ynh_permission_exists --permission="sync_client"; then + # Create the required permissions + ynh_permission_create --permission="sync_client" --allowed='visitors' --auth_header=false\ + --label="Sync client" --protected=true --show_tile=false\ + --additional_urls="/Microsoft-Server-ActiveSync" "/principals" "/.well-known/caldav" "/.well-known/carddav" +fi + #================================================= # STANDARD MODIFICATIONS #================================================= From 725b2c65ab723097c1772640ec9a5f359774ad62 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sat, 15 Jan 2022 12:01:10 +0100 Subject: [PATCH 19/33] Fix --- scripts/_common.sh | 5 ----- scripts/install | 35 +++++++++++++++++++++-------------- 2 files changed, 21 insertions(+), 19 deletions(-) diff --git a/scripts/_common.sh b/scripts/_common.sh index ddd0f8c..173cd44 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -18,11 +18,6 @@ config_stunnel() { ynh_replace_string --match_string "ENABLED=0" --replace_string "ENABLED=1" --target_file /etc/default/stunnel4 } -config_cron() { - ynh_add_config --template="cron" --destination="/etc/cron.d/$app" - systemctl restart cron -} - config_nginx() { ynh_add_nginx_config diff --git a/scripts/install b/scripts/install index 374fc7f..7a969eb 100755 --- a/scripts/install +++ b/scripts/install @@ -129,20 +129,6 @@ ynh_script_progression --message="Configuring log rotation..." --weight=1 ynh_use_logrotate --logfile /var/log/$app/sogo.log --nonappend -#================================================= -# SETUP SSOWAT -#================================================= -ynh_script_progression --message="Configuring permissions..." --weight=1 - -if [ $is_public -eq 1 ] -then - ynh_permission_update --permission="main" --add="visitors" -fi - -ynh_permission_create --permission="sync_client" --allowed='visitors' --auth_header=false\ - --label="Sync client" --protected=true --show_tile=false\ - --additional_urls="/Microsoft-Server-ActiveSync" "/principals" "/.well-known/caldav" "/.well-known/carddav" - #================================================= # INTEGRATE SERVICE IN YUNOHOST #================================================= @@ -158,6 +144,27 @@ ynh_script_progression --message="Starting a systemd service..." --weight=1 ynh_systemd_action --service_name=$app --action="restart" --log_path="systemd" ynh_systemd_action --service_name=stunnel4 --action="restart" --log_path="systemd" +#================================================= +# SETUP SSOWAT +#================================================= +ynh_script_progression --message="Configuring permissions..." --weight=1 + +if [ $is_public -eq 1 ] +then + ynh_permission_update --permission="main" --add="visitors" +fi + +ynh_permission_create --permission="sync_client" --allowed='visitors' --auth_header=false\ + --label="Sync client" --protected=true --show_tile=false\ + --additional_urls="/Microsoft-Server-ActiveSync" "/principals" "/.well-known/caldav" "/.well-known/carddav" + +#================================================= +# RELOAD NGINX +#================================================= +ynh_script_progression --message="Reloading NGINX web server..." --weight=1 + +ynh_systemd_action --service_name=nginx --action=reload + #================================================= # END OF SCRIPT #================================================= From 5518182dd4b4a783cb6dd5f411bae27e30820630 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sat, 15 Jan 2022 12:03:56 +0100 Subject: [PATCH 20/33] Fix --- scripts/install | 5 ++++- scripts/upgrade | 16 ++++++++++------ 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/scripts/install b/scripts/install index 7a969eb..e8caf42 100755 --- a/scripts/install +++ b/scripts/install @@ -118,7 +118,10 @@ config_nginx #================================================= ynh_script_progression --message="Protecting directory..." --weight=1 -set_permission +chown -R $app:$app /etc/$app +chmod u=rwX,g=rX,o= -R /etc/$app +chown -R $app:$app /var/log/$app +chmod u=rwX,g=rX,o= -R /var/log/$app #================================================= # GENERIC FINALIZATION diff --git a/scripts/upgrade b/scripts/upgrade index c875abe..66a5a6c 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -134,12 +134,16 @@ ynh_script_progression --message="Upgrading NGINX web server configuration..." - config_nginx #================================================= -# GENERIC FINALIZATION -#================================================= - # SECURE FILES AND DIRECTORIES -ynh_script_progression --message="Protecting directory..." -set_permission +#================================================= +ynh_script_progression --message="Protecting directory..." --weight=1 + +chown -R $app:$app /etc/$app +chmod u=rwX,g=rX,o= -R /etc/$app +chown -R $app:$app /var/log/$app +chmod u=rwX,g=rX,o= -R /var/log/$app + + # configure the sso ynh_script_progression --message="Configuring permissions..." @@ -161,7 +165,7 @@ fi #================================================= # SETUP LOGROTATE #================================================= -ynh_script_progression --message="Upgrading logrotate configuration..." --time --weight=1 +ynh_script_progression --message="Upgrading logrotate configuration..." --weight=1 # Use logrotate to manage app-specific logfile(s) ynh_use_logrotate --non-append From 317da9ecc7f53e937c6d181d0e243f8d641b7d25 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sat, 15 Jan 2022 12:05:29 +0100 Subject: [PATCH 21/33] Update upgrade --- scripts/upgrade | 26 +++++--------------------- 1 file changed, 5 insertions(+), 21 deletions(-) diff --git a/scripts/upgrade b/scripts/upgrade index 66a5a6c..337ee8f 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -49,36 +49,20 @@ ynh_abort_if_errors #================================================= # UPGRADE SETTINGS FROM OLD INSTALL #================================================= +ynh_script_progression --message="Ensuring downward compatibility..." --weight=1 -ynh_script_progression --message="Fixing old settings..." --weight=1 - -if [[ ${is_public,,*} = "yes" ]] -then - is_public=1 - ynh_app_setting_set --app $app --key is_public --value 1 -fi - -if [[ ${is_public,,*} = "no" ]] -then - is_public=0 - ynh_app_setting_set --app $app --key is_public --value 0 -fi - -if [[ -z $port ]] -then +if [[ -z $port ]]; then # Find a port for SOGo - port=$(ynh_find_port --port 20000) + port=$(ynh_find_port --port=20000) ynh_app_setting_set --app=$app --key=web_port --value=$port fi -if [[ -z $db_name ]] -then +if [[ -z $db_name ]]; then db_name=$app ynh_app_setting_set --app=$app --key=db_name --value=$db_name fi -if [[ -z $db_user ]] -then +if [[ -z $db_user ]]; then db_user=$app ynh_app_setting_set --app=$app --key=db_user --value=$db_user fi From 7152d8f08f5e7fdc2c6ace3c3fbaec696af7b5c1 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sat, 15 Jan 2022 12:06:50 +0100 Subject: [PATCH 22/33] Update upgrade --- scripts/upgrade | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/scripts/upgrade b/scripts/upgrade index 337ee8f..87ea78b 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -99,7 +99,10 @@ ynh_script_progression --message="Configuring application..." ynh_add_config --template="../conf/sogo.conf" --destination="/etc/$app/sogo.conf" # Configure stunnel -config_stunnel +ynh_add_config --template="../conf/stunnel.conf" --destination="/etc/stunnel/$app.conf" + +# Enable stunnel at startup +ynh_replace_string --match_string="ENABLED=0" --replace_string="ENABLED=1" --target_file="/etc/default/stunnel4" #================================================= # SETUP A CRON From 3ec1935851ae571753ce4648169980d4c5ab0ebb Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sat, 15 Jan 2022 12:08:27 +0100 Subject: [PATCH 23/33] Fix --- scripts/install | 1 - scripts/upgrade | 1 - 2 files changed, 2 deletions(-) diff --git a/scripts/install b/scripts/install index e8caf42..e03d350 100755 --- a/scripts/install +++ b/scripts/install @@ -49,7 +49,6 @@ ynh_script_progression --message="Storing installation settings..." --weight=1 ynh_app_setting_set --app=$app --key=domain --value=$domain ynh_app_setting_set --app=$app --key=path --value=$path_url ynh_app_setting_set --app=$app --key=admin --value=$admin -ynh_app_setting_set --app=$app --key=is_public --value=$is_public #================================================= # STANDARD MODIFICATIONS diff --git a/scripts/upgrade b/scripts/upgrade index 87ea78b..78fb8c2 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -19,7 +19,6 @@ app=$YNH_APP_INSTANCE_NAME domain=$(ynh_app_setting_get --app=$app --key=domain) path_url=$(ynh_app_setting_get --app=$app --key=path) admin=$(ynh_app_setting_get --app=$app --key=admin) -is_public=$(ynh_app_setting_get --app=$app --key=is_public) port=$(ynh_app_setting_get --app=$app --key=web_port) smtp_port=$(ynh_app_setting_get --app=$app --key=smtp_port) db_name=$(ynh_app_setting_get --app=$app --key=db_name) From a2cc87d43dc643b5dd8ea3751cdb6e75d0635d2b Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sat, 15 Jan 2022 12:10:50 +0100 Subject: [PATCH 24/33] Update upgrade --- scripts/upgrade | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/upgrade b/scripts/upgrade index 78fb8c2..41270b3 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -92,7 +92,7 @@ ynh_install_app_dependencies $pkg_dependencies #================================================= # UPDATE A CONFIG FILE #================================================= -ynh_script_progression --message="Configuring application..." +ynh_script_progression --message="Configuring application..." --weight=1 # Configure SOGO ynh_add_config --template="../conf/sogo.conf" --destination="/etc/$app/sogo.conf" From d501e01d72ab8e65188760551dbba8bf8ef6a61b Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sat, 15 Jan 2022 12:11:28 +0100 Subject: [PATCH 25/33] Update restore --- scripts/restore | 1 - 1 file changed, 1 deletion(-) diff --git a/scripts/restore b/scripts/restore index 237e35a..a7cbe40 100755 --- a/scripts/restore +++ b/scripts/restore @@ -49,7 +49,6 @@ ynh_script_progression --message="Reinstalling dependencies..." --weight=1 # Define and install dependencies ynh_install_app_dependencies $pkg_dependencies - # Restore all config and data ynh_script_progression --message="Restoring files..." --weight=10 From 08ec109b207167096e1b83f60a1fff37b2662d3e Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sat, 15 Jan 2022 12:12:43 +0100 Subject: [PATCH 26/33] Update install --- scripts/install | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/install b/scripts/install index e03d350..4d136eb 100755 --- a/scripts/install +++ b/scripts/install @@ -94,7 +94,7 @@ ynh_add_config --template="../conf/sogo.conf" --destination="/etc/$app/sogo.conf ynh_add_config --template="../conf/stunnel.conf" --destination="/etc/stunnel/$app.conf" # Enable stunnel at startup -ynh_replace_string --match_string "ENABLED=0" --replace_string "ENABLED=1" --target_file /etc/default/stunnel4 +ynh_replace_string --match_string="ENABLED=0" --replace_string="ENABLED=1" --target_file="/etc/default/stunnel4" #================================================= # SETUP A CRON @@ -129,7 +129,7 @@ chmod u=rwX,g=rX,o= -R /var/log/$app #================================================= ynh_script_progression --message="Configuring log rotation..." --weight=1 -ynh_use_logrotate --logfile /var/log/$app/sogo.log --nonappend +ynh_use_logrotate --logfile="/var/log/$app/sogo.log" --nonappend #================================================= # INTEGRATE SERVICE IN YUNOHOST From e52653291158d027ec328df67ff2a86ebe3291f4 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sat, 15 Jan 2022 12:15:18 +0100 Subject: [PATCH 27/33] Update install --- scripts/install | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/install b/scripts/install index 4d136eb..4b9d7be 100755 --- a/scripts/install +++ b/scripts/install @@ -39,7 +39,7 @@ ynh_script_progression --message="Validating installation parameters..." --weigh path_url="/SOGo" # Register (book) web path -ynh_webpath_register --app $app --domain $domain --path_url $path_url +ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url #================================================= # STORE SETTINGS FROM MANIFEST From 22560178a08a40a82d036c336c5a440fa0d3b27f Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sat, 15 Jan 2022 13:11:40 +0100 Subject: [PATCH 28/33] Update restore --- scripts/restore | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/scripts/restore b/scripts/restore index a7cbe40..6032d8f 100755 --- a/scripts/restore +++ b/scripts/restore @@ -69,9 +69,12 @@ ynh_replace_string --match_string "ENABLED=0" --replace_string "ENABLED=1" --tar #================================================= # SECURE FILES AND DIRECTORIES #================================================= -ynh_script_progression --message="Protecting directory..." +ynh_script_progression --message="Protecting directory..." --weight=1 -set_permission +chown -R $app:$app /etc/$app +chmod u=rwX,g=rX,o= -R /etc/$app +chown -R $app:$app /var/log/$app +chmod u=rwX,g=rX,o= -R /var/log/$app #================================================= # RESTORE THE LOGROTATE CONFIGURATION From 26e9b47a13d1fd1d2f0d0eb2e9f35699f6abc6d7 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sat, 15 Jan 2022 13:19:43 +0100 Subject: [PATCH 29/33] Fix --- scripts/backup | 6 ++++++ scripts/restore | 22 +++++++++++++++++++--- 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/scripts/backup b/scripts/backup index 01bf979..4fcace1 100755 --- a/scripts/backup +++ b/scripts/backup @@ -48,6 +48,12 @@ ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf" ynh_backup --src_path="/etc/logrotate.d/$app" +#================================================= +# BACKUP SYSTEMD +#================================================= + +ynh_backup --src_path="/etc/systemd/system/$app.service" + #================================================= # BACKUP SOGo CONFIGURATION #================================================= diff --git a/scripts/restore b/scripts/restore index 6032d8f..693ea55 100755 --- a/scripts/restore +++ b/scripts/restore @@ -30,7 +30,6 @@ app=$YNH_APP_INSTANCE_NAME domain=$(ynh_app_setting_get --app=$app --key=domain) path_url=$(ynh_app_setting_get --app=$app --key=path) -final_path=$(ynh_app_setting_get --app=$app --key=final_path) db_name=$(ynh_app_setting_get --app=$app --key=db_name) db_user=$db_name @@ -50,9 +49,9 @@ ynh_script_progression --message="Reinstalling dependencies..." --weight=1 ynh_install_app_dependencies $pkg_dependencies # Restore all config and data -ynh_script_progression --message="Restoring files..." --weight=10 +#ynh_script_progression --message="Restoring files..." --weight=10 -ynh_restore +#ynh_restore #================================================= # RESTORE THE MYSQL DATABASE @@ -66,6 +65,15 @@ ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./ # Enable stunnel at startup ynh_replace_string --match_string "ENABLED=0" --replace_string "ENABLED=1" --target_file /etc/default/stunnel4 +#================================================= +# RESTORE VARIOUS FILES +#================================================= +ynh_script_progression --message="Restoring various files..." --weight=1 + +ynh_restore_file --origin_path="/etc/cron.d/$app" + +ynh_restore_file --origin_path="/etc/$app" + #================================================= # SECURE FILES AND DIRECTORIES #================================================= @@ -76,6 +84,14 @@ chmod u=rwX,g=rX,o= -R /etc/$app chown -R $app:$app /var/log/$app chmod u=rwX,g=rX,o= -R /var/log/$app +#================================================= +# RESTORE SYSTEMD +#================================================= +ynh_script_progression --message="Restoring the systemd configuration..." --weight=1 + +ynh_restore_file --origin_path="/etc/systemd/system/$app.service" +systemctl enable $app.service --quiet + #================================================= # RESTORE THE LOGROTATE CONFIGURATION #================================================= From 66f7c47b437e080eac5623791b42599f589f88f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Josu=C3=A9=20Tille?= Date: Sat, 28 May 2022 14:59:15 +0200 Subject: [PATCH 30/33] Fix code and add systemd sandbox --- check_process | 3 +++ conf/nginx.conf | 1 - conf/systemd.service | 30 ++++++++++++++++++++++++++++++ doc/DESCRIPTION.md | 1 + doc/DISCLAIMER.md | 0 manifest.json | 2 +- scripts/upgrade | 10 ++++++++++ 7 files changed, 45 insertions(+), 2 deletions(-) create mode 100644 doc/DESCRIPTION.md create mode 100644 doc/DISCLAIMER.md diff --git a/check_process b/check_process index 5ae8b13..2358f21 100644 --- a/check_process +++ b/check_process @@ -18,9 +18,12 @@ setup_public=1 upgrade=1 upgrade=1 from_commit=cc07f5da79498ef948c31a99f6ace9ad0a5b9ec1 + upgrade=1 from_commit=2fc174c57586df38506a07195decb08eed02f55f backup_restore=1 multi_instance=0 change_url=0 ;;; Upgrade options ; commit=cc07f5da79498ef948c31a99f6ace9ad0a5b9ec1 name=Before group permission support + ; commit=2fc174c57586df38506a07195decb08eed02f55f + name=Before refactoring diff --git a/conf/nginx.conf b/conf/nginx.conf index 6230e22..9ee8171 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -1,7 +1,6 @@ # SOGo Proxying #sub_path_only rewrite ^__PATH__$ __PATH__/ permanent; location ^~ __PATH__/ { - proxy_pass http://127.0.0.1:__PORT__; proxy_redirect http://127.0.0.1:__PORT__/SOGo/ /SOGo; # forward user's IP address diff --git a/conf/systemd.service b/conf/systemd.service index 8079db1..221a0a9 100644 --- a/conf/systemd.service +++ b/conf/systemd.service @@ -12,5 +12,35 @@ ExecStart=/opt/yunohost/__APP__/sbin/sogod -WOWorkersCount ${PREFORK} -WOPidFile PIDFile=/run/__APP__/sogo.pid User=__APP__ +# Sandboxing options to harden security +# Depending on specificities of your service/app, you may need to tweak these +# .. but this should be a good baseline +# Details for these options: https://www.freedesktop.org/software/systemd/man/systemd.exec.html +NoNewPrivileges=yes +PrivateTmp=yes +PrivateDevices=yes +RestrictAddressFamilies=AF_UNIX AF_INET AF_INET6 +RestrictNamespaces=yes +RestrictRealtime=yes +DevicePolicy=closed +ProtectSystem=full +ProtectControlGroups=yes +ProtectKernelModules=yes +ProtectKernelTunables=yes +LockPersonality=yes +SystemCallFilter=~@clock @debug @module @mount @obsolete @reboot @setuid @swap + +# Denying access to capabilities that should not be relevant for webapps +# Doc: https://man7.org/linux/man-pages/man7/capabilities.7.html +CapabilityBoundingSet=~CAP_RAWIO CAP_MKNOD +CapabilityBoundingSet=~CAP_AUDIT_CONTROL CAP_AUDIT_READ CAP_AUDIT_WRITE +CapabilityBoundingSet=~CAP_SYS_BOOT CAP_SYS_TIME CAP_SYS_MODULE CAP_SYS_PACCT +CapabilityBoundingSet=~CAP_LEASE CAP_LINUX_IMMUTABLE CAP_IPC_LOCK +CapabilityBoundingSet=~CAP_BLOCK_SUSPEND CAP_WAKE_ALARM +CapabilityBoundingSet=~CAP_SYS_TTY_CONFIG +CapabilityBoundingSet=~CAP_MAC_ADMIN CAP_MAC_OVERRIDE +CapabilityBoundingSet=~CAP_NET_ADMIN CAP_NET_BROADCAST CAP_NET_RAW +CapabilityBoundingSet=~CAP_SYS_ADMIN CAP_SYS_PTRACE CAP_SYSLOG + [Install] WantedBy=multi-user.target diff --git a/doc/DESCRIPTION.md b/doc/DESCRIPTION.md new file mode 100644 index 0000000..f03d178 --- /dev/null +++ b/doc/DESCRIPTION.md @@ -0,0 +1 @@ +SOGo is an opensource groupware solution which has Webmail, a global address book and Calender and Contacts which can be synced via caldav or cardav. diff --git a/doc/DISCLAIMER.md b/doc/DISCLAIMER.md new file mode 100644 index 0000000..e69de29 diff --git a/manifest.json b/manifest.json index 1c49bbb..55c1aee 100644 --- a/manifest.json +++ b/manifest.json @@ -4,7 +4,7 @@ "packaging_format": 1, "description": { "en": "Opensource groupware for E-Mail, Contacts and Calender", - "fr": "Groupware opensource pour les e-mail, contacts et calendrier" + "fr": "Groupware opensource pour les e-mail, contacts et calendrier" }, "version": "5.0.1~ynh1", "url": "https://sogo.nu/", diff --git a/scripts/upgrade b/scripts/upgrade index 41270b3..868b683 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -73,6 +73,16 @@ if ynh_legacy_permissions_exists; then ynh_app_setting_delete --app=$app --key=is_public fi +# Manage migrations +ynh_script_progression --message="Migrating database if needed..." + +if ynh_compare_current_package_version --comparison le --version 4.0.0~ynh0; then + ynh_replace_string --match_string __APP__ --replace_string $app --target_file migrations/3.2-4.0.sh + ynh_replace_string --match_string __DBUSER__ --replace_string $db_user --target_file migrations/3.2-4.0.sh + ynh_replace_string --match_string __DBPASS__ --replace_string $db_pwd --target_file migrations/3.2-4.0.sh + bash migrations/3.2-4.0.sh +fi + if ! ynh_permission_exists --permission="sync_client"; then # Create the required permissions ynh_permission_create --permission="sync_client" --allowed='visitors' --auth_header=false\ From 5b5309058f6268d96b8319e467a58eb62f590fcb Mon Sep 17 00:00:00 2001 From: yunohost-bot Date: Sat, 28 May 2022 13:00:47 +0000 Subject: [PATCH 31/33] Auto-update README --- README.md | 21 +++++++++++---------- README_fr.md | 27 ++++++++++++++++----------- 2 files changed, 27 insertions(+), 21 deletions(-) diff --git a/README.md b/README.md index de68322..ee2dc3e 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ It shall NOT be edited by hand. # SOGo for YunoHost -[![Integration level](https://dash.yunohost.org/integration/sogo.svg)](https://dash.yunohost.org/appci/app/sogo) ![](https://ci-apps.yunohost.org/ci/badges/sogo.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/sogo.maintain.svg) +[![Integration level](https://dash.yunohost.org/integration/sogo.svg)](https://dash.yunohost.org/appci/app/sogo) ![Working status](https://ci-apps.yunohost.org/ci/badges/sogo.status.svg) ![Maintenance status](https://ci-apps.yunohost.org/ci/badges/sogo.maintain.svg) [![Install SOGo with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=sogo) *[Lire ce readme en français.](./README_fr.md)* @@ -15,29 +15,30 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in ## Overview -Opensource groupware for E-Mail, Contacts and Calender +SOGo is an opensource groupware solution which has Webmail, a global address book and Calender and Contacts which can be synced via caldav or cardav. + **Shipped version:** 5.0.1~ynh1 **Demo:** https://demo.sogo.nu/SOGo/ - ## Documentation and resources -* Official app website: https://sogo.nu/ -* Official admin documentation: https://www.sogo.nu/support.html#/documentation -* Upstream app code repository: https://github.com/inverse-inc/sogo -* YunoHost documentation for this app: https://yunohost.org/app_sogo -* Report a bug: https://github.com/YunoHost-Apps/sogo_ynh/issues +* Official app website: +* Official admin documentation: +* Upstream app code repository: +* YunoHost documentation for this app: +* Report a bug: ## Developer info Please send your pull request to the [testing branch](https://github.com/YunoHost-Apps/sogo_ynh/tree/testing). To try the testing branch, please proceed like that. -``` + +``` bash sudo yunohost app install https://github.com/YunoHost-Apps/sogo_ynh/tree/testing --debug or sudo yunohost app upgrade sogo -u https://github.com/YunoHost-Apps/sogo_ynh/tree/testing --debug ``` -**More info regarding app packaging:** https://yunohost.org/packaging_apps \ No newline at end of file +**More info regarding app packaging:** diff --git a/README_fr.md b/README_fr.md index 2dc9c0b..7bcc802 100644 --- a/README_fr.md +++ b/README_fr.md @@ -1,39 +1,44 @@ + + # SOGo pour YunoHost -[![Niveau d'intégration](https://dash.yunohost.org/integration/sogo.svg)](https://dash.yunohost.org/appci/app/sogo) ![](https://ci-apps.yunohost.org/ci/badges/sogo.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/sogo.maintain.svg) +[![Niveau d'intégration](https://dash.yunohost.org/integration/sogo.svg)](https://dash.yunohost.org/appci/app/sogo) ![Statut du fonctionnement](https://ci-apps.yunohost.org/ci/badges/sogo.status.svg) ![Statut de maintenance](https://ci-apps.yunohost.org/ci/badges/sogo.maintain.svg) [![Installer SOGo avec YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=sogo) *[Read this readme in english.](./README.md)* -*[Lire ce readme en français.](./README_fr.md)* > *Ce package vous permet d'installer SOGo rapidement et simplement sur un serveur YunoHost. Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour savoir comment l'installer et en profiter.* ## Vue d'ensemble -Groupware opensource pour les e-mail, contacts et calendrier +SOGo is an opensource groupware solution which has Webmail, a global address book and Calender and Contacts which can be synced via caldav or cardav. + **Version incluse :** 5.0.1~ynh1 **Démo :** https://demo.sogo.nu/SOGo/ - ## Documentations et ressources -* Site officiel de l'app : https://sogo.nu/ -* Documentation officielle de l'admin : https://www.sogo.nu/support.html#/documentation -* Dépôt de code officiel de l'app : https://github.com/inverse-inc/sogo -* Documentation YunoHost pour cette app : https://yunohost.org/app_sogo -* Signaler un bug : https://github.com/YunoHost-Apps/sogo_ynh/issues +* Site officiel de l'app : +* Documentation officielle de l'admin : +* Dépôt de code officiel de l'app : +* Documentation YunoHost pour cette app : +* Signaler un bug : ## Informations pour les développeurs Merci de faire vos pull request sur la [branche testing](https://github.com/YunoHost-Apps/sogo_ynh/tree/testing). Pour essayer la branche testing, procédez comme suit. -``` + +``` bash sudo yunohost app install https://github.com/YunoHost-Apps/sogo_ynh/tree/testing --debug ou sudo yunohost app upgrade sogo -u https://github.com/YunoHost-Apps/sogo_ynh/tree/testing --debug ``` -**Plus d'infos sur le packaging d'applications :** https://yunohost.org/packaging_apps \ No newline at end of file +**Plus d'infos sur le packaging d'applications :** From f87ac27c3b646cc33138374b85bfdb40b16f330f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Josu=C3=A9=20Tille?= Date: Sun, 29 May 2022 00:17:59 +0200 Subject: [PATCH 32/33] fix backup --- scripts/backup | 6 ------ scripts/restore | 2 -- 2 files changed, 8 deletions(-) diff --git a/scripts/backup b/scripts/backup index 4fcace1..01bf979 100755 --- a/scripts/backup +++ b/scripts/backup @@ -48,12 +48,6 @@ ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf" ynh_backup --src_path="/etc/logrotate.d/$app" -#================================================= -# BACKUP SYSTEMD -#================================================= - -ynh_backup --src_path="/etc/systemd/system/$app.service" - #================================================= # BACKUP SOGo CONFIGURATION #================================================= diff --git a/scripts/restore b/scripts/restore index 693ea55..ef99a29 100755 --- a/scripts/restore +++ b/scripts/restore @@ -88,8 +88,6 @@ chmod u=rwX,g=rX,o= -R /var/log/$app # RESTORE SYSTEMD #================================================= ynh_script_progression --message="Restoring the systemd configuration..." --weight=1 - -ynh_restore_file --origin_path="/etc/systemd/system/$app.service" systemctl enable $app.service --quiet #================================================= From e813a55f2025c52bc54a850d8c22725b23f25d65 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Josu=C3=A9=20Tille?= Date: Sat, 18 Jun 2022 12:05:22 +0200 Subject: [PATCH 33/33] Fix backup/restore --- scripts/backup | 6 ------ scripts/restore | 3 +-- scripts/upgrade | 4 ++-- 3 files changed, 3 insertions(+), 10 deletions(-) diff --git a/scripts/backup b/scripts/backup index 01bf979..4568644 100755 --- a/scripts/backup +++ b/scripts/backup @@ -42,12 +42,6 @@ ynh_print_info --message="Declaring files to be backed up..." ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf" -#================================================= -# BACKUP LOGROTATE -#================================================= - -ynh_backup --src_path="/etc/logrotate.d/$app" - #================================================= # BACKUP SOGo CONFIGURATION #================================================= diff --git a/scripts/restore b/scripts/restore index ef99a29..1d435f6 100755 --- a/scripts/restore +++ b/scripts/restore @@ -94,8 +94,7 @@ systemctl enable $app.service --quiet # RESTORE THE LOGROTATE CONFIGURATION #================================================= ynh_script_progression --message="Restoring the logrotate configuration..." --weight=1 - -ynh_restore_file --origin_path="/etc/logrotate.d/$app" --nonappend +ynh_use_logrotate --logfile="/var/log/$app/sogo.log" --nonappend #================================================= # INTEGRATE SERVICE IN YUNOHOST diff --git a/scripts/upgrade b/scripts/upgrade index 868b683..14480f7 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -152,7 +152,7 @@ if ! ynh_permission_exists --permission sync_client; then || ynh_print_warn --message="Your file /etc/ssowat/""conf.json.persistent doesn't respect the json syntax. The config file wasn't cleaned. Please clean it manually." else ynh_permission_update --permission="sync_client" --add='visitors' --label="Sync client" --protected=true --show_tile=false - ynh_permission_url --permission "sync_client" --auth_header=false\ + ynh_permission_url --permission "sync_client" --auth_header=false\ --add_url="/Microsoft-Server-ActiveSync" "/principals" "/.well-known/caldav" "/.well-known/carddav" fi @@ -164,7 +164,7 @@ fi ynh_script_progression --message="Upgrading logrotate configuration..." --weight=1 # Use logrotate to manage app-specific logfile(s) -ynh_use_logrotate --non-append +ynh_use_logrotate --logfile="/var/log/$app/sogo.log" --nonappend #================================================= # INTEGRATE SERVICE IN YUNOHOST