diff --git a/.docker/dev/php/Dockerfile b/.docker/dev/php/Dockerfile index 4a2b7497f..74759db6c 100644 --- a/.docker/dev/php/Dockerfile +++ b/.docker/dev/php/Dockerfile @@ -15,7 +15,7 @@ RUN pecl install xxtea-1.0.11 && \ RUN docker-php-ext-configure intl && \ docker-php-ext-configure ldap && \ - docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ && \ + docker-php-ext-configure gd --with-freetype=/usr/include/ --with-jpeg=/usr/include/ && \ docker-php-ext-install opcache pdo_mysql zip intl gd ldap RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer diff --git a/.docker/release/Dockerfile b/.docker/release/Dockerfile index 0c7d66ea8..f1ba85139 100644 --- a/.docker/release/Dockerfile +++ b/.docker/release/Dockerfile @@ -27,7 +27,7 @@ RUN mkdir -p /usr/share/man/man1/ /usr/share/man/man3/ /usr/share/man/man7/ && \ RUN php -m && \ docker-php-ext-configure ldap --with-libdir=lib/x86_64-linux-gnu/ && \ docker-php-ext-configure intl && \ - docker-php-ext-configure gd --with-freetype-dir=/usr/include --with-jpeg-dir=/usr/include/ && \ + docker-php-ext-configure gd --with-freetype --with-jpeg && \ docker-php-ext-install ldap opcache pdo_mysql pdo_pgsql zip intl gd && \ php -m diff --git a/.docker/release/files/usr/local/include/application.ini b/.docker/release/files/usr/local/include/application.ini index f70bfcf4a..0630af79c 100644 --- a/.docker/release/files/usr/local/include/application.ini +++ b/.docker/release/files/usr/local/include/application.ini @@ -1,4 +1,4 @@ -; SnappyMail Webmail configuration file +; SnappyMail configuration file ; Please don't add custom parameters here, those will be overwritten [webmail] @@ -27,38 +27,27 @@ allow_languages_on_settings = On allow_additional_accounts = On allow_additional_identities = On -; Number of messages displayed on page by default +; Number of messages displayed on page by default messages_per_page = 20 +; Mark message read after N seconds +message_read_delay = 5 + ; File size limit (MB) for file upload on compose screen ; 0 for unlimited. -attachment_size_limit = 25 +attachment_size_limit = 2 [interface] show_attachment_thumbnail = On -use_native_scrollbars = Off new_move_to_folder_button = On -[branding] -login_logo = "" -login_background = "" -login_desc = "" -login_css = "" -user_css = "" -user_logo = "" -user_logo_title = "" -user_logo_message = "" -user_iframe_message = "" -welcome_page_url = "" -welcome_page_display = "none" - [contacts] ; Enable contacts enable = Off -allow_sync = On +allow_sync = Off sync_interval = 20 type = "sqlite" -pdo_dsn = "mysql:host=127.0.0.1;port=3306;dbname=snappymail" +pdo_dsn = "host=127.0.0.1;port=3306;dbname=snappymail" pdo_user = "root" pdo_password = "" suggestions_limit = 30 @@ -67,23 +56,23 @@ suggestions_limit = 30 ; Enable CSRF protection (http://en.wikipedia.org/wiki/Cross-site_request_forgery) csrf_protection = On custom_server_signature = "SnappyMail" -x_frame_options_header = "" +x_frame_options_header = "DENY" x_xss_protection_header = "1; mode=block" openpgp = Off ; Login and password for web admin panel admin_login = "admin" -admin_password = "12345" +admin_password = "" +admin_totp = "" ; Access settings allow_admin_panel = On -allow_two_factor_auth = Off -force_two_factor_auth = Off -hide_x_mailer_header = Off +hide_x_mailer_header = On admin_panel_host = "" admin_panel_key = "admin" content_security_policy = "" -core_install_access_domain = "" +csp_report = Off +encrypt_cipher = "aes-256-cbc-hmac-sha1" [ssl] ; Require verification of SSL certificate used. @@ -102,20 +91,12 @@ capath = "" client_cert = "" [capa] -folders = On -composer = On contacts = On -settings = On quota = On -help = On -reload = On search = On search_adv = On -filters = On -x-templates = Off dangerous_actions = On message_actions = On -messagelist_actions = On attachments_actions = On [login] @@ -125,10 +106,7 @@ default_domain = "" allow_languages_on_login = On determine_user_language = On determine_user_domain = Off -welcome_page = Off hide_submit_button = On -forgot_password_link_url = "" -registration_link_url = "" login_lowercase = On ; This option allows webmail to remember the logged in user @@ -155,6 +133,7 @@ view_editor_type = "Html" view_layout = 1 view_use_checkboxes = On autologout = 30 +view_html = On show_images = Off contacts_autosave = On mail_use_threads = Off @@ -165,6 +144,17 @@ mail_reply_same_folder = Off ; Enable logging enable = Off +; Log messages of set RFC 5424 section 6.2.1 Severity level and higher (0 = highest, 7 = lowest). +; 0 = Emergency +; 1 = Alert +; 2 = Critical +; 3 = Error +; 4 = Warning +; 5 = Notice +; 6 = Informational +; 7 = Debug +level = 4 + ; Logs entire request only if error occured (php requred) write_on_error_only = Off @@ -177,9 +167,8 @@ write_on_timeout_only = 0 ; Required for development purposes only. ; Disabling this option is not recommended. hide_passwords = On -time_offset = "0" +time_zone = "UTC" session_filter = "" -sentry_dsn = "" ; Log filename. ; For security reasons, some characters are removed from filename. @@ -207,6 +196,7 @@ sentry_dsn = "" ; filename = "log-{date:Y-m-d}.txt" ; filename = "{date:Y-m-d}/{user:domain}/{user:email}_{user:uid}.log" ; filename = "{user:email}-{date:Y-m-d}.txt" +; filename = "syslog" filename = "log-{date:Y-m-d}.txt" ; Enable auth logging in a separate file (for fail2ban) @@ -214,35 +204,13 @@ auth_logging = Off auth_logging_filename = "fail2ban/auth-{date:Y-m-d}.txt" auth_logging_format = "[{date:Y-m-d H:i:s}] Auth failed: ip={request:ip} user={imap:login} host={imap:host} port={imap:port}" +; Enable auth logging to syslog for fail2ban +auth_syslog = On + [debug] ; Special option required for development purposes enable = Off -[social] -; Google -google_enable = Off -google_enable_auth = Off -google_enable_auth_gmail = Off -google_enable_drive = Off -google_enable_preview = Off -google_client_id = "" -google_client_secret = "" -google_api_key = "" - -; Facebook -fb_enable = Off -fb_app_id = "" -fb_app_secret = "" - -; Twitter -twitter_enable = Off -twitter_consumer_key = "" -twitter_consumer_secret = "" - -; Dropbox -dropbox_enable = Off -dropbox_api_key = "" - [cache] ; The section controls caching of the entire application. ; @@ -252,7 +220,7 @@ enable = On ; Additional caching key. If changed, cache is purged index = "v1" -; Can be: files, APC, memcache, redis (beta) +; Can be: files, APCU, memcache, redis (beta) fast_cache_driver = "files" ; Additional caching key. If changed, fast cache is purged @@ -268,33 +236,21 @@ http_expires = 3600 server_uids = On [labs] -; Experimental settings. Handle with care. -; -allow_mobile_version = On -ignore_folders_subscription = Off -check_new_password_strength = On -update_channel = "stable" -allow_gravatar = On -allow_prefetch = On -allow_smart_html_links = On +allow_prefetch = Off cache_system_data = On date_from_headers = On -autocreate_system_folders = On +autocreate_system_folders = Off allow_message_append = Off -disable_iconv_if_mbstring_supported = Off login_fault_delay = 1 log_ajax_response_write_limit = 300 -allow_html_editor_source_button = Off allow_html_editor_biti_buttons = Off allow_ctrl_enter_on_compose = On try_to_detect_hidden_images = Off -hide_dangerous_actions = Off use_app_debug_js = Off use_mobile_version_for_tablets = Off use_app_debug_css = Off use_imap_sort = On use_imap_force_selection = Off -use_imap_list_subscribe = On use_imap_thread = On use_imap_move = Off use_imap_expunge_all_on_delete = Off @@ -309,51 +265,41 @@ imap_message_all_headers = Off imap_large_thread_limit = 50 imap_folder_list_limit = 200 imap_show_login_alert = On -imap_use_auth_plain = On -imap_use_auth_cram_md5 = Off +imap_use_list_status = On +imap_timeout = 300 smtp_show_server_errors = Off -smtp_use_auth_plain = On -smtp_use_auth_cram_md5 = Off -sieve_allow_raw_script = Off -sieve_utf8_folder_name = On +smtp_timeout = 60 sieve_auth_plain_initial = On sieve_allow_fileinto_inbox = Off -imap_timeout = 300 -smtp_timeout = 60 sieve_timeout = 10 -domain_list_limit = 99 +sasl_allow_plain = On +sasl_allow_scram_sha = Off +sasl_allow_cram_md5 = Off mail_func_clear_headers = On mail_func_additional_parameters = Off favicon_status = On folders_spec_limit = 50 -owncloud_save_folder = "Attachments" -owncloud_suggestions = On curl_proxy = "" curl_proxy_auth = "" in_iframe = Off force_https = Off -custom_login_link = "" -custom_logout_link = "" -allow_external_login = Off -allow_external_sso = Off -external_sso_key = "" http_client_ip_check_proxy = Off fast_cache_memcache_host = "127.0.0.1" fast_cache_memcache_port = 11211 fast_cache_redis_host = "127.0.0.1" fast_cache_redis_port = 6379 -use_local_proxy_for_external_images = Off +use_local_proxy_for_external_images = On detect_image_exif_orientation = On cookie_default_path = "" cookie_default_secure = Off check_new_messages = On replace_env_in_configuration = "" -startup_url = "" strict_html_parser = Off -allow_cmd = Off +boundary_prefix = "" +kolab_enabled = Off dev_email = "" dev_password = "" [version] -current = "1.14.0" -saved = "Wed, 08 Apr 2020 16:37:27 +0000" \ No newline at end of file +current = "2.13.4" +saved = "Fri, 04 Mar 2022 08:55:26 +0000" diff --git a/.eslintrc.js b/.eslintrc.js index 90c208a77..851a1868e 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -9,7 +9,7 @@ module.exports = { env: { node: true, browser: true, - es6: true + es2020: true }, globals: { // SnappyMail @@ -34,10 +34,10 @@ module.exports = { 'Crossroads': "readonly", // vendors/jua 'Jua': "readonly", - // vendors/qr.js - 'qr': "readonly", // vendors/bootstrap/bootstrap.native.js - 'BSN': "readonly" + 'BSN': "readonly", + // Mailvelope + 'mailvelope': "readonly" }, // http://eslint.org/docs/rules/ rules: { diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml index d31f25db1..fc1bece3e 100644 --- a/.github/FUNDING.yml +++ b/.github/FUNDING.yml @@ -1,3 +1,2 @@ -github: the-djmaze community_bridge: SnappyMail custom: ["https://www.paypal.me/thedjmaze", "https://snappymail.eu"] diff --git a/.gitignore b/.gitignore index 088e6c54e..ae906552b 100644 --- a/.gitignore +++ b/.gitignore @@ -18,3 +18,11 @@ /include.php .idea/ .env +/test +/public_html +/vendors/knockout/spec +/vendors/openpgp-5 +!/vendors/openpgp-5/dist +/vendors/vanillaqr.js/ +/integrations/nextcloud/rainloop +/integrations/owncloud/rainloop diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 000000000..cfb771834 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "vendors/openpgp-5"] + path = vendors/openpgp-5 + url = git@github.com:the-djmaze/openpgpjs.git diff --git a/.htaccess b/.htaccess index 8b8b08db7..0e6142e36 100644 --- a/.htaccess +++ b/.htaccess @@ -1,6 +1,8 @@ -RewriteEngine On -# Redirect cPanel -RewriteRule cpsess.* https://%{HTTP_HOST}/ [L,R=301] + + RewriteEngine On + # Redirect cPanel + RewriteRule cpsess.* https://%{HTTP_HOST}/ [L,R=301] + ExpiresActive On @@ -18,51 +20,18 @@ RewriteRule cpsess.* https://%{HTTP_HOST}/ [L,R=301] - Header set Cache-Control "public, max-age=31536000" - Header set Content-Security-Policy "default-src 'self'; script-src 'self' 'unsafe-inline' 'unsafe-eval'; img-src 'self' data:; style-src 'self' 'unsafe-inline'" - Header set Referrer-Policy "no-referrer" +# Header set Cache-Control "public, max-age=31536000" +# Header set Content-Security-Policy "default-src 'self'; script-src 'self' 'unsafe-inline' 'unsafe-eval'; img-src 'self' data:; style-src 'self' 'unsafe-inline'" +# Header set Referrer-Policy "no-referrer" Header set Strict-Transport-Security "max-age=31536000" Header set imagetoolbar "no" - Header set X-Content-Type-Options "nosniff" - Header set X-Frame-Options "DENY" - Header set X-XSS-Protection "1; mode=block" +# Header set X-Content-Type-Options "nosniff" +# Header set X-Frame-Options "DENY" +# Header set X-XSS-Protection "1; mode=block" Header set Service-Worker-Allowed "/" - RewriteCond %{HTTP:Accept-encoding} br - RewriteCond "%{REQUEST_FILENAME}\.br" -s - RewriteRule "^(.+)" "$1\.br" [L,T=text/javascript,QSA] - - RewriteCond %{HTTP:Accept-encoding} gzip - RewriteCond "%{REQUEST_FILENAME}\.gz" -s - RewriteRule "^(.+)" "$1\.gz" [L,T=text/javascript,QSA] - - RewriteCond %{HTTP:Accept-encoding} br - RewriteCond "%{REQUEST_FILENAME}\.br" -s - RewriteRule "^(.+)" "$1\.br" [L,T=text/css,QSA] - - RewriteCond %{HTTP:Accept-encoding} gzip - RewriteCond "%{REQUEST_FILENAME}\.gz" -s - RewriteRule "^(.+)" "$1\.gz" [L,T=text/css,QSA] - - - SetEnv no-gzip 1 - SetEnv no-brotli 1 - # Serve correct encoding type. - Header append Content-Encoding br - # Force proxies to cache brotli & - # non-brotli css/js files separately. - Header append Vary Accept-Encoding - - - - SetEnv no-gzip 1 - SetEnv no-brotli 1 - # Serve correct encoding type. - Header append Content-Encoding gzip - # Force proxies to cache gzipped & - # non-gzipped css/js files separately. - Header append Vary Accept-Encoding - + # Google FLoC +# Header set Permissions-Policy "interest-cohort=()" # diff --git a/.tx/config b/.tx/config deleted file mode 100644 index 998d92cbb..000000000 --- a/.tx/config +++ /dev/null @@ -1,15 +0,0 @@ -[main] -host = https://www.transifex.com -minimum_perc = 60 -type = YAML - -[snappymail-webmail.snappymail-webmail] -file_filter = snappymail/v/0.0.0/app/localization/webmail/.yml -source_file = snappymail/v/0.0.0/app/localization/webmail/_source.en.yml -source_lang = en - -[snappymail-webmail.snappymail-admin] -file_filter = snappymail/v/0.0.0/app/localization/admin/.yml -source_file = snappymail/v/0.0.0/app/localization/admin/_source.en.yml -source_lang = en - diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index c2cda2472..db363fddd 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -7,14 +7,15 @@ **Getting started** -1. Install node.js - `https://nodejs.org/download/` -2. Install yarn - `https://yarnpkg.com/en/docs/install` -3. Install gulp - `npm install gulp -g` -4. Fork snappymail - `https://github.com/the-djmaze/snappymail/issues/new#fork-destination-box` -5. Clone snappymail - `git clone git@github.com:USERNAME/snappymail.git snappymail` -6. `cd snappymail` -7. Install install all dependencies - `yarn install` -8. Run gulp - `gulp` +1. Install PHP +2. Install node.js - `https://nodejs.org/download/` +3. Install yarn - `https://yarnpkg.com/en/docs/install` +4. Install gulp - `npm install gulp -g` +5. Fork snappymail from https://github.com/the-djmaze/snappymail +6. Clone snappymail - `git clone git@github.com:USERNAME/snappymail.git snappymail` +7. `cd snappymail` +8. Install all dependencies - `yarn install` +9. Run gulp - `gulp` --- @@ -30,6 +31,17 @@ 1. Edit data/\_data_/\_default_/configs/application.ini 2. Set 'cache_system_data' to Off +**Release** + +1. Install gzip +2. Install brotli +3. php release.php + +Options: +* `php release.php --aur` = Build Arch Linux package +* `php release.php --docker` = Build Docker instance +* `php release.php --plugins` = Build plugins + --- If you have any questions, open an issue or email support@snappymail.eu. diff --git a/Makefile b/Makefile index 02de1b5f1..22871b0e8 100644 --- a/Makefile +++ b/Makefile @@ -1,75 +1,75 @@ #!make rebuild: _down - docker-compose build --no-cache + docker compose build --no-cache up: _up status _up: - docker-compose up -d + docker compose up -d stop: _stop status _stop: - docker-compose stop + docker compose stop down: _down status _down: - docker-compose down + docker compose down restart: _stop _up status status: - @docker-compose ps + @docker compose ps tx: - @docker-compose run --no-deps --rm tx tx pull -a -s -f -d + @docker compose run --no-deps --rm tx tx pull -a -s -f -d console-node: - @docker-compose run --no-deps --rm node sh + @docker compose run --no-deps --rm node sh console-tx: - @docker-compose run --no-deps --rm tx sh + @docker compose run --no-deps --rm tx sh console-php: - @docker-compose exec php sh + @docker compose exec php sh console: console-node logs: - @docker-compose logs --tail=100 -f + @docker compose logs --tail=100 -f logs-db: - @docker-compose logs --tail=100 -f db + @docker compose logs --tail=100 -f db logs-php: - @docker-compose logs --tail=100 -f php + @docker compose logs --tail=100 -f php logs-node: - @docker-compose logs --tail=100 -f node + @docker compose logs --tail=100 -f node logs-nginx: - @docker-compose logs --tail=100 -f nginx + @docker compose logs --tail=100 -f nginx logs-mail: - @docker-compose logs --tail=100 -f mail + @docker compose logs --tail=100 -f mail logs-tx: - @docker-compose logs --tail=100 -f tx + @docker compose logs --tail=100 -f tx rl-lint: - @docker-compose run --no-deps --rm node gulp lint + @docker compose run --no-deps --rm node gulp lint rl-dev: - @docker-compose run --no-deps --rm node npm run watch-js + @docker compose run --no-deps --rm node npm run watch-js rl-compile: - @docker-compose run --no-deps --rm node gulp build + @docker compose run --no-deps --rm node gulp build rl-compile-with-source: - @docker-compose run --no-deps --rm node gulp build --source + @docker compose run --no-deps --rm node gulp build --source rl-watch-css: - @docker-compose run --no-deps --rm node npm run watch-css + @docker compose run --no-deps --rm node npm run watch-css rl-watch-js: - @docker-compose run --no-deps --rm node npm run watch-js + @docker compose run --no-deps --rm node npm run watch-js rl-build: - @docker-compose run --no-deps --rm node gulp all + @docker compose run --no-deps --rm node gulp all rl-build-pro: - @docker-compose run --no-deps --rm node gulp all --pro + @docker compose run --no-deps --rm node gulp all --pro yarn-install: - @docker-compose run --no-deps --rm node yarn install + @docker compose run --no-deps --rm node yarn install yarn-outdated: - @docker-compose run --no-deps --rm node yarn outdated + @docker compose run --no-deps --rm node yarn outdated yarn-upgrade: - @docker-compose run --no-deps --rm node yarn upgrade-interactive --exact --latest + @docker compose run --no-deps --rm node yarn upgrade-interactive --exact --latest gpg: docker run -it --rm -w=/var/www \ diff --git a/README.md b/README.md index d560775a6..f95ff9df9 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@
- +

SnappyMail

@@ -34,7 +34,7 @@ And don't forget to read the [RainLoop documentation](https://www.rainloop.net/d **GNU AFFERO GENERAL PUBLIC LICENSE Version 3 (AGPL)**. http://www.gnu.org/licenses/agpl-3.0.html -Copyright (c) 2020 - 2021 SnappyMail +Copyright (c) 2020 - 2022 SnappyMail Copyright (c) 2013 - 2021 RainLoop ## Modifications @@ -45,24 +45,25 @@ This fork of RainLoop has the following changes: * Admin uses password_hash/password_verify * Auth failed attempts written to syslog * Added Fail2ban instructions -* ES2015 +* ES2018 * PHP 7.3+ required * PHP mbstring extension required * PHP replaced pclZip with PharData and ZipArchive -* PHP yaml extension else use the old Spyc +* Dark mode * Added option to remove background/font colors from messages for real "dark mode" * Removed BackwardCapability (class \RainLoop\Account) * Removed ChangePassword (re-implemented as plugin) -* Removed OAuth support * Removed POP3 support * Removed background video support * Removed Sentry (Application Monitoring and Error Tracking Software) +* Removed Spyc yaml * Replaced gulp-uglify with gulp-terser * CRLF => LF line endings * Embed boot.js and boot.css into index.html * Ongoing removal of old JavaScript code (things are native these days) * Added modified [Squire](https://github.com/neilj/Squire) HTML editor as replacement for CKEditor * Split Admin specific JavaScript code from User code +* Split Sieve specific JavaScript code from User code * JSON reviver * Better memory garbage collection management * Added serviceworker for Notifications @@ -71,27 +72,49 @@ This fork of RainLoop has the following changes: * Replaced webpack with rollup * No user-agent detection (use device width) * Added support to load plugins as .phar +* Replaced old Sabre library +* AddressBook Contacts support MySQL/MariaDB utf8mb4 +* Prevent Google FLoC +* Added [Fetch Metadata Request Headers](https://www.w3.org/TR/fetch-metadata/) checks +* Reduced excessive DOM size +* Support [Kolab groupware](https://kolab.org/) +* Support IMAP RFC 2971 ID extension +* Support IMAP RFC 5258 LIST-EXTENDED +* Support IMAP RFC 5464 METADATA +* Support IMAP RFC 5819 LIST-STATUS +* Support IMAP RFC 7628 SASL OAUTHBEARER aka XOAUTH2 +* Support IMAP4rev2 RFC 9051 +* Support Sodium and OpenSSL for encryption +* Much better PGP support + + +### Supported browsers + +This fork uses downsized/simplified versions of scripts and has no support for Internet Explorer nor Edge Legacy. +Supported are: + +* Chrome 69+ +* Edge 79+ +* Firefox 69+ +* Opera 56+ +* Safari 12+ + ### Removal of old JavaScript -This fork uses downsized/simplified versions of scripts and has no support for Internet Explorer. - The result is faster and smaller download code (good for mobile networks). -Things might work in Edge 18, Firefox 50-62 and Chrome 54-68 due to one polyfill for array.flat(). - * Added dev/prototype.js for some additional features * boot.js without webpack overhead * Modified Jua.js to be without jQuery -* Replaced ProgressJS with simple native dropin * Replaced Autolinker with simple https/email detection * Replaced ifvisible.js with simple drop-in replacement -* Replaced momentToNode with proper HTML5