From d84e7ba927c98aff9f90bd400886f5ee707289b2 Mon Sep 17 00:00:00 2001 From: polytan02 Date: Tue, 7 Feb 2017 22:15:18 +0000 Subject: [PATCH 01/30] Initial commit for latest z-push sources --- sources/source_sha1 | 1 - 1 file changed, 1 deletion(-) delete mode 100644 sources/source_sha1 diff --git a/sources/source_sha1 b/sources/source_sha1 deleted file mode 100644 index 16c9841..0000000 --- a/sources/source_sha1 +++ /dev/null @@ -1 +0,0 @@ -682f127b7e5dc77da95eef6956579215d376b0e5 From 42a71a5beda7b943f7df1f63b5e542702641e85a Mon Sep 17 00:00:00 2001 From: polytan02 Date: Tue, 7 Feb 2017 22:17:13 +0000 Subject: [PATCH 02/30] Add sources from z-push.org --- sources/source_file | 1 + sources/source_md5 | 2 +- sources/source_url | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) create mode 100644 sources/source_file diff --git a/sources/source_file b/sources/source_file new file mode 100644 index 0000000..1c51b17 --- /dev/null +++ b/sources/source_file @@ -0,0 +1 @@ +z-push-2.3.4.tar.gz diff --git a/sources/source_md5 b/sources/source_md5 index b3fe9c5..26968c4 100644 --- a/sources/source_md5 +++ b/sources/source_md5 @@ -1 +1 @@ -66eafc26c5e0a23a28ee43871d2be7e1 Z-Push-contrib-SHA1TOCHANGE.zip +35416c418c6e029b98eea7581e297648 z-push-2.3.4.tar.gz diff --git a/sources/source_url b/sources/source_url index 753f1bd..8e81a4e 100644 --- a/sources/source_url +++ b/sources/source_url @@ -1 +1 @@ -https://github.com/fmbiete/Z-Push-contrib/archive/SHA1TOCHANGE.zip +http://download.z-push.org/final/2.3/z-push-2.3.4.tar.gz From f524825a9683df4cccba09fac2ee489a57e65134 Mon Sep 17 00:00:00 2001 From: polytan02 Date: Tue, 7 Feb 2017 22:20:48 +0000 Subject: [PATCH 03/30] Update to use file from z-push.org --- scripts/install | 10 ++++------ scripts/upgrade | 10 ++++------ 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/scripts/install b/scripts/install index a18ad92..cf1a1aa 100755 --- a/scripts/install +++ b/scripts/install @@ -98,13 +98,11 @@ ynh_app_setting_set "$app" final_phpconf "$final_phpconf" sudo mkdir -p $final_path # We download the sources and check the md5sum -SHA1=`sudo cat ../sources/source_sha1`; -sed -i "s@SHA1TOCHANGE@$SHA1@g" ../sources/source_url -sed -i "s@SHA1TOCHANGE@$SHA1@g" ../sources/source_md5 -sudo wget -nv -i ../sources/source_url -O Z-Push-contrib-${SHA1}.zip +SFILE=`sudo cat ../sources/source_file`; +sudo wget -nv -i ../sources/source_url -O $SFILE sudo md5sum -c ../sources/source_md5 --status || (echo "Corrupt source" >&2 && false) -sudo unzip Z-Push-contrib-${SHA1}.zip -d ../sources/ -sudo cp -R ../sources/Z-Push-contrib-${SHA1}/* $final_path +sudo tar xvf $SFILE -d ../sources/ +sudo cp -R ../sources/$SFILE/* $final_path # Configuration sed -i "s^define('TIMEZONE', .*^define('TIMEZONE', '$(cat /etc/timezone)');^" ../conf/config.php diff --git a/scripts/upgrade b/scripts/upgrade index 0745fcc..07ff700 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -59,13 +59,11 @@ sudo rm -f $final_phpconf sudo mkdir -p $final_path # We download the sources and check the md5sum -SHA1=`sudo cat ../sources/source_sha1`; -sed -i "s@SHA1TOCHANGE@$SHA1@g" ../sources/source_url -sed -i "s@SHA1TOCHANGE@$SHA1@g" ../sources/source_md5 -sudo wget -nv -i ../sources/source_url -O Z-Push-contrib-${SHA1}.zip +SFILE=`sudo cat ../sources/source_file`; +sudo wget -nv -i ../sources/source_url -O $SFILE sudo md5sum -c ../sources/source_md5 --status || (echo "Corrupt source" >&2 && false) -sudo unzip Z-Push-contrib-${SHA1}.zip -d ../sources/ -sudo cp -R ../sources/Z-Push-contrib-${SHA1}/* $final_path +sudo tar xvf $SFILE -d ../sources/ +sudo cp -R ../sources/$SFILE/* $final_path # Configuration sed -i "s^define('TIMEZONE', .*^define('TIMEZONE', '$(cat /etc/timezone)');^" ../conf/config.php From 0ef15a55829d55d88f604b1999b843da799df942 Mon Sep 17 00:00:00 2001 From: polytan02 Date: Tue, 7 Feb 2017 22:22:22 +0000 Subject: [PATCH 04/30] Update of Readme.md to reflect origins of sources --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 2c9df58..3377305 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ * Z-push for Yunohost support IMAP sync and Carddav/Caldav sync if Baikal is installed * Ability to send calendar invitations -* The sources are based on https://github.com/fmbiete/Z-Push-contrib +* The sources are based on http://download.z-push.org/final/ * tbd :
update sources From cfb9d6fd17075d32796db573de6bac4a03efcbf0 Mon Sep 17 00:00:00 2001 From: polytan02 Date: Thu, 9 Feb 2017 18:11:17 +0000 Subject: [PATCH 05/30] Initial copy of updated config files --- conf/backend/config-caldav.php | 35 ++--- conf/backend/config-carddav.php | 33 +---- conf/backend/config-combined.php | 62 ++++---- conf/backend/config-imap.php | 64 +++----- conf/config.php | 242 +++++++++++++++---------------- 5 files changed, 188 insertions(+), 248 deletions(-) diff --git a/conf/backend/config-caldav.php b/conf/backend/config-caldav.php index 061f079..7abc60c 100644 --- a/conf/backend/config-caldav.php +++ b/conf/backend/config-caldav.php @@ -6,29 +6,13 @@ * * Created : 27.11.2012 * -* Copyright 2007 - 2013 Zarafa Deutschland GmbH +* Copyright 2012 - 2014 Jean-Louis Dupond +* +* Jean-Louis Dupond released this code as AGPLv3 here: https://github.com/dupondje/PHP-Push-2/issues/93 * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License, version 3, -* as published by the Free Software Foundation with the following additional -* term according to sec. 7: -* -* According to sec. 7 of the GNU Affero General Public License, version 3, -* the terms of the AGPL are supplemented with the following terms: -* -* "Zarafa" is a registered trademark of Zarafa B.V. -* "Z-Push" is a registered trademark of Zarafa Deutschland GmbH -* The licensing of the Program under the AGPL does not imply a trademark license. -* Therefore any rights, title and interest in our trademarks remain entirely with us. -* -* However, if you propagate an unmodified version of the Program you are -* allowed to use the term "Z-Push" to indicate that you distribute the Program. -* Furthermore you may use our trademarks where it is necessary to indicate -* the intended purpose of a product or service provided you use it in accordance -* with honest practices in industrial or commercial matters. -* If you want to propagate modified versions of the Program under the name "Z-Push", -* you may only do so if you have a written permission by Zarafa Deutschland GmbH -* (to acquire a permission please contact Zarafa at trademark@zarafa.com). +* as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -49,19 +33,24 @@ define('CALDAV_PROTOCOL', 'https'); // Server name -define('CALDAV_SERVER', 'BAIKALDOMAIN'); +define('CALDAV_SERVER', 'caldavserver.domain.com'); // Server port define('CALDAV_PORT', '443'); // Path -define('CALDAV_PATH', 'BAIKALPATH/cal.php/calendars/%u/'); +define('CALDAV_PATH', '/caldav.php/%u/'); // Default CalDAV folder (calendar folder/principal). This will be marked as the default calendar in the mobile -define('CALDAV_PERSONAL', 'default'); +define('CALDAV_PERSONAL', 'PRINCIPAL'); // If the CalDAV server supports the sync-collection operation // DAViCal, SOGo and SabreDav support it // SabreDav version must be at least 1.9.0, otherwise set this to false // Setting this to false will work with most servers, but it will be slower define('CALDAV_SUPPORTS_SYNC', false); + + +// Maximum period to sync. +// Some servers don't support more than 10 years so you will need to change this +define('CALDAV_MAX_SYNC_PERIOD', 2147483647); \ No newline at end of file diff --git a/conf/backend/config-carddav.php b/conf/backend/config-carddav.php index a2809d2..ec6ed17 100644 --- a/conf/backend/config-carddav.php +++ b/conf/backend/config-carddav.php @@ -6,29 +6,11 @@ * * Created : 16.03.2013 * -* Copyright 2007 - 2013 Zarafa Deutschland GmbH +* Copyright 2013 - 2016 Francisco Miguel Biete * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License, version 3, -* as published by the Free Software Foundation with the following additional -* term according to sec. 7: -* -* According to sec. 7 of the GNU Affero General Public License, version 3, -* the terms of the AGPL are supplemented with the following terms: -* -* "Zarafa" is a registered trademark of Zarafa B.V. -* "Z-Push" is a registered trademark of Zarafa Deutschland GmbH -* The licensing of the Program under the AGPL does not imply a trademark license. -* Therefore any rights, title and interest in our trademarks remain entirely with us. -* -* However, if you propagate an unmodified version of the Program you are -* allowed to use the term "Z-Push" to indicate that you distribute the Program. -* Furthermore you may use our trademarks where it is necessary to indicate -* the intended purpose of a product or service provided you use it in accordance -* with honest practices in industrial or commercial matters. -* If you want to propagate modified versions of the Program under the name "Z-Push", -* you may only do so if you have a written permission by Zarafa Deutschland GmbH -* (to acquire a permission please contact Zarafa at trademark@zarafa.com). +* as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -49,7 +31,7 @@ define('CARDDAV_PROTOCOL', 'https'); // Server name -define('CARDDAV_SERVER', 'BAIKALDOMAIN'); +define('CARDDAV_SERVER', 'localhost'); // Server port define('CARDDAV_PORT', '443'); @@ -63,21 +45,22 @@ define('CARDDAV_PORT', '443'); // %u: replaced with the username // %d: replaced with the domain // Add the trailing / -define('CARDDAV_PATH', 'BAIKALPATH/card.php/addressbooks/%u/'); +define('CARDDAV_PATH', '/caldav.php/%u/'); + // Server path to the default addressbook // Mobile device will create new contacts here. It must be under CARDDAV_PATH // %u: replaced with the username // %d: replaced with the domain // Add the trailing / -define('CARDDAV_DEFAULT_PATH', 'BAIKALPATH/card.php/addressbooks/%u/default'); +define('CARDDAV_DEFAULT_PATH', '/caldav.php/%u/addresses/'); // Server path to the GAL addressbook. This addressbook is readonly and searchable by the user, but it will NOT be synced. // If you don't want GAL, comment it // %u: replaced with the username // %d: replaced with the domain // Add the trailing / -define('CARDDAV_GAL_PATH', ''); +define('CARDDAV_GAL_PATH', '/caldav.php/%d/GAL/'); // Minimal length for the search pattern to do the real search. define('CARDDAV_GAL_MIN_LENGTH', 5); @@ -105,4 +88,4 @@ define('CARDDAV_SUPPORTS_FN_SEARCH', false); // If your carddav server needs to use file extension to recover a vcard. // Davical needs it // SOGo official demo online needs it, but some SOGo installation don't need it, so test it -define('CARDDAV_URL_VCARD_EXTENSION', '.vcf'); +define('CARDDAV_URL_VCARD_EXTENSION', '.vcf'); \ No newline at end of file diff --git a/conf/backend/config-combined.php b/conf/backend/config-combined.php index d48487e..aa9f002 100644 --- a/conf/backend/config-combined.php +++ b/conf/backend/config-combined.php @@ -7,29 +7,11 @@ * * Created : 29.11.2010 * -* Copyright 2007 - 2013 Zarafa Deutschland GmbH +* Copyright 2007 - 2016 Zarafa Deutschland GmbH * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License, version 3, -* as published by the Free Software Foundation with the following additional -* term according to sec. 7: -* -* According to sec. 7 of the GNU Affero General Public License, version 3, -* the terms of the AGPL are supplemented with the following terms: -* -* "Zarafa" is a registered trademark of Zarafa B.V. -* "Z-Push" is a registered trademark of Zarafa Deutschland GmbH -* The licensing of the Program under the AGPL does not imply a trademark license. -* Therefore any rights, title and interest in our trademarks remain entirely with us. -* -* However, if you propagate an unmodified version of the Program you are -* allowed to use the term "Z-Push" to indicate that you distribute the Program. -* Furthermore you may use our trademarks where it is necessary to indicate -* the intended purpose of a product or service provided you use it in accordance -* with honest practices in industrial or commercial matters. -* If you want to propagate modified versions of the Program under the name "Z-Push", -* you may only do so if you have a written permission by Zarafa Deutschland GmbH -* (to acquire a permission please contact Zarafa at trademark@zarafa.com). +* as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -65,12 +47,24 @@ class BackendCombinedConfig { 'i' => array( 'name' => 'BackendIMAP', ), - 'c' => array( - 'name' => 'BackendCalDAV', + 'z' => array( + 'name' => 'BackendKopano', + ), + 'm' => array( + 'name' => 'BackendMaildir', + ), + 'v' => array( + 'name' => 'BackendVCardDir', + ), + 'l' => array( + 'name' => 'BackendLDAP', ), 'd' => array( 'name' => 'BackendCardDAV', ), + 'c' => array( + 'name' => 'BackendCalDAV', + ), ), 'delimiter' => '/', //force one type of folder to one backend @@ -81,24 +75,22 @@ class BackendCombinedConfig { SYNC_FOLDER_TYPE_WASTEBASKET => 'i', SYNC_FOLDER_TYPE_SENTMAIL => 'i', SYNC_FOLDER_TYPE_OUTBOX => 'i', - SYNC_FOLDER_TYPE_TASK => 'c', - SYNC_FOLDER_TYPE_APPOINTMENT => 'c', - SYNC_FOLDER_TYPE_CONTACT => 'd', - SYNC_FOLDER_TYPE_NOTE => 'c', - SYNC_FOLDER_TYPE_JOURNAL => 'c', + SYNC_FOLDER_TYPE_TASK => 'z', + SYNC_FOLDER_TYPE_APPOINTMENT => 'z', + SYNC_FOLDER_TYPE_CONTACT => 'z', + SYNC_FOLDER_TYPE_NOTE => 'z', + SYNC_FOLDER_TYPE_JOURNAL => 'z', SYNC_FOLDER_TYPE_OTHER => 'i', SYNC_FOLDER_TYPE_USER_MAIL => 'i', - SYNC_FOLDER_TYPE_USER_APPOINTMENT => 'c', - SYNC_FOLDER_TYPE_USER_CONTACT => 'd', - SYNC_FOLDER_TYPE_USER_TASK => 'c', - SYNC_FOLDER_TYPE_USER_JOURNAL => 'c', - SYNC_FOLDER_TYPE_USER_NOTE => 'c', - SYNC_FOLDER_TYPE_UNKNOWN => 'i', + SYNC_FOLDER_TYPE_USER_APPOINTMENT => 'z', + SYNC_FOLDER_TYPE_USER_CONTACT => 'z', + SYNC_FOLDER_TYPE_USER_TASK => 'z', + SYNC_FOLDER_TYPE_USER_JOURNAL => 'z', + SYNC_FOLDER_TYPE_USER_NOTE => 'z', + SYNC_FOLDER_TYPE_UNKNOWN => 'z', ), //creating a new folder in the root folder should create a folder in one backend 'rootcreatefolderbackend' => 'i', - //enable to use username mapping for the different backends - 'usemapping' => false, ); } } diff --git a/conf/backend/config-imap.php b/conf/backend/config-imap.php index 171f6e8..378c76e 100644 --- a/conf/backend/config-imap.php +++ b/conf/backend/config-imap.php @@ -6,29 +6,11 @@ * * Created : 27.11.2012 * -* Copyright 2007 - 2013 Zarafa Deutschland GmbH +* Copyright 2007 - 2016 Zarafa Deutschland GmbH * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License, version 3, -* as published by the Free Software Foundation with the following additional -* term according to sec. 7: -* -* According to sec. 7 of the GNU Affero General Public License, version 3, -* the terms of the AGPL are supplemented with the following terms: -* -* "Zarafa" is a registered trademark of Zarafa B.V. -* "Z-Push" is a registered trademark of Zarafa Deutschland GmbH -* The licensing of the Program under the AGPL does not imply a trademark license. -* Therefore any rights, title and interest in our trademarks remain entirely with us. -* -* However, if you propagate an unmodified version of the Program you are -* allowed to use the term "Z-Push" to indicate that you distribute the Program. -* Furthermore you may use our trademarks where it is necessary to indicate -* the intended purpose of a product or service provided you use it in accordance -* with honest practices in industrial or commercial matters. -* If you want to propagate modified versions of the Program under the name "Z-Push", -* you may only do so if you have a written permission by Zarafa Deutschland GmbH -* (to acquire a permission please contact Zarafa at trademark@zarafa.com). +* as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -49,12 +31,11 @@ define('IMAP_SERVER', 'localhost'); // connecting to default port (143) -define('IMAP_PORT', 993); +define('IMAP_PORT', 143); // best cross-platform compatibility (see http://php.net/imap_open for options) -// Original : -//define('IMAP_OPTIONS', '/notls/norsh'); -define('IMAP_OPTIONS', '/ssl/novalidate-cert'); +define('IMAP_OPTIONS', '/notls/norsh'); + // Mark messages as read when moving to Trash. // BE AWARE that you will lose the unread flag, but some mail clients do this so the Trash folder doesn't get boldened @@ -87,16 +68,17 @@ define('IMAP_AUTOSEEN_ON_DELETE', false); // gmail is a special case, where the default folders are under the [gmail] prefix and the folders defined by the user are under INBOX. // This configuration seems to work: // define('IMAP_FOLDER_PREFIX', ''); + // define('IMAP_FOLDER_PREFIX_IN_INBOX', false); // define('IMAP_FOLDER_INBOX', 'INBOX'); // define('IMAP_FOLDER_SENT', '[Gmail]/Sent'); - // define('IMAP_FOLDER_DRAFTS', '[Gmail]/Drafts'); + // define('IMAP_FOLDER_DRAFT', '[Gmail]/Drafts'); // define('IMAP_FOLDER_TRASH', '[Gmail]/Trash'); // define('IMAP_FOLDER_SPAM', '[Gmail]/Spam'); // define('IMAP_FOLDER_ARCHIVE', '[Gmail]/All Mail'); // Since I know you won't configure this, I will raise an error unless you do. // When configured set this to true to remove the error -define('IMAP_FOLDER_CONFIGURED', true); +define('IMAP_FOLDER_CONFIGURED', false); // Folder prefix is the common part in your names (3, 4) define('IMAP_FOLDER_PREFIX', ''); @@ -105,22 +87,22 @@ define('IMAP_FOLDER_PREFIX', ''); define('IMAP_FOLDER_PREFIX_IN_INBOX', false); // Inbox folder name (case doesn't matter) - (empty in 4) -define('IMAP_FOLDER_INBOX', 'Inbox'); +define('IMAP_FOLDER_INBOX', 'INBOX'); // Sent folder name (case doesn't matter) -define('IMAP_FOLDER_SENT', 'Sent'); +define('IMAP_FOLDER_SENT', 'SENT'); // Draft folder name (case doesn't matter) -define('IMAP_FOLDER_DRAFT', 'Drafts'); +define('IMAP_FOLDER_DRAFT', 'DRAFTS'); // Trash folder name (case doesn't matter) -define('IMAP_FOLDER_TRASH', 'Trash'); +define('IMAP_FOLDER_TRASH', 'TRASH'); // Spam folder name (case doesn't matter). Only showed as special by iOS devices -define('IMAP_FOLDER_SPAM', 'Junk'); +define('IMAP_FOLDER_SPAM', 'SPAM'); // Archive folder name (case doesn't matter). Only showed as special by iOS devices -define('IMAP_FOLDER_ARCHIVE', 'Archive'); +define('IMAP_FOLDER_ARCHIVE', 'ARCHIVE'); @@ -141,7 +123,7 @@ define('IMAP_EXCLUDED_FOLDERS', ''); // 'sql' - the username will be the result of a sql query. REMEMBER TO INSTALL PHP-PDO AND PHP-DATABASE // 'ldap' - the username will be the result of a ldap query. REMEMBER TO INSTALL PHP-LDAP!! // '@mydomain.com' - the username is used and the given string will be appended -define('IMAP_DEFAULTFROM', '@DOMAINTOCHANGE'); +define('IMAP_DEFAULTFROM', ''); // DSN: formatted PDO connection string // mysql:host=xxx;port=xxx;dbname=xxx @@ -169,16 +151,10 @@ define('IMAP_FROM_SQL_FULLNAME', '#first_name #last_name'); // FROM: string that will be the from, replacing the field names with the values define('IMAP_FROM_LDAP_SERVER', 'localhost'); define('IMAP_FROM_LDAP_SERVER_PORT', '389'); -//define('IMAP_FROM_LDAP_USER', 'cn=zpush,ou=servers,dc=zpush,dc=org'); -//define('IMAP_FROM_LDAP_PASSWORD', 'password'); -//define('IMAP_FROM_LDAP_BASE', 'dc=zpush,dc=org'); -//define('IMAP_FROM_LDAP_QUERY', '(mail=#username@#domain)'); - -define('IMAP_FROM_LDAP_USER', ''); -define('IMAP_FROM_LDAP_PASSWORD', ''); -define('IMAP_FROM_LDAP_BASE', 'dc=yunohost,dc=org'); -define('IMAP_FROM_LDAP_QUERY', '(mail=#username)'); - +define('IMAP_FROM_LDAP_USER', 'cn=zpush,ou=servers,dc=zpush,dc=org'); +define('IMAP_FROM_LDAP_PASSWORD', 'password'); +define('IMAP_FROM_LDAP_BASE', 'dc=zpush,dc=org'); +define('IMAP_FROM_LDAP_QUERY', '(mail=#username@#domain)'); define('IMAP_FROM_LDAP_FIELDS', serialize(array('givenname', 'sn', 'mail'))); define('IMAP_FROM_LDAP_FROM', '#givenname #sn <#mail>'); define('IMAP_FROM_LDAP_FULLNAME', '#givenname #sn'); @@ -231,4 +207,4 @@ define('SYSTEM_MIME_TYPES_MAPPING', '/etc/mime.types'); // Use BackendCalDAV for Meetings. You cannot hope to get that functionality working without a caldav backend. -define('IMAP_MEETING_USE_CALDAV', FLAGTOCHANGE); +define('IMAP_MEETING_USE_CALDAV', false); \ No newline at end of file diff --git a/conf/config.php b/conf/config.php index 9862172..4b5ac5a 100644 --- a/conf/config.php +++ b/conf/config.php @@ -6,29 +6,11 @@ * * Created : 01.10.2007 * -* Copyright 2007 - 2013 Zarafa Deutschland GmbH +* Copyright 2007 - 2016 Zarafa Deutschland GmbH * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License, version 3, -* as published by the Free Software Foundation with the following additional -* term according to sec. 7: -* -* According to sec. 7 of the GNU Affero General Public License, version 3, -* the terms of the AGPL are supplemented with the following terms: -* -* "Zarafa" is a registered trademark of Zarafa B.V. -* "Z-Push" is a registered trademark of Zarafa Deutschland GmbH -* The licensing of the Program under the AGPL does not imply a trademark license. -* Therefore any rights, title and interest in our trademarks remain entirely with us. -* -* However, if you propagate an unmodified version of the Program you are -* allowed to use the term "Z-Push" to indicate that you distribute the Program. -* Furthermore you may use our trademarks where it is necessary to indicate -* the intended purpose of a product or service provided you use it in accordance -* with honest practices in industrial or commercial matters. -* If you want to propagate modified versions of the Program under the name "Z-Push", -* you may only do so if you have a written permission by Zarafa Deutschland GmbH -* (to acquire a permission please contact Zarafa at trademark@zarafa.com). +* as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -53,10 +35,6 @@ // Try to set unlimited timeout define('SCRIPT_TIMEOUT', 0); - // Your PHP could have a bug when base64 encoding: https://bugs.php.net/bug.php?id=68532 - // NOTE: Run "php testing/testing-bug68532fixed.php" to know what value put here - define('BUG68532FIXED', false); - // When accessing through a proxy, the "X-Forwarded-For" header contains the original remote IP define('USE_X_FORWARDED_FOR_HEADER', false); @@ -64,74 +42,45 @@ // This setting specifies the owner parameter in the certificate to look at. define("CERTIFICATE_OWNER_PARAMETER", "SSL_CLIENT_S_DN_CN"); - // Location of the trusted CA, e.g. '/etc/ssl/certs/EmailCA.pem' - // Uncomment and modify the following line if the validation of the certificates fails. - // define('CAINFO', '/etc/ssl/certs/EmailCA.pem'); - /* * Whether to use the complete email address as a login name * (e.g. user@company.com) or the username only (user). * This is required for Z-Push to work properly after autodiscover. * Possible values: - * false - use the username only (default). - * true - use the complete email address. + * false - use the username only. + * true - string the mobile sends as username, e.g. full email address (default). */ define('USE_FULLEMAIL_FOR_LOGIN', true); /********************************************************************************** - * Device pre-authorization. Useful when using Z-Push as a standalone product. + * StateMachine setting * - * It will use the STATE_MACHINE specified below, to store the users/devices - * FILE => STATE_DIR/PreAuthUserDevices - * SQL => auth_users - * - * FALSE => default - * TRUE - */ - define('PRE_AUTHORIZE_USERS', false); - - // New users are pre-authorized automatically - define('PRE_AUTHORIZE_NEW_USERS', false); - - // New devices are pre-authorized automatically for pre-authorized users - define('PRE_AUTHORIZE_NEW_DEVICES', false); - - // Max number of devices pre-authorized for user, you can pre-authorize more manually - define('PRE_AUTHORIZE_MAX_DEVICES', 5); - - -/********************************************************************************** - * Select StateMachine mechanism - * - * FILE => FileStateMachine, default - * SQL => SqlStateMachine + * These StateMachines can be used: + * FILE - FileStateMachine (default). Needs STATE_DIR set as well. + * SQL - SqlStateMachine has own configuration file. STATE_DIR is ignored. + * State migration script is available, more informations: https://wiki.z-hub.io/x/xIAa */ define('STATE_MACHINE', 'FILE'); + define('STATE_DIR', '/var/lib/z-push/'); /********************************************************************************** - * Default FileStateMachine settings - */ - define('STATE_DIR', 'ALIASTOCHANGE/'); - - -/********************************************************************************** - * Optional SqlStateMachine settings + * IPC - InterProcessCommunication * - * DSN: formatted PDO connection string - * mysql:host=xxx;port=xxx;dbname=xxx - * DON'T FORGET TO INSTALL THE PHP-DRIVER PACKAGE!!! - * USER: username to DB - * PASSWORD: password to DB - * OPTIONS: array with options needed + * Is either provided by using shared memory on a single host or + * using the memcache provider for multi-host environments. + * When another implementation should be used, the class can be set here explicitly. + * If empty Z-Push will try to use available providers. */ - define('STATE_SQL_DSN', ''); - define('STATE_SQL_USER', ''); - define('STATE_SQL_PASSWORD', ''); - define('STATE_SQL_OPTIONS', serialize(array(PDO::ATTR_PERSISTENT => true))); - + define('IPC_PROVIDER', ''); /********************************************************************************** * Logging settings + * + * The LOGBACKEND specifies where the logs are sent to. + * Either to file ("filelog") or to a "syslog" server or a custom log class in core/log/logclass. + * filelog and syslog have several options that can be set below. + * For more information about the syslog configuration, see https://wiki.z-hub.io/x/HIAT + * Possible LOGLEVEL and LOGUSERLEVEL values are: * LOGLEVEL_OFF - no logging * LOGLEVEL_FATAL - log only critical errors @@ -146,14 +95,13 @@ * The verbosity increases from top to bottom. More verbose levels include less verbose * ones, e.g. setting to LOGLEVEL_DEBUG will also output LOGLEVEL_FATAL, LOGLEVEL_ERROR, * LOGLEVEL_WARN and LOGLEVEL_INFO level entries. + * + * LOGAUTHFAIL is logged to the LOGBACKEND. */ - define('LOGFILEDIR', 'LOGTOCHANGE/'); - define('LOGFILE', LOGFILEDIR . 'z-push.log'); - define('LOGERRORFILE', LOGFILEDIR . 'z-push-error.log'); + define('LOGBACKEND', 'filelog'); define('LOGLEVEL', LOGLEVEL_INFO); define('LOGAUTHFAIL', false); - // To save e.g. WBXML data only for selected users, add the usernames to the array // The data will be saved into a dedicated file per user in the LOGFILEDIR // Users have to be encapusulated in quotes, several users are comma separated, like: @@ -161,18 +109,24 @@ define('LOGUSERLEVEL', LOGLEVEL_DEVICEID); $specialLogUsers = array(); - // If you want to disable log to file, and log to syslog instead - define('LOG_SYSLOG_ENABLED', false); + // Filelog settings + define('LOGFILEDIR', '/var/log/z-push/'); + define('LOGFILE', LOGFILEDIR . 'z-push.log'); + define('LOGERRORFILE', LOGFILEDIR . 'z-push-error.log'); + + // Syslog settings // false will log to local syslog, otherwise put the remote syslog IP here define('LOG_SYSLOG_HOST', false); // Syslog port define('LOG_SYSLOG_PORT', 514); // Program showed in the syslog. Useful if you have more than one instance login to the same syslog - define('LOG_SYSLOG_PROGRAM', '[z-push]'); + define('LOG_SYSLOG_PROGRAM', 'z-push'); + // Syslog facility - use LOG_USER when running on Windows + define('LOG_SYSLOG_FACILITY', LOG_LOCAL0); - - define('LOG_MEMORY_PROFILER', false); - define('LOG_MEMORY_PROFILER_FILE', 'LOGTOCHANGE/memory_profile'); + // Location of the trusted CA, e.g. '/etc/ssl/certs/EmailCA.pem' + // Uncomment and modify the following line if the validation of the certificates fails. + // define('CAINFO', '/etc/ssl/certs/EmailCA.pem'); /********************************************************************************** * Mobile settings @@ -186,6 +140,10 @@ // true - allow older devices, but enforce policies on devices which support it define('LOOSE_PROVISIONING', false); + // The file containing the policies' settings. + // Set a full path or relative to the z-push main directory + define('PROVISIONING_POLICYFILE', 'policies.ini'); + // Default conflict preference // Some devices allow to set if the server or PIM (mobile) // should win in case of a synchronization conflict @@ -208,11 +166,6 @@ // a higher value if you have a high load on the server. define('PING_INTERVAL', 30); - // Interval in seconds to force a re-check of potentially missed notifications when - // using a changes sink. Default are 300 seconds (every 5 min). - // This can also be disabled by setting it to false - define('SINK_FORCERECHECK', 300); - // Set the fileas (save as) order for contacts in the webaccess/webapp/outlook. // It will only affect new/modified contacts on the mobile which then are synced to the server. // Possible values are: @@ -231,12 +184,14 @@ // SYNC_FILEAS_LASTFIRST will be used define('FILEAS_ORDER', SYNC_FILEAS_LASTFIRST); - // Amount of items to be synchronized per request + // Maximum amount of items to be synchronized per request. // Normally this value is requested by the mobile. Common values are 5, 25, 50 or 100. // Exporting too much items can cause mobile timeout on busy systems. - // Z-Push will use the lowest value, either set here or by the mobile. - // default: 100 - value used if mobile does not limit amount of items - define('SYNC_MAX_ITEMS', 100); + // Z-Push will use the lowest provided value, either set here or by the mobile. + // MS Outlook 2013+ request up to 512 items to accelerate the sync process. + // If you detect high load (also on subsystems) you could try a lower setting. + // max: 512 - value used if mobile does not limit amount of items + define('SYNC_MAX_ITEMS', 512); // The devices usually send a list of supported properties for calendar and contact // items. If a device does not includes such a supported property in Sync request, @@ -245,7 +200,7 @@ // to tell if a property was deleted or it was not set at all if it does not appear in Sync. // This parameter defines Z-Push behaviour during Sync if a device does not issue a list with // supported properties. - // See also https://jira.zarafa.com/browse/ZP-302. + // See also https://jira.z-hub.io/browse/ZP-302. // Possible values: // false - do not unset properties which are not sent during Sync (default) // true - unset properties which are not sent during Sync @@ -272,33 +227,46 @@ // NOTE: THIS IS AN EXPERIMENTAL FEATURE WHICH COULD PREVENT YOUR MOBILES FROM SYNCHRONIZING. define('USE_PARTIAL_FOLDERSYNC', false); + // The minimum accepted time in second that a ping command should last. + // It is strongly advised to keep this config to false. Some device + // might not be able to send a higher value than the one specificied here and thus + // unable to start a push connection. + // If set to false, there will be no lower bound to the ping lifetime. + // The minimum accepted value is 1 second. The maximum accepted value is 3540 seconds (59 minutes). + define('PING_LOWER_BOUND_LIFETIME', false); + + // The maximum accepted time in second that a ping command should last. + // If set to false, there will be no higher bound to the ping lifetime. + // The minimum accepted value is 1 second. The maximum accepted value is 3540 seconds (59 minutes). + define('PING_HIGHER_BOUND_LIFETIME', false); + + // Maximum response time + // Mobiles implement different timeouts to their TCP/IP connections. Android devices for example + // have a hard timeout of 30 seconds. If the server is not able to answer a request within this timeframe, + // the answer will not be recieved and the device will send a new one overloading the server. + // There are three categories + // - Short timeout - server has up within 30 seconds - is automatically applied for not categorized types + // - Medium timeout - server has up to 90 seconds to respond + // - Long timeout - server has up to 4 minutes to respond + // If a timeout is almost reached the server will break and sent the results it has until this + // point. You can add DeviceType strings to the categories. + // In general longer timeouts are better, because more data can be streamed at once. + define('SYNC_TIMEOUT_MEDIUM_DEVICETYPES', "SAMSUNGGTI"); + define('SYNC_TIMEOUT_LONG_DEVICETYPES', "iPod, iPad, iPhone, WP, WindowsOutlook"); + + // Time in seconds the device should wait whenever the service is unavailable, + // e.g. when a backend service is unavailable. + // Z-Push sends a "Retry-After" header in the response with the here defined value. + // It is up to the device to respect or not this directive so even if this option is set, + // the device might not wait requested time frame. + // Number of seconds before retry, to disable set to: false + define('RETRY_AFTER_DELAY', 300); + /********************************************************************************** * Backend settings */ // the backend data provider - define('BACKEND_PROVIDER', 'BACKENDTOCHANGE'); - - // top collector backend class name - // Default is: TopCollector - // Options: ["TopCollector", "TopCollectorRedis"] - define('TOP_COLLECTOR_BACKEND', 'TopCollector'); - - // ping tracking backend class name - // Default is: PingTracking - // Options: ["PingTracking", "PingTrackingRedis"] - define('PING_TRACKING_BACKEND', 'PingTracking'); - - // loop detection backend class name - // Default is: LoopDetection - // Options: ["LoopDetection", "LoopDetectionRedis"] - define('LOOP_DETECTION_BACKEND', 'LoopDetection'); - - // If using the Redis backends (for top, ping and lookp) make sure to set this values as necessary - define('IPC_REDIS_IP', '127.0.0.1'); - define('IPC_REDIS_PORT', 6379); - // Database name/index in Redis: 0 by default - // NOTE: this database must be exclusive for z-push, since its content will be ERASED. You are warned. - define('IPC_REDIS_DATABASE', 0); + define('BACKEND_PROVIDER', ''); /********************************************************************************** * Search provider settings @@ -316,6 +284,37 @@ // might result in timeout. Default is 10. define('SEARCH_MAXRESULTS', 10); +/********************************************************************************** + * Kopano Outlook Extension - Settings + * + * The Kopano Outlook Extension (KOE) provides MS Outlook 2013 and newer with + * functionality not provided by ActiveSync or not implemented by Outlook. + * For more information, see: https://wiki.z-hub.io/x/z4Aa + */ + // Global Address Book functionality + define('KOE_CAPABILITY_GAB', true); + // Synchronize mail flags from the server to Outlook/KOE + define('KOE_CAPABILITY_RECEIVEFLAGS', true); + // Encode flags when sending from Outlook/KOE + define('KOE_CAPABILITY_SENDFLAGS', true); + // Out-of-office support + define('KOE_CAPABILITY_OOF', true); + // Out-of-office support with start & end times (superseeds KOE_CAPABILITY_OOF) + define('KOE_CAPABILITY_OOFTIMES', true); + // Notes support + define('KOE_CAPABILITY_NOTES', true); + // Shared folder support + define('KOE_CAPABILITY_SHAREDFOLDER', true); + // Send-As support for Outlook/KOE and mobiles + define('KOE_CAPABILITY_SENDAS', true); + + // To synchronize the GAB KOE, the GAB store and folderid need to be specified. + // Use the gab-sync script to generate this data. The name needs to + // match the config of the gab-sync script. + // More information here: https://wiki.z-hub.io/x/z4Aa (GAB Sync Script) + define('KOE_GAB_STORE', 'SYSTEM'); + define('KOE_GAB_FOLDERID', ''); + define('KOE_GAB_NAME', 'Z-Push-KOE-GAB'); /********************************************************************************** * Synchronize additional folders to all mobiles @@ -325,11 +324,11 @@ * * This feature is supported only by certain devices, like iPhones. * Check the compatibility list for supported devices: - * http://z-push.sf.net/compatibility + * http://z-push.org/compatibility * * To synchronize a folder, add a section setting all parameters as below: * store: the ressource where the folder is located. - * Zarafa users use 'SYSTEM' for the 'Public Folder' + * Kopano users use 'SYSTEM' for the 'Public Folder' * folderid: folder id of the folder to be synchronized * name: name to be displayed on the mobile device * type: supported types are: @@ -337,13 +336,14 @@ * SYNC_FOLDER_TYPE_USER_APPOINTMENT * SYNC_FOLDER_TYPE_USER_TASK * SYNC_FOLDER_TYPE_USER_MAIL + * SYNC_FOLDER_TYPE_USER_NOTE * * Additional notes: - * - on Zarafa systems use backend/zarafa/listfolders.php script to get a list + * - on Kopano systems use backend/kopano/listfolders.php script to get a list * of available folders * - * - all Z-Push users must have full writing permissions (secretary rights) so - * the configured folders can be synchronized to the mobile + * - all Z-Push users must have at least reading permissions so the configured + * folders can be synchronized to the mobile. Else they are ignored. * * - this feature is only partly suitable for multi-tenancy environments, * as ALL users from ALL tenents need access to the configured store & folder. From a21d045c1c6f3172db125fffdffbcca0f6267c5d Mon Sep 17 00:00:00 2001 From: polytan02 Date: Thu, 9 Feb 2017 18:23:06 +0000 Subject: [PATCH 06/30] Update to suit setup of combined --- conf/backend/config-combined.php | 36 +++++++++++--------------------- 1 file changed, 12 insertions(+), 24 deletions(-) diff --git a/conf/backend/config-combined.php b/conf/backend/config-combined.php index aa9f002..0efb4c0 100644 --- a/conf/backend/config-combined.php +++ b/conf/backend/config-combined.php @@ -47,22 +47,10 @@ class BackendCombinedConfig { 'i' => array( 'name' => 'BackendIMAP', ), - 'z' => array( - 'name' => 'BackendKopano', - ), - 'm' => array( - 'name' => 'BackendMaildir', - ), - 'v' => array( - 'name' => 'BackendVCardDir', - ), - 'l' => array( - 'name' => 'BackendLDAP', - ), 'd' => array( 'name' => 'BackendCardDAV', ), - 'c' => array( + 'l' => array( 'name' => 'BackendCalDAV', ), ), @@ -75,19 +63,19 @@ class BackendCombinedConfig { SYNC_FOLDER_TYPE_WASTEBASKET => 'i', SYNC_FOLDER_TYPE_SENTMAIL => 'i', SYNC_FOLDER_TYPE_OUTBOX => 'i', - SYNC_FOLDER_TYPE_TASK => 'z', - SYNC_FOLDER_TYPE_APPOINTMENT => 'z', - SYNC_FOLDER_TYPE_CONTACT => 'z', - SYNC_FOLDER_TYPE_NOTE => 'z', - SYNC_FOLDER_TYPE_JOURNAL => 'z', + SYNC_FOLDER_TYPE_TASK => 'l', + SYNC_FOLDER_TYPE_APPOINTMENT => 'l', + SYNC_FOLDER_TYPE_CONTACT => 'd', + SYNC_FOLDER_TYPE_NOTE => 'l', + SYNC_FOLDER_TYPE_JOURNAL => 'l', SYNC_FOLDER_TYPE_OTHER => 'i', SYNC_FOLDER_TYPE_USER_MAIL => 'i', - SYNC_FOLDER_TYPE_USER_APPOINTMENT => 'z', - SYNC_FOLDER_TYPE_USER_CONTACT => 'z', - SYNC_FOLDER_TYPE_USER_TASK => 'z', - SYNC_FOLDER_TYPE_USER_JOURNAL => 'z', - SYNC_FOLDER_TYPE_USER_NOTE => 'z', - SYNC_FOLDER_TYPE_UNKNOWN => 'z', + SYNC_FOLDER_TYPE_USER_APPOINTMENT => 'l', + SYNC_FOLDER_TYPE_USER_CONTACT => 'd', + SYNC_FOLDER_TYPE_USER_TASK => 'l', + SYNC_FOLDER_TYPE_USER_JOURNAL => 'l', + SYNC_FOLDER_TYPE_USER_NOTE => 'l', + SYNC_FOLDER_TYPE_UNKNOWN => 'i', ), //creating a new folder in the root folder should create a folder in one backend 'rootcreatefolderbackend' => 'i', From 0d5d833e860389bc8eeccec8c3e68a0751cd481f Mon Sep 17 00:00:00 2001 From: polytan02 Date: Thu, 9 Feb 2017 18:26:40 +0000 Subject: [PATCH 07/30] Caldav config --- conf/backend/config-caldav.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/conf/backend/config-caldav.php b/conf/backend/config-caldav.php index 7abc60c..77e7a85 100644 --- a/conf/backend/config-caldav.php +++ b/conf/backend/config-caldav.php @@ -33,16 +33,16 @@ define('CALDAV_PROTOCOL', 'https'); // Server name -define('CALDAV_SERVER', 'caldavserver.domain.com'); +define('CALDAV_SERVER', 'BAIKALDOMAIN'); // Server port define('CALDAV_PORT', '443'); // Path -define('CALDAV_PATH', '/caldav.php/%u/'); +define('CALDAV_PATH', 'BAIKALDOMAIN'); // Default CalDAV folder (calendar folder/principal). This will be marked as the default calendar in the mobile -define('CALDAV_PERSONAL', 'PRINCIPAL'); +define('CALDAV_PERSONAL', 'default'); // If the CalDAV server supports the sync-collection operation // DAViCal, SOGo and SabreDav support it @@ -53,4 +53,4 @@ define('CALDAV_SUPPORTS_SYNC', false); // Maximum period to sync. // Some servers don't support more than 10 years so you will need to change this -define('CALDAV_MAX_SYNC_PERIOD', 2147483647); \ No newline at end of file +define('CALDAV_MAX_SYNC_PERIOD', 2147483647); From f9d00adaeb68aeee926c3c109724844450c3b88a Mon Sep 17 00:00:00 2001 From: polytan02 Date: Thu, 9 Feb 2017 18:28:59 +0000 Subject: [PATCH 08/30] Carddav config --- conf/backend/config-carddav.php | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/conf/backend/config-carddav.php b/conf/backend/config-carddav.php index ec6ed17..e4a0e4b 100644 --- a/conf/backend/config-carddav.php +++ b/conf/backend/config-carddav.php @@ -31,7 +31,7 @@ define('CARDDAV_PROTOCOL', 'https'); // Server name -define('CARDDAV_SERVER', 'localhost'); +define('CARDDAV_SERVER', 'BAIKALDOMAIN'); // Server port define('CARDDAV_PORT', '443'); @@ -45,7 +45,7 @@ define('CARDDAV_PORT', '443'); // %u: replaced with the username // %d: replaced with the domain // Add the trailing / -define('CARDDAV_PATH', '/caldav.php/%u/'); +define('CARDDAV_PATH', 'BAIKALPATH/card.php/addressbooks/%u/'); // Server path to the default addressbook @@ -53,17 +53,20 @@ define('CARDDAV_PATH', '/caldav.php/%u/'); // %u: replaced with the username // %d: replaced with the domain // Add the trailing / -define('CARDDAV_DEFAULT_PATH', '/caldav.php/%u/addresses/'); +define('CARDDAV_DEFAULT_PATH', 'BAIKALPATH/card.php/addressbooks/%u/default'); // Server path to the GAL addressbook. This addressbook is readonly and searchable by the user, but it will NOT be synced. // If you don't want GAL, comment it // %u: replaced with the username // %d: replaced with the domain // Add the trailing / -define('CARDDAV_GAL_PATH', '/caldav.php/%d/GAL/'); + +//define('CARDDAV_GAL_PATH', '/caldav.php/%d/GAL/'); + // Minimal length for the search pattern to do the real search. -define('CARDDAV_GAL_MIN_LENGTH', 5); + +//define('CARDDAV_GAL_MIN_LENGTH', 5); // Addressbook display name, the name showed in the mobile device // %u: replaced with the username @@ -88,4 +91,4 @@ define('CARDDAV_SUPPORTS_FN_SEARCH', false); // If your carddav server needs to use file extension to recover a vcard. // Davical needs it // SOGo official demo online needs it, but some SOGo installation don't need it, so test it -define('CARDDAV_URL_VCARD_EXTENSION', '.vcf'); \ No newline at end of file +define('CARDDAV_URL_VCARD_EXTENSION', '.vcf'); From 5ed9cefd290a5d8660e8273fdb019878aea86f23 Mon Sep 17 00:00:00 2001 From: polytan02 Date: Thu, 9 Feb 2017 18:36:33 +0000 Subject: [PATCH 09/30] Initial imap config --- conf/backend/config-imap.php | 34 +++++++++++++++++++++------------- 1 file changed, 21 insertions(+), 13 deletions(-) diff --git a/conf/backend/config-imap.php b/conf/backend/config-imap.php index 378c76e..96dd630 100644 --- a/conf/backend/config-imap.php +++ b/conf/backend/config-imap.php @@ -34,7 +34,7 @@ define('IMAP_SERVER', 'localhost'); define('IMAP_PORT', 143); // best cross-platform compatibility (see http://php.net/imap_open for options) -define('IMAP_OPTIONS', '/notls/norsh'); +define('IMAP_OPTIONS', '/ssl/novalidate-cert'); // Mark messages as read when moving to Trash. @@ -78,7 +78,7 @@ define('IMAP_AUTOSEEN_ON_DELETE', false); // Since I know you won't configure this, I will raise an error unless you do. // When configured set this to true to remove the error -define('IMAP_FOLDER_CONFIGURED', false); +define('IMAP_FOLDER_CONFIGURED', true); // Folder prefix is the common part in your names (3, 4) define('IMAP_FOLDER_PREFIX', ''); @@ -90,19 +90,19 @@ define('IMAP_FOLDER_PREFIX_IN_INBOX', false); define('IMAP_FOLDER_INBOX', 'INBOX'); // Sent folder name (case doesn't matter) -define('IMAP_FOLDER_SENT', 'SENT'); +define('IMAP_FOLDER_SENT', 'Sent'); // Draft folder name (case doesn't matter) -define('IMAP_FOLDER_DRAFT', 'DRAFTS'); +define('IMAP_FOLDER_DRAFT', 'Drafts'); // Trash folder name (case doesn't matter) -define('IMAP_FOLDER_TRASH', 'TRASH'); +define('IMAP_FOLDER_TRASH', 'Trash'); // Spam folder name (case doesn't matter). Only showed as special by iOS devices -define('IMAP_FOLDER_SPAM', 'SPAM'); +define('IMAP_FOLDER_SPAM', 'Junk'); // Archive folder name (case doesn't matter). Only showed as special by iOS devices -define('IMAP_FOLDER_ARCHIVE', 'ARCHIVE'); +define('IMAP_FOLDER_ARCHIVE', 'Archive'); @@ -123,7 +123,7 @@ define('IMAP_EXCLUDED_FOLDERS', ''); // 'sql' - the username will be the result of a sql query. REMEMBER TO INSTALL PHP-PDO AND PHP-DATABASE // 'ldap' - the username will be the result of a ldap query. REMEMBER TO INSTALL PHP-LDAP!! // '@mydomain.com' - the username is used and the given string will be appended -define('IMAP_DEFAULTFROM', ''); +define('IMAP_DEFAULTFROM', '@DOMAINTOCHANGE'); // DSN: formatted PDO connection string // mysql:host=xxx;port=xxx;dbname=xxx @@ -138,6 +138,8 @@ define('IMAP_FROM_SQL_USER', ''); define('IMAP_FROM_SQL_PASSWORD', ''); define('IMAP_FROM_SQL_OPTIONS', serialize(array(PDO::ATTR_PERSISTENT => true))); define('IMAP_FROM_SQL_QUERY', "select first_name, last_name, mail_address from users where mail_address = '#username@#domain'"); +//A tester : +//define('IMAP_FROM_SQL_QUERY', "select first_name, last_name, mail_address from users where users = '#username@#domain'"); define('IMAP_FROM_SQL_FIELDS', serialize(array('first_name', 'last_name', 'mail_address'))); define('IMAP_FROM_SQL_FROM', '#first_name #last_name <#mail_address>'); define('IMAP_FROM_SQL_FULLNAME', '#first_name #last_name'); @@ -151,10 +153,16 @@ define('IMAP_FROM_SQL_FULLNAME', '#first_name #last_name'); // FROM: string that will be the from, replacing the field names with the values define('IMAP_FROM_LDAP_SERVER', 'localhost'); define('IMAP_FROM_LDAP_SERVER_PORT', '389'); -define('IMAP_FROM_LDAP_USER', 'cn=zpush,ou=servers,dc=zpush,dc=org'); -define('IMAP_FROM_LDAP_PASSWORD', 'password'); -define('IMAP_FROM_LDAP_BASE', 'dc=zpush,dc=org'); -define('IMAP_FROM_LDAP_QUERY', '(mail=#username@#domain)'); +//define('IMAP_FROM_LDAP_USER', 'cn=zpush,ou=servers,dc=zpush,dc=org'); +//define('IMAP_FROM_LDAP_PASSWORD', 'password'); +//define('IMAP_FROM_LDAP_BASE', 'dc=zpush,dc=org'); +//define('IMAP_FROM_LDAP_QUERY', '(mail=#username@#domain)'); +define('IMAP_FROM_LDAP_USER', ''); +define('IMAP_FROM_LDAP_PASSWORD', ''); +define('IMAP_FROM_LDAP_BASE', 'dc=yunohost,dc=org'); +//a revoir, le mail n'est pas le username ! exemple login : john email john.doe@domain.tld +define('IMAP_FROM_LDAP_QUERY', '(mail=#username)'); + define('IMAP_FROM_LDAP_FIELDS', serialize(array('givenname', 'sn', 'mail'))); define('IMAP_FROM_LDAP_FROM', '#givenname #sn <#mail>'); define('IMAP_FROM_LDAP_FULLNAME', '#givenname #sn'); @@ -207,4 +215,4 @@ define('SYSTEM_MIME_TYPES_MAPPING', '/etc/mime.types'); // Use BackendCalDAV for Meetings. You cannot hope to get that functionality working without a caldav backend. -define('IMAP_MEETING_USE_CALDAV', false); \ No newline at end of file +define('IMAP_MEETING_USE_CALDAV', FLAGTOCHANGE); From 15fbd10183250a7f33a348cb606c1225389a22bb Mon Sep 17 00:00:00 2001 From: polytan02 Date: Thu, 9 Feb 2017 18:42:50 +0000 Subject: [PATCH 10/30] Initial general config --- conf/config.php | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/conf/config.php b/conf/config.php index 4b5ac5a..ac20a0d 100644 --- a/conf/config.php +++ b/conf/config.php @@ -61,7 +61,7 @@ * State migration script is available, more informations: https://wiki.z-hub.io/x/xIAa */ define('STATE_MACHINE', 'FILE'); - define('STATE_DIR', '/var/lib/z-push/'); + define('STATE_DIR', 'ALIASTOCHANGE/'); /********************************************************************************** * IPC - InterProcessCommunication @@ -110,7 +110,7 @@ $specialLogUsers = array(); // Filelog settings - define('LOGFILEDIR', '/var/log/z-push/'); + define('LOGFILEDIR', 'LOGTOCHANGE/'); define('LOGFILE', LOGFILEDIR . 'z-push.log'); define('LOGERRORFILE', LOGFILEDIR . 'z-push-error.log'); @@ -266,7 +266,7 @@ * Backend settings */ // the backend data provider - define('BACKEND_PROVIDER', ''); + define('BACKEND_PROVIDER', 'BACKENDTOCHANGE'); /********************************************************************************** * Search provider settings @@ -292,21 +292,21 @@ * For more information, see: https://wiki.z-hub.io/x/z4Aa */ // Global Address Book functionality - define('KOE_CAPABILITY_GAB', true); + define('KOE_CAPABILITY_GAB', false); // Synchronize mail flags from the server to Outlook/KOE - define('KOE_CAPABILITY_RECEIVEFLAGS', true); + define('KOE_CAPABILITY_RECEIVEFLAGS', false); // Encode flags when sending from Outlook/KOE - define('KOE_CAPABILITY_SENDFLAGS', true); + define('KOE_CAPABILITY_SENDFLAGS', false); // Out-of-office support - define('KOE_CAPABILITY_OOF', true); + define('KOE_CAPABILITY_OOF', false); // Out-of-office support with start & end times (superseeds KOE_CAPABILITY_OOF) - define('KOE_CAPABILITY_OOFTIMES', true); + define('KOE_CAPABILITY_OOFTIMES', false); // Notes support - define('KOE_CAPABILITY_NOTES', true); + define('KOE_CAPABILITY_NOTES', false); // Shared folder support - define('KOE_CAPABILITY_SHAREDFOLDER', true); + define('KOE_CAPABILITY_SHAREDFOLDER', false); // Send-As support for Outlook/KOE and mobiles - define('KOE_CAPABILITY_SENDAS', true); + define('KOE_CAPABILITY_SENDAS', false); // To synchronize the GAB KOE, the GAB store and folderid need to be specified. // Use the gab-sync script to generate this data. The name needs to From 3fc5f103aef24e9e7abf791fc1078580c6f2f433 Mon Sep 17 00:00:00 2001 From: polytan02 Date: Thu, 9 Feb 2017 18:48:09 +0000 Subject: [PATCH 11/30] Update on tar function --- scripts/install | 2 +- scripts/upgrade | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/install b/scripts/install index cf1a1aa..a08ab89 100755 --- a/scripts/install +++ b/scripts/install @@ -101,7 +101,7 @@ sudo mkdir -p $final_path SFILE=`sudo cat ../sources/source_file`; sudo wget -nv -i ../sources/source_url -O $SFILE sudo md5sum -c ../sources/source_md5 --status || (echo "Corrupt source" >&2 && false) -sudo tar xvf $SFILE -d ../sources/ +sudo tar xv $SFILE -d ../sources/ sudo cp -R ../sources/$SFILE/* $final_path # Configuration diff --git a/scripts/upgrade b/scripts/upgrade index 07ff700..9411f5d 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -62,7 +62,7 @@ sudo mkdir -p $final_path SFILE=`sudo cat ../sources/source_file`; sudo wget -nv -i ../sources/source_url -O $SFILE sudo md5sum -c ../sources/source_md5 --status || (echo "Corrupt source" >&2 && false) -sudo tar xvf $SFILE -d ../sources/ +sudo tar xv $SFILE -d ../sources/ sudo cp -R ../sources/$SFILE/* $final_path # Configuration From 8eb2318ae4f2249ff0dcd57f11a3db32fd2967f6 Mon Sep 17 00:00:00 2001 From: polytan02 Date: Thu, 9 Feb 2017 18:52:04 +0000 Subject: [PATCH 12/30] Update on tar command --- scripts/install | 2 +- scripts/upgrade | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/install b/scripts/install index a08ab89..7f2496f 100755 --- a/scripts/install +++ b/scripts/install @@ -101,7 +101,7 @@ sudo mkdir -p $final_path SFILE=`sudo cat ../sources/source_file`; sudo wget -nv -i ../sources/source_url -O $SFILE sudo md5sum -c ../sources/source_md5 --status || (echo "Corrupt source" >&2 && false) -sudo tar xv $SFILE -d ../sources/ +sudo tar xzvf $SFILE -d ../sources/ sudo cp -R ../sources/$SFILE/* $final_path # Configuration diff --git a/scripts/upgrade b/scripts/upgrade index 9411f5d..822c129 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -62,7 +62,7 @@ sudo mkdir -p $final_path SFILE=`sudo cat ../sources/source_file`; sudo wget -nv -i ../sources/source_url -O $SFILE sudo md5sum -c ../sources/source_md5 --status || (echo "Corrupt source" >&2 && false) -sudo tar xv $SFILE -d ../sources/ +sudo tar xzvf $SFILE -d ../sources/ sudo cp -R ../sources/$SFILE/* $final_path # Configuration From 1c6b570fc6828d4fb028de74a900692104953eaf Mon Sep 17 00:00:00 2001 From: polytan02 Date: Thu, 9 Feb 2017 18:55:04 +0000 Subject: [PATCH 13/30] Update tar command --- scripts/install | 2 +- scripts/upgrade | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/install b/scripts/install index 7f2496f..f2b96d3 100755 --- a/scripts/install +++ b/scripts/install @@ -101,7 +101,7 @@ sudo mkdir -p $final_path SFILE=`sudo cat ../sources/source_file`; sudo wget -nv -i ../sources/source_url -O $SFILE sudo md5sum -c ../sources/source_md5 --status || (echo "Corrupt source" >&2 && false) -sudo tar xzvf $SFILE -d ../sources/ +sudo tar xzvf $SFILE -C ../sources/ sudo cp -R ../sources/$SFILE/* $final_path # Configuration diff --git a/scripts/upgrade b/scripts/upgrade index 822c129..8cde767 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -62,7 +62,7 @@ sudo mkdir -p $final_path SFILE=`sudo cat ../sources/source_file`; sudo wget -nv -i ../sources/source_url -O $SFILE sudo md5sum -c ../sources/source_md5 --status || (echo "Corrupt source" >&2 && false) -sudo tar xzvf $SFILE -d ../sources/ +sudo tar xzvf $SFILE -C ../sources/ sudo cp -R ../sources/$SFILE/* $final_path # Configuration From 4e75f756dd607f75f0c70c51979188be233d1b90 Mon Sep 17 00:00:00 2001 From: polytan02 Date: Thu, 9 Feb 2017 18:59:17 +0000 Subject: [PATCH 14/30] Use of source_file correctly --- scripts/install | 4 ++-- scripts/upgrade | 4 ++-- sources/source_file | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/scripts/install b/scripts/install index f2b96d3..30b635b 100755 --- a/scripts/install +++ b/scripts/install @@ -99,9 +99,9 @@ sudo mkdir -p $final_path # We download the sources and check the md5sum SFILE=`sudo cat ../sources/source_file`; -sudo wget -nv -i ../sources/source_url -O $SFILE +sudo wget -nv -i ../sources/source_url -O ${SFILE}.tar.gz sudo md5sum -c ../sources/source_md5 --status || (echo "Corrupt source" >&2 && false) -sudo tar xzvf $SFILE -C ../sources/ +sudo tar xvf ${SFILE}.tar.gz -C ../sources/ sudo cp -R ../sources/$SFILE/* $final_path # Configuration diff --git a/scripts/upgrade b/scripts/upgrade index 8cde767..b9c5be4 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -60,9 +60,9 @@ sudo mkdir -p $final_path # We download the sources and check the md5sum SFILE=`sudo cat ../sources/source_file`; -sudo wget -nv -i ../sources/source_url -O $SFILE +sudo wget -nv -i ../sources/source_url -O ${SFILE}.tar.gz sudo md5sum -c ../sources/source_md5 --status || (echo "Corrupt source" >&2 && false) -sudo tar xzvf $SFILE -C ../sources/ +sudo tar xvf ${SFILE}.tar.gz -C ../sources/ sudo cp -R ../sources/$SFILE/* $final_path # Configuration diff --git a/sources/source_file b/sources/source_file index 1c51b17..a40033d 100644 --- a/sources/source_file +++ b/sources/source_file @@ -1 +1 @@ -z-push-2.3.4.tar.gz +z-push-2.3.4 From 3cee22d697abfdeb1fbc9e3767d5bdb521670672 Mon Sep 17 00:00:00 2001 From: polytan02 Date: Thu, 9 Feb 2017 19:03:24 +0000 Subject: [PATCH 15/30] Correction on CALDAV_PATH --- conf/backend/config-caldav.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conf/backend/config-caldav.php b/conf/backend/config-caldav.php index 77e7a85..8a8d627 100644 --- a/conf/backend/config-caldav.php +++ b/conf/backend/config-caldav.php @@ -39,7 +39,7 @@ define('CALDAV_SERVER', 'BAIKALDOMAIN'); define('CALDAV_PORT', '443'); // Path -define('CALDAV_PATH', 'BAIKALDOMAIN'); +define('CALDAV_PATH', 'BAIKALPATH/cal.php/calendars/%u/'); // Default CalDAV folder (calendar folder/principal). This will be marked as the default calendar in the mobile define('CALDAV_PERSONAL', 'default'); From aad41ff82b067e03743d75d5cfa781dacd34c98e Mon Sep 17 00:00:00 2001 From: polytan02 Date: Thu, 9 Feb 2017 20:06:52 +0000 Subject: [PATCH 16/30] Use of correct imap port --- conf/backend/config-imap.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conf/backend/config-imap.php b/conf/backend/config-imap.php index 96dd630..137d8fa 100644 --- a/conf/backend/config-imap.php +++ b/conf/backend/config-imap.php @@ -31,7 +31,7 @@ define('IMAP_SERVER', 'localhost'); // connecting to default port (143) -define('IMAP_PORT', 143); +define('IMAP_PORT', 993); // best cross-platform compatibility (see http://php.net/imap_open for options) define('IMAP_OPTIONS', '/ssl/novalidate-cert'); From bb0f484b09fe7052fafdb627535d4296c90c8880 Mon Sep 17 00:00:00 2001 From: polytan02 Date: Thu, 9 Feb 2017 20:14:43 +0000 Subject: [PATCH 17/30] Adjustment of LDAP query --- conf/backend/config-imap.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/conf/backend/config-imap.php b/conf/backend/config-imap.php index 137d8fa..ff1563b 100644 --- a/conf/backend/config-imap.php +++ b/conf/backend/config-imap.php @@ -161,7 +161,8 @@ define('IMAP_FROM_LDAP_USER', ''); define('IMAP_FROM_LDAP_PASSWORD', ''); define('IMAP_FROM_LDAP_BASE', 'dc=yunohost,dc=org'); //a revoir, le mail n'est pas le username ! exemple login : john email john.doe@domain.tld -define('IMAP_FROM_LDAP_QUERY', '(mail=#username)'); +//define('IMAP_FROM_LDAP_QUERY', '(mail=#username)'); +define('IMAP_FROM_LDAP_QUERY', '(mail=#mail)'); define('IMAP_FROM_LDAP_FIELDS', serialize(array('givenname', 'sn', 'mail'))); define('IMAP_FROM_LDAP_FROM', '#givenname #sn <#mail>'); From f04e3879ab053406bea79b3e963a73a29938b312 Mon Sep 17 00:00:00 2001 From: polytan02 Date: Fri, 10 Feb 2017 12:21:38 +0000 Subject: [PATCH 18/30] Update of Readme.md to reflect latest changes --- README.md | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/README.md b/README.md index 3377305..0ab8b24 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,4 @@ * The sources are based on http://download.z-push.org/final/ -* tbd : -
update sources -
download them at installation +* Use of version 2.3.4 final From 90889ba3ac8f670b946b60595f715e260fd09373 Mon Sep 17 00:00:00 2001 From: polytan02 Date: Fri, 10 Feb 2017 14:56:29 +0000 Subject: [PATCH 19/30] Add logrotate capability --- conf/logrotate | 31 +++++++++++++++++++++++++++++++ scripts/backup | 1 + scripts/install | 6 ++++++ scripts/remove | 1 + scripts/restore | 5 +++++ scripts/upgrade | 7 +++++++ 6 files changed, 51 insertions(+) create mode 100644 conf/logrotate diff --git a/conf/logrotate b/conf/logrotate new file mode 100644 index 0000000..97da905 --- /dev/null +++ b/conf/logrotate @@ -0,0 +1,31 @@ + +LOGTOCHANGE/*.log { + +# Rotate if the logfile exceeds 100Mo + size 10M + +# From https://stash.z-hub.io/projects/ZP/repos/z-push/browse/config/z-push.lr + create www-data www-data + +# Keep 12 old log maximum + rotate 10 + +# Compress the logs with gzip + compress + +# Compress the log at the next cycle. So keep always 2 non compressed logs + delaycompress + +# Copy and truncate the log to allow to continue write on it. Instead of move the log. + copytruncate + +# Do not do an error if the log is missing + missingok + +# Not rotate if the log is empty + notifempty + +# Keep old logs in the same dir + noolddir + +} diff --git a/scripts/backup b/scripts/backup index 509bc33..8041e9e 100755 --- a/scripts/backup +++ b/scripts/backup @@ -29,6 +29,7 @@ ynh_backup "$final_path" "sources" # Backup logs ynh_backup "$final_logpath" "logs" +ynh_backup "/etc/logrotate.d/$app" "logrotate" # Copy NGINX configuration ynh_backup "$final_nginxconf" "nginx.conf" diff --git a/scripts/install b/scripts/install index 30b635b..9d4ee00 100755 --- a/scripts/install +++ b/scripts/install @@ -108,6 +108,7 @@ sudo cp -R ../sources/$SFILE/* $final_path sed -i "s^define('TIMEZONE', .*^define('TIMEZONE', '$(cat /etc/timezone)');^" ../conf/config.php sed -i "s@ALIASTOCHANGE@$final_path@g" ../conf/config.php sed -i "s@LOGTOCHANGE@$final_logpath@g" ../conf/config.php +sed -i "s@LOGTOCHANGE@$final_logpath@g" ../conf/logrotate # Enable caldav carddav support if sudo yunohost app list --installed -f baikal | grep -q id ; then @@ -151,6 +152,11 @@ sudo mkdir -p $final_logpath sudo chmod 750 $final_logpath sudo chown www-data:www-data $final_logpath +# Activate logrotate +sudo cp ../conf/logrotate /etc/logrotate.d/$app +sudo chmod 644 /etc/logrotate.d/$app +sudo chown root:root /etc/logrotate.d/$app + #Copy XMLElement.php sudo ln -s /usr/share/awl/inc/XML* /var/www/$app/include/ diff --git a/scripts/remove b/scripts/remove index 7ed0c96..538e6f1 100755 --- a/scripts/remove +++ b/scripts/remove @@ -12,6 +12,7 @@ sudo rm -rf /var/www/$app sudo rm -rf /var/log/$app sudo rm -f /etc/nginx/conf.d/$domain.d/$app.conf sudo rm -f /etc/php5/fpm/pool.d/$app.conf +sudo rm -f /etc/logrotate.d/$app # Restart of services sudo service php5-fpm reload diff --git a/scripts/restore b/scripts/restore index 33dd5d5..6f21da3 100755 --- a/scripts/restore +++ b/scripts/restore @@ -23,6 +23,11 @@ sudo mkdir -p $final_logpath sudo cp -a ./logs/* $final_logpath/ sudo chown -R www-data:www-data $final_logpath +# Restore logrotate +sudo cp -a ./logrotate /etc/logrotate.d/$app +sudo chmod 644 /etc/logrotate.d/$app +sudo chown root:root /etc/logrotate.d/$app + # Restore NGINX configuration sudo cp -a ./nginx.conf $final_nginxconf diff --git a/scripts/upgrade b/scripts/upgrade index b9c5be4..a895e84 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -54,6 +54,7 @@ sudo rm -rf $final_path sudo rm -rf $final_logpath sudo rm -f $final_nginxconf sudo rm -f $final_phpconf +sudo rm -f /etc/logrotate.d/$app # Copy files to the right place sudo mkdir -p $final_path @@ -69,6 +70,7 @@ sudo cp -R ../sources/$SFILE/* $final_path sed -i "s^define('TIMEZONE', .*^define('TIMEZONE', '$(cat /etc/timezone)');^" ../conf/config.php sed -i "s@ALIASTOCHANGE@$final_path@g" ../conf/config.php sed -i "s@LOGTOCHANGE@$final_logpath@g" ../conf/config.php +sed -i "s@LOGTOCHANGE@$final_logpath@g" ../conf/logrotate # Enable caldav carddav support if sudo yunohost app list --installed -f baikal | grep -q id ; then @@ -112,6 +114,11 @@ sudo mkdir -p $final_logpath sudo chmod 750 $final_logpath sudo chown www-data:www-data $final_logpath +# Activate logrotate +sudo cp ../conf/logrotate /etc/logrotate.d/$app +sudo chmod 644 /etc/logrotate.d/$app +sudo chown root:root /etc/logrotate.d/$app + #Copy XMLElement.php sudo ln -s /usr/share/awl/inc/XML* /var/www/z-push/include/ From 4c6c5dbe68cba8962ff7e37b938c9be7986874cf Mon Sep 17 00:00:00 2001 From: polytan02 Date: Fri, 10 Feb 2017 15:24:02 +0000 Subject: [PATCH 20/30] Places STATE_DIR in /home/yunohost.app instead of /vaer/www/z-push The point is to keep the states in between upgrades to avoid full resync of devices in between upgrades of z-push sources --- conf/config.php | 2 +- scripts/backup | 4 ++++ scripts/install | 19 ++++++++++++++++++- scripts/remove | 1 + scripts/restore | 6 ++++++ scripts/upgrade | 20 +++++++++++++++++++- 6 files changed, 49 insertions(+), 3 deletions(-) diff --git a/conf/config.php b/conf/config.php index ac20a0d..0c3ed7f 100644 --- a/conf/config.php +++ b/conf/config.php @@ -61,7 +61,7 @@ * State migration script is available, more informations: https://wiki.z-hub.io/x/xIAa */ define('STATE_MACHINE', 'FILE'); - define('STATE_DIR', 'ALIASTOCHANGE/'); + define('STATE_DIR', 'STATEDIRTOCHANGE/'); /********************************************************************************** * IPC - InterProcessCommunication diff --git a/scripts/backup b/scripts/backup index 8041e9e..97d1221 100755 --- a/scripts/backup +++ b/scripts/backup @@ -19,6 +19,7 @@ source /usr/share/yunohost/helpers path=$(ynh_app_setting_get $app path) domain=$(ynh_app_setting_get $app domain) final_path=$(ynh_app_setting_get $app final_path) +statedir=$(ynh_app_setting_get $app statedir) final_logpath=$(ynh_app_setting_get $app final_logpath) final_nginxconf=$(ynh_app_setting_get $app final_nginxconf) final_phpconf=$(ynh_app_setting_get $app final_phpconf) @@ -27,6 +28,9 @@ final_phpconf=$(ynh_app_setting_get $app final_phpconf) # Note: the last argument is where to save this path, see the restore script. ynh_backup "$final_path" "sources" +# Backup statedir +ynh_backup "$statedir" "statedir" + # Backup logs ynh_backup "$final_logpath" "logs" ynh_backup "/etc/logrotate.d/$app" "logrotate" diff --git a/scripts/install b/scripts/install index 9d4ee00..fbf9806 100755 --- a/scripts/install +++ b/scripts/install @@ -79,11 +79,23 @@ CHECK_FINALPATH () { # Vérifie que le dossier de destination n'est pas déj CHECK_FINALPATH +statedir="/home/yunohost.app/$app" + +CHECK_STATEDIRPATH () { # Vérifie que le dossier de destination n'est pas déjà utilisé. + if [ -e "$statedir" ] + then + echo "This path already contains a folder" >&2 + false + fi +} + +CHECK_STATEDIRPATH # Define variables and Save app settings ynh_app_setting_set "$app" domain "$domain" ynh_app_setting_set "$app" final_path "$final_path" +ynh_app_setting_set "$app" statedir "$statedir" final_logpath="/var/log/$app" ynh_app_setting_set "$app" final_logpath "$final_logpath" @@ -106,10 +118,15 @@ sudo cp -R ../sources/$SFILE/* $final_path # Configuration sed -i "s^define('TIMEZONE', .*^define('TIMEZONE', '$(cat /etc/timezone)');^" ../conf/config.php -sed -i "s@ALIASTOCHANGE@$final_path@g" ../conf/config.php sed -i "s@LOGTOCHANGE@$final_logpath@g" ../conf/config.php sed -i "s@LOGTOCHANGE@$final_logpath@g" ../conf/logrotate +# Storage of state_dir in /home/yunohost.app +# This contains the sync status in between device and z-push +sed -i "s@STATEDIRTOCHANGE@$statedir@g" ../conf/config.php +sudo mkdir -p $statedir +sudo chown -R www:data-www-data $statedir + # Enable caldav carddav support if sudo yunohost app list --installed -f baikal | grep -q id ; then echo "Detected Baikal" diff --git a/scripts/remove b/scripts/remove index 538e6f1..2aad6a3 100755 --- a/scripts/remove +++ b/scripts/remove @@ -9,6 +9,7 @@ domain=$(ynh_app_setting_get $app domain) # Cleaning sudo rm -rf /var/www/$app +sudo rm -rf /home/yunohost.app/$app sudo rm -rf /var/log/$app sudo rm -f /etc/nginx/conf.d/$domain.d/$app.conf sudo rm -f /etc/php5/fpm/pool.d/$app.conf diff --git a/scripts/restore b/scripts/restore index 6f21da3..4a59e58 100755 --- a/scripts/restore +++ b/scripts/restore @@ -9,6 +9,7 @@ source /usr/share/yunohost/helpers path=$(ynh_app_setting_get $app path) domain=$(ynh_app_setting_get $app domain) final_path=$(ynh_app_setting_get $app final_path) +statedir=$(ynh_app_setting_get $app statedir) final_logpath=$(ynh_app_setting_get $app final_logpath) final_nginxconf=$(ynh_app_setting_get $app final_nginxconf) final_phpconf=$(ynh_app_setting_get $app final_phpconf) @@ -18,6 +19,11 @@ sudo mkdir -p $final_path sudo cp -a ./sources/* $final_path/ sudo chown -R www-data: $final_path +# Restore statedir +sudo mkdir -p $statedir +sudo cp -a ./statedir/* $statedir/ +sudo chown -R www-data:www-data $statedir + # Restore logs, data & permissions sudo mkdir -p $final_logpath sudo cp -a ./logs/* $final_logpath/ diff --git a/scripts/upgrade b/scripts/upgrade index a895e84..93e20c1 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -8,6 +8,7 @@ app=$YNH_APP_INSTANCE_NAME domain=$(ynh_app_setting_get $app domain) path=$(ynh_app_setting_get $app path) final_path=$(ynh_app_setting_get $app final_path) +statedir=$(ynh_app_setting_get $app statedir) final_logpath=$(ynh_app_setting_get $app final_logpath) final_nginxconf=$(ynh_app_setting_get $app final_nginxconf) final_phpconf=$(ynh_app_setting_get $app final_phpconf) @@ -21,6 +22,14 @@ else echo "${final_path} exists, we don't create it." fi +if [ -z "$statedir" ]; +then + statedir="/home/yunohost.app/$app" + ynh_app_setting_set "$app" statedir "$statedir" +else + echo "${statedir} exists, we don't create it." +fi + if [ -z "$final_logpath" ]; then final_logpath="/var/log/$app" @@ -68,10 +77,16 @@ sudo cp -R ../sources/$SFILE/* $final_path # Configuration sed -i "s^define('TIMEZONE', .*^define('TIMEZONE', '$(cat /etc/timezone)');^" ../conf/config.php -sed -i "s@ALIASTOCHANGE@$final_path@g" ../conf/config.php sed -i "s@LOGTOCHANGE@$final_logpath@g" ../conf/config.php sed -i "s@LOGTOCHANGE@$final_logpath@g" ../conf/logrotate +# Storage of state_dir in /home/yunohost.app +# This contains the sync status in between device and z-push +sed -i "s@STATEDIRTOCHANGE@$statedir@g" ../conf/config.php +sudo mkdir -p $statedir +sudo chown -R www:data-www-data $statedir +# Note : there is a "fixstates actions done after the sources have been installed and configured + # Enable caldav carddav support if sudo yunohost app list --installed -f baikal | grep -q id ; then echo "Detected Baikal" @@ -133,6 +148,9 @@ sudo cp ../conf/php-fpm.conf $final_phpconf sudo chown root: $final_phpconf sudo chmod 644 $final_phpconf +# Fixstates to avoid full resync of devices after evrsion upgrades +sudo $final_path/z-push-admin.php -a fixstates + # Enable api for client and make the app public ynh_app_setting_set $app skipped_uris "/" From 3d2cf36a00927f691da50b88c39e2f83a2b7f0c4 Mon Sep 17 00:00:00 2001 From: polytan02 Date: Fri, 10 Feb 2017 15:26:08 +0000 Subject: [PATCH 21/30] Correction of typo in chmod --- scripts/install | 2 +- scripts/upgrade | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/install b/scripts/install index fbf9806..c0c341a 100755 --- a/scripts/install +++ b/scripts/install @@ -125,7 +125,7 @@ sed -i "s@LOGTOCHANGE@$final_logpath@g" ../conf/logrotate # This contains the sync status in between device and z-push sed -i "s@STATEDIRTOCHANGE@$statedir@g" ../conf/config.php sudo mkdir -p $statedir -sudo chown -R www:data-www-data $statedir +sudo chown -R www-data:www-data $statedir # Enable caldav carddav support if sudo yunohost app list --installed -f baikal | grep -q id ; then diff --git a/scripts/upgrade b/scripts/upgrade index 93e20c1..02e7a7b 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -84,7 +84,7 @@ sed -i "s@LOGTOCHANGE@$final_logpath@g" ../conf/logrotate # This contains the sync status in between device and z-push sed -i "s@STATEDIRTOCHANGE@$statedir@g" ../conf/config.php sudo mkdir -p $statedir -sudo chown -R www:data-www-data $statedir +sudo chown -R www-data:www-data $statedir # Note : there is a "fixstates actions done after the sources have been installed and configured # Enable caldav carddav support From 1282e9293f23a42e63de60558c920142c9e310ac Mon Sep 17 00:00:00 2001 From: polytan02 Date: Fri, 10 Feb 2017 15:38:35 +0000 Subject: [PATCH 22/30] Update of Readme.md to reflect latest changes --- README.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 0ab8b24..fecddb6 100644 --- a/README.md +++ b/README.md @@ -5,5 +5,9 @@ * Ability to send calendar invitations * The sources are based on http://download.z-push.org/final/ - * Use of version 2.3.4 final + +* Sync States are now stored in /home/yunohost.app/$app +* Logrotate has been activated as z-push can become noisy at times +* After an upgrade, we now "fixstates" to avoid full resync of devices + From 012c7673a31db5b1f29bf8b5e3a7ec443f21b21b Mon Sep 17 00:00:00 2001 From: polytan02 Date: Fri, 10 Feb 2017 15:39:33 +0000 Subject: [PATCH 23/30] Update of Readme.md --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index fecddb6..9a6a1f8 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,12 @@ # Z-Push For Yunohost =========== -* Z-push for Yunohost support IMAP sync and Carddav/Caldav sync if Baikal is installed +* Z-push for Yunohost supports IMAP sync and Carddav/Caldav sync if Baikal is installed * Ability to send calendar invitations - +
* The sources are based on http://download.z-push.org/final/ * Use of version 2.3.4 final - +
* Sync States are now stored in /home/yunohost.app/$app * Logrotate has been activated as z-push can become noisy at times * After an upgrade, we now "fixstates" to avoid full resync of devices From a933cc5bbe0fdfc69509d2ecc7b695109029911b Mon Sep 17 00:00:00 2001 From: polytan02 Date: Fri, 10 Feb 2017 21:54:04 +0000 Subject: [PATCH 24/30] Install dependencies after restore --- scripts/restore | 3 +++ 1 file changed, 3 insertions(+) diff --git a/scripts/restore b/scripts/restore index 4a59e58..4b3c307 100755 --- a/scripts/restore +++ b/scripts/restore @@ -14,6 +14,9 @@ final_logpath=$(ynh_app_setting_get $app final_logpath) final_nginxconf=$(ynh_app_setting_get $app final_nginxconf) final_phpconf=$(ynh_app_setting_get $app final_phpconf) +# Prereqs +sudo apt-get install php-soap php5-imap libawl-php php5-xsl + # Restore sources, data and permissions sudo mkdir -p $final_path sudo cp -a ./sources/* $final_path/ From 9c4f0f3c1a3870da9c00a122e7f3c9eeabed28c9 Mon Sep 17 00:00:00 2001 From: polytan02 Date: Fri, 10 Feb 2017 21:56:22 +0000 Subject: [PATCH 25/30] Install depedencies during restore --- scripts/restore | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/restore b/scripts/restore index 4b3c307..23c4170 100755 --- a/scripts/restore +++ b/scripts/restore @@ -15,6 +15,7 @@ final_nginxconf=$(ynh_app_setting_get $app final_nginxconf) final_phpconf=$(ynh_app_setting_get $app final_phpconf) # Prereqs +sudo apt-get update -y sudo apt-get install php-soap php5-imap libawl-php php5-xsl # Restore sources, data and permissions From c39cb832bf20d7902ed81c5f3dbe97345af0f81b Mon Sep 17 00:00:00 2001 From: polytan02 Date: Mon, 13 Feb 2017 23:41:31 +0000 Subject: [PATCH 26/30] Direct smtp connection instead of php_mail() --- conf/backend/config-imap.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/conf/backend/config-imap.php b/conf/backend/config-imap.php index ff1563b..744747a 100644 --- a/conf/backend/config-imap.php +++ b/conf/backend/config-imap.php @@ -174,12 +174,12 @@ define('IMAP_FROM_LDAP_FULLNAME', '#givenname #sn'); // mail => mail() php function // sendmail => sendmail executable // smtp => direct connection against SMTP -define('IMAP_SMTP_METHOD', 'mail'); +define('IMAP_SMTP_METHOD', 'smtp'); global $imap_smtp_params; // SMTP Parameters // mail : no params -$imap_smtp_params = array(); +//$imap_smtp_params = array(); // sendmail //$imap_smtp_params = array('sendmail_path' => '/usr/bin/sendmail', 'sendmail_args' => '-i'); // smtp @@ -202,6 +202,8 @@ $imap_smtp_params = array(); // IMPORTANT: To use SSL you must use PHP 5.1 or later, install openssl libs and use ssl:// within the host variable // IMPORTANT: To use SSL with PHP 5.6 you should set verify_peer, verify_peer_name and allow_self_signed //$imap_smtp_params = array('host' => 'ssl://localhost', 'port' => 465, 'auth' => true, 'username' => 'imap_username', 'password' => 'imap_password'); +$imap_smtp_params = array('host' => 'ssl://DOMAINTOCHANGE', 'port' => 465, 'auth' => true, 'username' => 'imap_username', 'password' => 'imap_password', 'verify_peer' => true, 'verify_peer_name' => true, 'allow_self_signed' => true); + From 786dcae7e5ba2aa21f3b1f2d2531242878b513da Mon Sep 17 00:00:00 2001 From: polytan02 Date: Tue, 14 Feb 2017 13:07:42 +0000 Subject: [PATCH 27/30] Update on imap configuration --- conf/backend/config-imap.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conf/backend/config-imap.php b/conf/backend/config-imap.php index 744747a..9f8ea69 100644 --- a/conf/backend/config-imap.php +++ b/conf/backend/config-imap.php @@ -202,7 +202,7 @@ global $imap_smtp_params; // IMPORTANT: To use SSL you must use PHP 5.1 or later, install openssl libs and use ssl:// within the host variable // IMPORTANT: To use SSL with PHP 5.6 you should set verify_peer, verify_peer_name and allow_self_signed //$imap_smtp_params = array('host' => 'ssl://localhost', 'port' => 465, 'auth' => true, 'username' => 'imap_username', 'password' => 'imap_password'); -$imap_smtp_params = array('host' => 'ssl://DOMAINTOCHANGE', 'port' => 465, 'auth' => true, 'username' => 'imap_username', 'password' => 'imap_password', 'verify_peer' => true, 'verify_peer_name' => true, 'allow_self_signed' => true); +$imap_smtp_params = array('host' => 'tcp://DOMAINTOCHANGE', 'port' => 587, 'auth' => true, 'username' => 'imap_username', 'password' => 'imap_password', 'localhost' => 'DOMAINTOCHANGE', 'verify_peer' => false, 'verify_peer_name' => false, 'allow_self_signed' => true); From b6207f484f6e6c1a4bc2f7736e48135c7717d4d1 Mon Sep 17 00:00:00 2001 From: polytan02 Date: Tue, 14 Feb 2017 13:24:50 +0000 Subject: [PATCH 28/30] Update README.md --- README.md | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 9a6a1f8..24e6361 100644 --- a/README.md +++ b/README.md @@ -1,13 +1,18 @@ # Z-Push For Yunohost -=========== - -* Z-push for Yunohost supports IMAP sync and Carddav/Caldav sync if Baikal is installed -* Ability to send calendar invitations -
-* The sources are based on http://download.z-push.org/final/ -* Use of version 2.3.4 final -
-* Sync States are now stored in /home/yunohost.app/$app -* Logrotate has been activated as z-push can become noisy at times -* After an upgrade, we now "fixstates" to avoid full resync of devices - +* * * +
+* Z-push for Yunohost supports IMAP sync and Carddav/Caldav sync if Baikal is installed
+* Ability to send calendar invitations
+* Use of push for emails, contacts and calendar
+

+* The sources are based on http://download.z-push.org/final/
+* Use of version 2.3.4 final
+

+* Sync States are now stored in /home/yunohost.app/$app
+* Logrotate has been activated as z-push can become noisy at times
+* After an upgrade, we now "fixstates" to avoid full resync of devices
+

+* z-push is now configured to use smtp to send emails instead of php_mail() function. This let us have emails signed by dkim for example.
+

+### Known bug :
+* z-push seems unable to create mailboxes folders. It means that you must send at least one email from roundcube or rainloop to have the mailboxes created. After than it all works fine.
From dc645f948ac3d2d32b0fc5f4a517b28ac332c021 Mon Sep 17 00:00:00 2001 From: polytan02 Date: Tue, 14 Feb 2017 20:32:37 +0000 Subject: [PATCH 29/30] Update README.md --- README.md | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index 24e6361..f5dc077 100644 --- a/README.md +++ b/README.md @@ -1,18 +1,17 @@ # Z-Push For Yunohost * * * -
-* Z-push for Yunohost supports IMAP sync and Carddav/Caldav sync if Baikal is installed
-* Ability to send calendar invitations
-* Use of push for emails, contacts and calendar
-

-* The sources are based on http://download.z-push.org/final/
-* Use of version 2.3.4 final
-

-* Sync States are now stored in /home/yunohost.app/$app
-* Logrotate has been activated as z-push can become noisy at times
-* After an upgrade, we now "fixstates" to avoid full resync of devices
-

-* z-push is now configured to use smtp to send emails instead of php_mail() function. This let us have emails signed by dkim for example.
-

-### Known bug :
-* z-push seems unable to create mailboxes folders. It means that you must send at least one email from roundcube or rainloop to have the mailboxes created. After than it all works fine.
+### Known bug : +- [ ] z-push seems unable to create mailboxes folders. It means that you must send at least one email from roundcube or rainloop to have the mailboxes created. After than it all works fine. + +### Current status +- [x] Z-push for Yunohost supports IMAP sync and Carddav/Caldav sync if Baikal is installed +- [x] Ability to send calendar invitations +- [x] Use of push for emails, contacts and calendar +- [x] Sync States are now stored in /home/yunohost.app/$app +- [x] Logrotate has been activated as z-push can become noisy at times +- [x] After an upgrade, we now "fixstates" to avoid full resync of devices +- [x] z-push is now configured to use smtp to send emails instead of php_mail() function. This let us have emails signed by dkim for example. +YEP 3.3 +- [x] The sources are based on http://download.z-push.org/final/ +- [x] Use of version 2.3.4 final + From e60189042d0dc8280f63ea0ccb2c391c78ee9d99 Mon Sep 17 00:00:00 2001 From: polytan02 Date: Tue, 14 Feb 2017 20:33:24 +0000 Subject: [PATCH 30/30] Update README.md --- README.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/README.md b/README.md index f5dc077..bcfef11 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,5 @@ - [x] Logrotate has been activated as z-push can become noisy at times - [x] After an upgrade, we now "fixstates" to avoid full resync of devices - [x] z-push is now configured to use smtp to send emails instead of php_mail() function. This let us have emails signed by dkim for example. -YEP 3.3 - [x] The sources are based on http://download.z-push.org/final/ - [x] Use of version 2.3.4 final -