summaryrefslogtreecommitdiffstats
path: root/roles/webmail
diff options
context:
space:
mode:
Diffstat (limited to 'roles/webmail')
-rw-r--r--roles/webmail/files/etc/cron.d/roundcube-core7
-rw-r--r--roles/webmail/files/etc/nginx/sites-available/roundcube87
-rw-r--r--roles/webmail/files/etc/php/fpm/pool.d/roundcube.conf22
-rw-r--r--roles/webmail/files/etc/roundcube/plugins/additional_message_headers/config.inc.php14
-rw-r--r--roles/webmail/files/etc/roundcube/plugins/authres_status/config.inc.php6
-rw-r--r--roles/webmail/files/etc/roundcube/plugins/html5_notifier/config.inc.php6
-rw-r--r--roles/webmail/files/etc/roundcube/plugins/password/config.inc.php (renamed from roles/webmail/templates/usr/share/roundcube/plugins/password/config.inc.php.j2)193
-rw-r--r--roles/webmail/files/etc/roundcube/plugins/thunderbird_labels/config.inc.php5
-rw-r--r--roles/webmail/files/etc/systemd/system/stunnel4@ldap.socket11
-rw-r--r--roles/webmail/files/usr/share/roundcube/program/resources/fripost_logo_black.png (renamed from roles/webmail/files/var/lib/roundcube/skins/logo_webmail.png)bin6567 -> 6567 bytes
-rw-r--r--roles/webmail/files/usr/share/roundcube/program/resources/fripost_logo_white.pngbin0 -> 5454 bytes
-rw-r--r--roles/webmail/handlers/main.yml13
-rw-r--r--roles/webmail/tasks/ldap.yml36
-rw-r--r--roles/webmail/tasks/mail.yml39
-rw-r--r--roles/webmail/tasks/main.yml12
-rw-r--r--roles/webmail/tasks/roundcube.yml241
l---------roles/webmail/templates/etc/nginx/snippets/mail.fripost.org.hpkp-hdr.j21
-rw-r--r--roles/webmail/templates/etc/roundcube/plugins/managesieve/config.inc.php.j2100
-rw-r--r--roles/webmail/templates/etc/stunnel/ldap.conf.j2 (renamed from roles/webmail/templates/etc/stunnel/postfix.conf.j2)38
-rw-r--r--roles/webmail/templates/usr/share/roundcube/plugins/additional_message_headers/config.inc.php.j214
-rw-r--r--roles/webmail/templates/usr/share/roundcube/plugins/managesieve/config.inc.php.j267
21 files changed, 587 insertions, 325 deletions
diff --git a/roles/webmail/files/etc/cron.d/roundcube-core b/roles/webmail/files/etc/cron.d/roundcube-core
new file mode 100644
index 0000000..6d9e7af
--- /dev/null
+++ b/roles/webmail/files/etc/cron.d/roundcube-core
@@ -0,0 +1,7 @@
+#
+# Roundcube database cleaning: finally removes all records that are
+# marked as deleted.
+MAILTO=root
+
+# m h dom mon dow user command
+0 5 * * * _roundcube /usr/share/roundcube/bin/cleandb.sh >/dev/null
diff --git a/roles/webmail/files/etc/nginx/sites-available/roundcube b/roles/webmail/files/etc/nginx/sites-available/roundcube
index 8251841..602668f 100644
--- a/roles/webmail/files/etc/nginx/sites-available/roundcube
+++ b/roles/webmail/files/etc/nginx/sites-available/roundcube
@@ -1,73 +1,76 @@
server {
listen 80;
- listen [::]:80 ipv6only=on;
+ listen [::]:80;
- server_name mail.fripost.org;
+ server_name mail.fripost.org;
+ server_name webmail.fripost.org;
- access_log /var/log/nginx/roundcube.access.log;
- error_log /var/log/nginx/roundcube.error.log info;
+ include /etc/lacme/nginx.conf;
- return 301 https://$host$request_uri;
+ access_log /var/log/nginx/roundcube.access.log;
+ error_log /var/log/nginx/roundcube.error.log info;
+
+ location / {
+ return 301 https://$host$request_uri;
+ }
}
server {
- listen 443;
- listen [::]:443 ipv6only=on;
+ listen 443 ssl http2;
+ listen [::]:443 ssl http2;
+
+ server_name mail.fripost.org;
+ server_name webmail.fripost.org;
+
+ root /var/lib/roundcube/public_html;
- server_name mail.fripost.org;
- root /var/lib/roundcube;
+ include snippets/headers.conf;
+ add_header Content-Security-Policy
+ "default-src 'none'; frame-src 'self'; connect-src 'self'; object-src 'self'; script-src 'self' 'unsafe-inline' 'unsafe-eval'; style-src 'self' 'unsafe-inline'; img-src 'self' data: https:; font-src 'self'; frame-ancestors 'self'; form-action 'self'; base-uri mail.fripost.org webmail.fripost.org";
- include ssl/config;
- # include the intermediate certificate, see
- # - https://www.ssllabs.com/ssltest/analyze.html?d=mail.fripost.org
- # - http://nginx.org/en/docs/http/configuring_https_servers.html
- ssl_certificate /etc/nginx/ssl/mail.fripost.org.chained.pem;
- ssl_certificate_key /etc/nginx/ssl/mail.fripost.org.key;
+ include snippets/ssl.conf;
+ ssl_certificate ssl/mail.fripost.org.pem;
+ ssl_certificate_key ssl/mail.fripost.org.key;
+ include snippets/mail.fripost.org.hpkp-hdr;
+
+ gzip on;
+ gzip_static on;
+ gzip_vary on;
+ gzip_min_length 256;
+ gzip_types application/font-woff application/font-woff2 application/javascript application/json application/xml image/svg+xml image/x-icon text/css text/plain text/vcard;
location = /favicon.ico {
- root /usr/share/roundcube/skins/default/images;
+ root /usr/share/roundcube/skins/elastic/images;
log_not_found off;
access_log off;
- expires max;
}
location = /robots.txt {
allow all;
log_not_found off;
access_log off;
}
- # Deny all attempts to access hidden files, or files under hidden
- # directories.
- location ~ /\. { return 404; }
-
- access_log /var/log/nginx/roundcube.access.log;
- error_log /var/log/nginx/roundcube.error.log info;
+ access_log /var/log/nginx/roundcube.access.log;
+ error_log /var/log/nginx/roundcube.error.log info;
- index index.php;
client_max_body_size 64m;
+ location = / { index index.php; }
location = /index.php {
- include fastcgi/php;
- include fastcgi/php-ssl;
-
- # From /var/lib/roundcube/.htaccess
- fastcgi_param PHP_VALUE "upload_max_filesize=25M
- post_max_size=30M
- memory_limit=64M
- session.gc_maxlifetime=21600
- session.gc_divisor=500
- session.gc_probability=1";
- fastcgi_param PHP_ADMIN_VALUE "open_basedir=$document_root:/usr/share/roundcube:/etc/roundcube:/var/log/roundcube:/usr/share/php:/usr/share/javascript:/usr/share/tinymce:/usr/share/misc/magic
- upload_tmp_dir=$document_root/temp";
+ # TODO enable gzip for Roundcube >=1.5: it's immune to BREACH attacks once
+ # $config['session_samesite'] is set to 'Strict', see
+ # https://github.com/roundcube/roundcubemail/pull/6772
+ # https://www.sjoerdlangkemper.nl/2016/11/07/current-state-of-breach-attack/#same-site-cookies
+ gzip off;
+ include snippets/fastcgi-php-ssl.conf;
+ fastcgi_pass unix:/var/run/php/php7.4-fpm@roundcube.sock;
}
- # Security rules
- location ~ ^/(README|INSTALL|LICENSE|CHANGELOG|UPGRADING)$ {
- return 404;
- }
- location ~ ^/(bin|SQL)/ {
- return 404;
+ location ~ "^/(?:plugins|program/js|program/resources|skins)(?:/[[:alnum:]][[:alnum:]\-\._]*)+\.(?:css|eot|gif|html|ico|jpg|js|pdf|png|svg|tiff?|ttf|webp|woff2?)$" {
+ expires 30d;
+ try_files $uri =404;
}
+ location / { internal; }
}
diff --git a/roles/webmail/files/etc/php/fpm/pool.d/roundcube.conf b/roles/webmail/files/etc/php/fpm/pool.d/roundcube.conf
new file mode 100644
index 0000000..1a7a1d8
--- /dev/null
+++ b/roles/webmail/files/etc/php/fpm/pool.d/roundcube.conf
@@ -0,0 +1,22 @@
+[roundcube]
+user = _roundcube
+group = nogroup
+listen = /run/php/php7.4-fpm@roundcube.sock
+listen.owner = www-data
+listen.group = www-data
+listen.mode = 0600
+pm = dynamic
+pm.max_children = 5
+pm.start_servers = 2
+pm.min_spare_servers = 1
+pm.max_spare_servers = 3
+
+php_value[upload_max_filesize] = 25M
+php_value[post_max_size] = 30M
+php_value[memory_limit] = 64M
+php_value[session.gc_maxlifetime] = 21600
+php_value[session.gc_divisor] = 500
+php_value[session.gc_probability] = 1
+
+php_admin_value[upload_tmp_dir] = /var/lib/roundcube/temp
+php_admin_value[open_basedir] = /var/lib/roundcube:/usr/share/roundcube:/etc/roundcube:/var/log/roundcube:/usr/share/php:/usr/share/javascript:/usr/lib/nodejs:/usr/share/tinymce:/usr/share/misc/magic:/dev
diff --git a/roles/webmail/files/etc/roundcube/plugins/additional_message_headers/config.inc.php b/roles/webmail/files/etc/roundcube/plugins/additional_message_headers/config.inc.php
new file mode 100644
index 0000000..6d63284
--- /dev/null
+++ b/roles/webmail/files/etc/roundcube/plugins/additional_message_headers/config.inc.php
@@ -0,0 +1,14 @@
+<?php
+
+// $config['additional_message_headers']['X-Remote-Browser'] = $_SERVER['HTTP_USER_AGENT'];
+$config['additional_message_headers']['X-Originating-IP'] = null;
+// $config['additional_message_headers']['X-RoundCube-Server'] = $_SERVER['SERVER_ADDR'];
+
+// if( isset( $_SERVER['MACHINE_NAME'] )) {
+// $config['additional_message_headers']['X-RoundCube-Server'] .= ' (' . $_SERVER['MACHINE_NAME'] . ')';
+// }
+
+// To remove (e.g. X-Sender) message header use null value
+$config['additional_message_headers']['X-Sender'] = null;
+
+?>
diff --git a/roles/webmail/files/etc/roundcube/plugins/authres_status/config.inc.php b/roles/webmail/files/etc/roundcube/plugins/authres_status/config.inc.php
new file mode 100644
index 0000000..6d41d4f
--- /dev/null
+++ b/roles/webmail/files/etc/roundcube/plugins/authres_status/config.inc.php
@@ -0,0 +1,6 @@
+<?php
+
+$config['use_fallback_verifier'] = false;
+$config['trusted_mtas'] = array('mx1.fripost.org', 'mx2.fripost.org');
+
+?>
diff --git a/roles/webmail/files/etc/roundcube/plugins/html5_notifier/config.inc.php b/roles/webmail/files/etc/roundcube/plugins/html5_notifier/config.inc.php
new file mode 100644
index 0000000..1ec7922
--- /dev/null
+++ b/roles/webmail/files/etc/roundcube/plugins/html5_notifier/config.inc.php
@@ -0,0 +1,6 @@
+<?php
+
+$config['html5_notifier_duration'] = '3';
+$config['html5_notifier_smbox'] = '1';
+
+?>
diff --git a/roles/webmail/templates/usr/share/roundcube/plugins/password/config.inc.php.j2 b/roles/webmail/files/etc/roundcube/plugins/password/config.inc.php
index f4bdd82..e53b753 100644
--- a/roles/webmail/templates/usr/share/roundcube/plugins/password/config.inc.php.j2
+++ b/roles/webmail/files/etc/roundcube/plugins/password/config.inc.php
@@ -1,360 +1,401 @@
<?php
// Password Plugin options
// -----------------------
// A driver to use for password change. Default: "sql".
// See README file for list of supported driver names.
-$rcmail_config['password_driver'] = 'ldap_simple';
+$config['password_driver'] = 'ldap_simple';
// Determine whether current password is required to change password.
// Default: false.
-$rcmail_config['password_confirm_current'] = true;
+$config['password_confirm_current'] = true;
// Require the new password to be a certain length.
// set to blank to allow passwords of any length
-$rcmail_config['password_minimum_length'] = 12;
+$config['password_minimum_length'] = 12;
// Require the new password to contain a letter and punctuation character
// Change to false to remove this check.
-$rcmail_config['password_require_nonalpha'] = false;
+$config['password_require_nonalpha'] = false;
// Enables logging of password changes into logs/password
-$rcmail_config['password_log'] = false;
+$config['password_log'] = false;
// Comma-separated list of login exceptions for which password change
// will be not available (no Password tab in Settings)
-$rcmail_config['password_login_exceptions'] = null;
+$config['password_login_exceptions'] = null;
// Array of hosts that support password changing. Default is NULL.
// Listed hosts will feature a Password option in Settings; others will not.
// Example:
-//$rcmail_config['password_hosts'] = array('mail.example.com', 'mail2.example.org');
-$rcmail_config['password_hosts'] = null;
+//$config['password_hosts'] = array('mail.example.com', 'mail2.example.org');
+$config['password_hosts'] = null;
+
+// Enables saving the new password even if it matches the old password. Useful
+// for upgrading the stored passwords after the encryption scheme has changed.
+$config['password_force_save'] = false;
+
+// Enables forcing new users to change their password at their first login.
+$config['password_force_new_user'] = false;
// SQL Driver options
// ------------------
// PEAR database DSN for performing the query. By default
// Roundcube DB settings are used.
-$rcmail_config['password_db_dsn'] = '';
+$config['password_db_dsn'] = '';
// The SQL query used to change the password.
// The query can contain the following macros that will be expanded as follows:
// %p is replaced with the plaintext new password
// %c is replaced with the crypt version of the new password, MD5 if available
-// otherwise DES. More hash function can be enabled using the password_crypt_hash
+// otherwise DES. More hash function can be enabled using the password_crypt_hash
// configuration parameter.
// %D is replaced with the dovecotpw-crypted version of the new password
// %o is replaced with the password before the change
// %n is replaced with the hashed version of the new password
// %q is replaced with the hashed password before the change
// %h is replaced with the imap host (from the session info)
// %u is replaced with the username (from the session info)
// %l is replaced with the local part of the username
// (in case the username is an email address)
// %d is replaced with the domain part of the username
// (in case the username is an email address)
// Escaping of macros is handled by this module.
// Default: "SELECT update_passwd(%c, %u)"
-$rcmail_config['password_query'] = 'SELECT update_passwd(%c, %u)';
+$config['password_query'] = 'SELECT update_passwd(%c, %u)';
-// By default the crypt() function which is used to create the '%c'
-// parameter uses the md5 algorithm. To use different algorithms
+// By default the crypt() function which is used to create the '%c'
+// parameter uses the md5 algorithm. To use different algorithms
// you can choose between: des, md5, blowfish, sha256, sha512.
// Before using other hash functions than des or md5 please make sure
// your operating system supports the other hash functions.
-$rcmail_config['password_crypt_hash'] = 'sha512';
+$config['password_crypt_hash'] = 'sha512';
// By default domains in variables are using unicode.
// Enable this option to use punycoded names
-$rcmail_config['password_idn_ascii'] = false;
+$config['password_idn_ascii'] = false;
// Path for dovecotpw (if not in $PATH)
-// $rcmail_config['password_dovecotpw'] = '/usr/local/sbin/dovecotpw';
+// $config['password_dovecotpw'] = '/usr/local/sbin/dovecotpw';
// Dovecot method (dovecotpw -s 'method')
-$rcmail_config['password_dovecotpw_method'] = 'CRAM-MD5';
+$config['password_dovecotpw_method'] = 'CRAM-MD5';
// Enables use of password with crypt method prefix in %D, e.g. {MD5}$1$LUiMYWqx$fEkg/ggr/L6Mb2X7be4i1/
-$rcmail_config['password_dovecotpw_with_method'] = false;
+$config['password_dovecotpw_with_method'] = false;
// Using a password hash for %n and %q variables.
// Determine which hashing algorithm should be used to generate
// the hashed new and current password for using them within the
// SQL query. Requires PHP's 'hash' extension.
-$rcmail_config['password_hash_algorithm'] = 'sha1';
+$config['password_hash_algorithm'] = 'sha1';
// You can also decide whether the hash should be provided
// as hex string or in base64 encoded format.
-$rcmail_config['password_hash_base64'] = false;
+$config['password_hash_base64'] = false;
+
+// Iteration count parameter for Blowfish-based hashing algo.
+// It must be between 4 and 31. Default: 12.
+// Be aware, the higher the value, the longer it takes to generate the password hashes.
+$config['password_blowfish_cost'] = 12;
// Poppassd Driver options
// -----------------------
// The host which changes the password
-$rcmail_config['password_pop_host'] = 'localhost';
+$config['password_pop_host'] = 'localhost';
// TCP port used for poppassd connections
-$rcmail_config['password_pop_port'] = 106;
+$config['password_pop_port'] = 106;
// SASL Driver options
// -------------------
// Additional arguments for the saslpasswd2 call
-$rcmail_config['password_saslpasswd_args'] = '';
+$config['password_saslpasswd_args'] = '';
// LDAP and LDAP_SIMPLE Driver options
// -----------------------------------
-// LDAP server name to connect to.
+// LDAP server name to connect to.
// You can provide one or several hosts in an array in which case the hosts are tried from left to right.
// Exemple: array('ldap1.exemple.com', 'ldap2.exemple.com');
// Default: 'localhost'
-$rcmail_config['password_ldap_host'] = 'localhost';
+$config['password_ldap_host'] = '127.0.0.1';
// LDAP server port to connect to
// Default: '389'
-$rcmail_config['password_ldap_port'] = '389';
+$config['password_ldap_port'] = '389';
// TLS is started after connecting
// Using TLS for password modification is recommanded.
// Default: false
-$rcmail_config['password_ldap_starttls'] = false;
+$config['password_ldap_starttls'] = false;
// LDAP version
// Default: '3'
-$rcmail_config['password_ldap_version'] = '3';
+$config['password_ldap_version'] = '3';
// LDAP base name (root directory)
// Exemple: 'dc=exemple,dc=com'
-$rcmail_config['password_ldap_basedn'] = 'ou=virtual,dc=fripost,dc=org';
+$config['password_ldap_basedn'] = 'ou=virtual,dc=fripost,dc=org';
// LDAP connection method
// There is two connection method for changing a user's LDAP password.
// 'user': use user credential (recommanded, require password_confirm_current=true)
// 'admin': use admin credential (this mode require password_ldap_adminDN and password_ldap_adminPW)
// Default: 'user'
-$rcmail_config['password_ldap_method'] = 'user';
+$config['password_ldap_method'] = 'user';
// LDAP Admin DN
// Used only in admin connection mode
// Default: null
-$rcmail_config['password_ldap_adminDN'] = null;
+$config['password_ldap_adminDN'] = null;
// LDAP Admin Password
// Used only in admin connection mode
// Default: null
-$rcmail_config['password_ldap_adminPW'] = null;
+$config['password_ldap_adminPW'] = null;
// LDAP user DN mask
// The user's DN is mandatory and as we only have his login,
// we need to re-create his DN using a mask
// '%login' will be replaced by the current roundcube user's login
// '%name' will be replaced by the current roundcube user's name part
// '%domain' will be replaced by the current roundcube user's domain part
// '%dc' will be replaced by domain name hierarchal string e.g. "dc=test,dc=domain,dc=com"
// Exemple: 'uid=%login,ou=people,dc=exemple,dc=com'
-$rcmail_config['password_ldap_userDN_mask'] = 'fvl=%name,fvd=%domain,ou=virtual,dc=fripost,dc=org';
+$config['password_ldap_userDN_mask'] = 'fvl=%name,fvd=%domain,ou=virtual,dc=fripost,dc=org';
+
// LDAP search DN
// The DN roundcube should bind with to find out user's DN
// based on his login. Note that you should comment out the default
// password_ldap_userDN_mask setting for this to take effect.
// Use this if you cannot specify a general template for user DN with
// password_ldap_userDN_mask. You need to perform a search based on
// users login to find his DN instead. A common reason might be that
// your users are placed under different ou's like engineering or
// sales which cannot be derived from their login only.
-$rcmail_config['password_ldap_searchDN'] = null;
+$config['password_ldap_searchDN'] = null;
// LDAP search password
// If password_ldap_searchDN is set, the password to use for
// binding to search for user's DN. Note that you should comment out the default
// password_ldap_userDN_mask setting for this to take effect.
// Warning: Be sure to set approperiate permissions on this file so this password
// is only accesible to roundcube and don't forget to restrict roundcube's access to
// your directory as much as possible using ACLs. Should this password be compromised
// you want to minimize the damage.
-$rcmail_config['password_ldap_searchPW'] = null;
+$config['password_ldap_searchPW'] = null;
// LDAP search base
// If password_ldap_searchDN is set, the base to search in using the filter below.
// Note that you should comment out the default password_ldap_userDN_mask setting
// for this to take effect.
-$rcmail_config['password_ldap_search_base'] = null;
+$config['password_ldap_search_base'] = null;
// LDAP search filter
// If password_ldap_searchDN is set, the filter to use when
// searching for user's DN. Note that you should comment out the default
// password_ldap_userDN_mask setting for this to take effect.
// '%login' will be replaced by the current roundcube user's login
// '%name' will be replaced by the current roundcube user's name part
// '%domain' will be replaced by the current roundcube user's domain part
// '%dc' will be replaced by domain name hierarchal string e.g. "dc=test,dc=domain,dc=com"
// Example: '(uid=%login)'
// Example: '(&(objectClass=posixAccount)(uid=%login))'
-$rcmail_config['password_ldap_search_filter'] = null;
+$config['password_ldap_search_filter'] = null;
// LDAP password hash type
// Standard LDAP encryption type which must be one of: crypt,
-// ext_des, md5crypt, blowfish, md5, sha, smd5, ssha, or clear.
+// ext_des, md5crypt, blowfish, md5, sha, smd5, ssha, ad, cram-md5 (dovecot style) or clear.
// Please note that most encodage types require external libraries
// to be included in your PHP installation, see function hashPassword in drivers/ldap.php for more info.
-// Default: 'crypt'
-$rcmail_config['password_ldap_encodage'] = 'ssha';
+// Multiple password Values can be generated by concatenating encodings with a +. E.g. 'cram-md5+crypt'
+// Default: 'crypt'.
+$config['password_ldap_encodage'] = 'ssha';
// LDAP password attribute
// Name of the ldap's attribute used for storing user password
// Default: 'userPassword'
-$rcmail_config['password_ldap_pwattr'] = 'userPassword';
+$config['password_ldap_pwattr'] = 'userPassword';
// LDAP password force replace
// Force LDAP replace in cases where ACL allows only replace not read
// See http://pear.php.net/package/Net_LDAP2/docs/latest/Net_LDAP2/Net_LDAP2_Entry.html#methodreplace
// Default: true
-$rcmail_config['password_ldap_force_replace'] = true;
+$config['password_ldap_force_replace'] = true;
// LDAP Password Last Change Date
// Some places use an attribute to store the date of the last password change
// The date is meassured in "days since epoch" (an integer value)
// Whenever the password is changed, the attribute will be updated if set (e.g. shadowLastChange)
-$rcmail_config['password_ldap_lchattr'] = '';
+$config['password_ldap_lchattr'] = '';
// LDAP Samba password attribute, e.g. sambaNTPassword
// Name of the LDAP's Samba attribute used for storing user password
-$rcmail_config['password_ldap_samba_pwattr'] = '';
-
+$config['password_ldap_samba_pwattr'] = '';
+
// LDAP Samba Password Last Change Date attribute, e.g. sambaPwdLastSet
// Some places use an attribute to store the date of the last password change
// The date is meassured in "seconds since epoch" (an integer value)
// Whenever the password is changed, the attribute will be updated if set
-$rcmail_config['password_ldap_samba_lchattr'] = '';
+$config['password_ldap_samba_lchattr'] = '';
// DirectAdmin Driver options
// --------------------------
// The host which changes the password
// Use 'ssl://host' instead of 'tcp://host' when running DirectAdmin over SSL.
// The host can contain the following macros that will be expanded as follows:
// %h is replaced with the imap host (from the session info)
// %d is replaced with the domain part of the username (if the username is an email)
-$rcmail_config['password_directadmin_host'] = 'tcp://localhost';
+$config['password_directadmin_host'] = 'tcp://localhost';
// TCP port used for DirectAdmin connections
-$rcmail_config['password_directadmin_port'] = 2222;
+$config['password_directadmin_port'] = 2222;
// vpopmaild Driver options
// -----------------------
// The host which changes the password
-$rcmail_config['password_vpopmaild_host'] = 'localhost';
+$config['password_vpopmaild_host'] = 'localhost';
// TCP port used for vpopmaild connections
-$rcmail_config['password_vpopmaild_port'] = 89;
+$config['password_vpopmaild_port'] = 89;
+
+// Timout used for the connection to vpopmaild (in seconds)
+$config['password_vpopmaild_timeout'] = 10;
// cPanel Driver options
// --------------------------
// The cPanel Host name
-$rcmail_config['password_cpanel_host'] = 'host.domain.com';
+$config['password_cpanel_host'] = 'host.domain.com';
// The cPanel admin username
-$rcmail_config['password_cpanel_username'] = 'username';
+$config['password_cpanel_username'] = 'username';
// The cPanel admin password
-$rcmail_config['password_cpanel_password'] = 'password';
+$config['password_cpanel_password'] = 'password';
// The cPanel port to use
-$rcmail_config['password_cpanel_port'] = 2082;
-
-// Using ssl for cPanel connections?
-$rcmail_config['password_cpanel_ssl'] = true;
-
-// The cPanel theme in use
-$rcmail_config['password_cpanel_theme'] = 'x';
+$config['password_cpanel_port'] = 2087;
// XIMSS (Communigate server) Driver options
// -----------------------------------------
// Host name of the Communigate server
-$rcmail_config['password_ximss_host'] = 'mail.example.com';
+$config['password_ximss_host'] = 'mail.example.com';
// XIMSS port on Communigate server
-$rcmail_config['password_ximss_port'] = 11024;
+$config['password_ximss_port'] = 11024;
// chpasswd Driver options
// ---------------------
// Command to use
-$rcmail_config['password_chpasswd_cmd'] = 'sudo /usr/sbin/chpasswd 2> /dev/null';
+$config['password_chpasswd_cmd'] = 'sudo /usr/sbin/chpasswd 2> /dev/null';
// XMail Driver options
// ---------------------
-$rcmail_config['xmail_host'] = 'localhost';
-$rcmail_config['xmail_user'] = 'YourXmailControlUser';
-$rcmail_config['xmail_pass'] = 'YourXmailControlPass';
-$rcmail_config['xmail_port'] = 6017;
+$config['xmail_host'] = 'localhost';
+$config['xmail_user'] = 'YourXmailControlUser';
+$config['xmail_pass'] = 'YourXmailControlPass';
+$config['xmail_port'] = 6017;
// hMail Driver options
// -----------------------
// Remote hMailServer configuration
// true: HMailserver is on a remote box (php.ini: com.allow_dcom = true)
// false: Hmailserver is on same box as PHP
-$rcmail_config['hmailserver_remote_dcom'] = false;
+$config['hmailserver_remote_dcom'] = false;
// Windows credentials
-$rcmail_config['hmailserver_server'] = array(
+$config['hmailserver_server'] = array(
'Server' => 'localhost', // hostname or ip address
'Username' => 'administrator', // windows username
'Password' => 'password' // windows user password
);
// Virtualmin Driver options
// -------------------------
// Username format:
// 0: username@domain
// 1: username%domain
// 2: username.domain
// 3: domain.username
// 4: username-domain
// 5: domain-username
// 6: username_domain
// 7: domain_username
$config['password_virtualmin_format'] = 0;
// pw_usermod Driver options
// --------------------------
// Use comma delimited exlist to disable password change for users
// Add the following line to visudo to tighten security:
// www ALL=NOPASSWORD: /usr/sbin/pw
-$rcmail_config['password_pw_usermod_cmd'] = 'sudo /usr/sbin/pw usermod -h 0 -n';
+$config['password_pw_usermod_cmd'] = 'sudo /usr/sbin/pw usermod -h 0 -n';
// DBMail Driver options
// -------------------
// Additional arguments for the dbmail-users call
-$rcmail_config['password_dbmail_args'] = '-p sha512';
+$config['password_dbmail_args'] = '-p sha512';
// Expect Driver options
// ---------------------
// Location of expect binary
-$rcmail_config['password_expect_bin'] = '/usr/bin/expect';
+$config['password_expect_bin'] = '/usr/bin/expect';
// Location of expect script (see helpers/passwd-expect)
-$rcmail_config['password_expect_script'] = '';
+$config['password_expect_script'] = '';
// Arguments for the expect script. See the helpers/passwd-expect file for details.
// This is probably a good starting default:
// -telent -host localhost -output /tmp/passwd.log -log /tmp/passwd.log
-$rcmail_config['password_expect_params'] = '';
+$config['password_expect_params'] = '';
// smb Driver options
// ---------------------
// Samba host (default: localhost)
-$rcmail_config['password_smb_host'] = 'localhost';
+// Supported replacement variables:
+// %n - hostname ($_SERVER['SERVER_NAME'])
+// %t - hostname without the first part
+// %d - domain (http hostname $_SERVER['HTTP_HOST'] without the first part)
+$config['password_smb_host'] = 'localhost';
// Location of smbpasswd binary
-$rcmail_config['password_smb_cmd'] = '/usr/bin/smbpasswd';
+$config['password_smb_cmd'] = '/usr/bin/smbpasswd';
+
+// gearman driver options
+// ---------------------
+// Gearman host (default: localhost)
+$config['password_gearman_host'] = 'localhost';
+
+
+
+// Plesk/PPA Driver options
+// --------------------
+// You need to allow RCP for IP of roundcube-server in Plesk/PPA Panel
+
+// Plesk RCP Host
+$config['password_plesk_host'] = '10.0.0.5';
+
+// Plesk RPC Username
+$config['password_plesk_user'] = 'admin';
+
+// Plesk RPC Password
+$config['password_plesk_pass'] = 'password';
+
+// Plesk RPC Port
+$config['password_plesk_rpc_port'] = '8443';
+
+// Plesk RPC Path
+$config['password_plesk_rpc_path'] = 'enterprise/control/agent.php';
diff --git a/roles/webmail/files/etc/roundcube/plugins/thunderbird_labels/config.inc.php b/roles/webmail/files/etc/roundcube/plugins/thunderbird_labels/config.inc.php
new file mode 100644
index 0000000..2abb423
--- /dev/null
+++ b/roles/webmail/files/etc/roundcube/plugins/thunderbird_labels/config.inc.php
@@ -0,0 +1,5 @@
+<?php
+
+$rcmail_config['tb_label_enable'] = true;
+
+?>
diff --git a/roles/webmail/files/etc/systemd/system/stunnel4@ldap.socket b/roles/webmail/files/etc/systemd/system/stunnel4@ldap.socket
new file mode 100644
index 0000000..72aa82c
--- /dev/null
+++ b/roles/webmail/files/etc/systemd/system/stunnel4@ldap.socket
@@ -0,0 +1,11 @@
+[Unit]
+Description=SSL tunnel for network daemons (instance %i)
+Documentation=man:stunnel4(8)
+
+[Socket]
+BindToDevice=lo
+ListenStream=127.0.0.1:389
+NoDelay=yes
+
+[Install]
+WantedBy=sockets.target
diff --git a/roles/webmail/files/var/lib/roundcube/skins/logo_webmail.png b/roles/webmail/files/usr/share/roundcube/program/resources/fripost_logo_black.png
index 7af586a..7af586a 100644
--- a/roles/webmail/files/var/lib/roundcube/skins/logo_webmail.png
+++ b/roles/webmail/files/usr/share/roundcube/program/resources/fripost_logo_black.png
Binary files differ
diff --git a/roles/webmail/files/usr/share/roundcube/program/resources/fripost_logo_white.png b/roles/webmail/files/usr/share/roundcube/program/resources/fripost_logo_white.png
new file mode 100644
index 0000000..c581a30
--- /dev/null
+++ b/roles/webmail/files/usr/share/roundcube/program/resources/fripost_logo_white.png
Binary files differ
diff --git a/roles/webmail/handlers/main.yml b/roles/webmail/handlers/main.yml
index f7e403e..8c70168 100644
--- a/roles/webmail/handlers/main.yml
+++ b/roles/webmail/handlers/main.yml
@@ -1,6 +1,15 @@
---
-- name: Restart stunnel
- service: name=stunnel4 pattern=/usr/bin/stunnel4 state=restarted
+- name: Restart stunnel@ldap
+ service: name=stunnel4@ldap state=restarted
+
+- name: Restart php7.4-fpm
+ service: name=php7.4-fpm state=restarted
- name: Restart Nginx
service: name=nginx state=restarted
+
+- name: Stop stunnel4@ldap.service
+ service: name=stunnel4@ldap.service state=stopped
+
+- name: Restart stunnel4@ldap.socket
+ service: name=stunnel4@ldap.socket state=restarted
diff --git a/roles/webmail/tasks/ldap.yml b/roles/webmail/tasks/ldap.yml
new file mode 100644
index 0000000..f0b461c
--- /dev/null
+++ b/roles/webmail/tasks/ldap.yml
@@ -0,0 +1,36 @@
+- name: Copy stunnel4@ldap.socket
+ copy: src=etc/systemd/system/stunnel4@ldap.socket
+ dest=/etc/systemd/system/stunnel4@ldap.socket
+ owner=root group=root
+ mode=0644
+ notify:
+ - systemctl daemon-reload
+ - Restart stunnel4@ldap.socket
+
+- name: Create /etc/stunnel/certs
+ file: path=/etc/stunnel/certs
+ state=directory
+ owner=root group=root
+ mode=0755
+
+- name: Copy the slapd X.509 certificate
+ copy: src=certs/ldap/ldap.fripost.org.pem
+ dest=/etc/stunnel/certs/ldap.pem
+ owner=root group=root
+ mode=0644
+ notify:
+ - Stop stunnel4@ldap.service
+
+- name: Configure stunnel
+ template: src=etc/stunnel/ldap.conf.j2
+ dest=/etc/stunnel/ldap.conf
+ owner=root group=root
+ mode=0644
+ notify:
+ - Stop stunnel4@ldap.service
+
+- name: Disable stunnel4@ldap.service
+ service: name=stunnel4@ldap.service enabled=false
+
+- name: Start stunnel4@ldap.socket socket
+ service: name=stunnel4@ldap.socket state=started enabled=true
diff --git a/roles/webmail/tasks/mail.yml b/roles/webmail/tasks/mail.yml
deleted file mode 100644
index 7603a56..0000000
--- a/roles/webmail/tasks/mail.yml
+++ /dev/null
@@ -1,39 +0,0 @@
-- name: Install stunnel
- apt: pkg=stunnel4
-
-- name: Auto-enable stunnel
- lineinfile: dest=/etc/default/stunnel4
- regexp='^(\s*#)?\s*ENABLED='
- line='ENABLED=1'
- owner=root group=root
- mode=0644
-
-- name: Create /etc/stunnel/certs
- file: path=/etc/stunnel/certs
- state=directory
- owner=root group=root
- mode=0755
-
-- name: Copy the SMTP outgoing proxy's X.509 certificate
- assemble: src=certs/postfix regexp="{{ groups.out | difference([inventory_hostname]) | join('|') }}\.pem$" remote_src=no
- dest=/etc/stunnel/certs/postfix.pem
- owner=root group=root
- mode=0644
- register: r1
- notify:
- - Restart stunnel
-
-- name: Configure stunnel
- template: src=etc/stunnel/postfix.conf.j2
- dest=/etc/stunnel/postfix.conf
- owner=root group=root
- mode=0644
- register: r2
- notify:
- - Restart stunnel
-
-- name: Start stunnel
- service: name=stunnel4 pattern=/usr/bin/stunnel4 state=started
- when: not (r1.changed or r2.changed)
-
-- meta: flush_handlers
diff --git a/roles/webmail/tasks/main.yml b/roles/webmail/tasks/main.yml
index 030a547..146c36f 100644
--- a/roles/webmail/tasks/main.yml
+++ b/roles/webmail/tasks/main.yml
@@ -1,3 +1,9 @@
-- include: mail.yml tags=postfix,mail
- when: "'out' not in group_names"
-- include: roundcube.yml tags=roundcube,webmail
+- import_tasks: ldap.yml
+ when: "'LDAP_provider' not in group_names"
+ tags:
+ - ldap
+ - stunnel
+- import_tasks: roundcube.yml
+ tags:
+ - roundcube
+ - webmail
diff --git a/roles/webmail/tasks/roundcube.yml b/roles/webmail/tasks/roundcube.yml
index 5392242..bd174bc 100644
--- a/roles/webmail/tasks/roundcube.yml
+++ b/roles/webmail/tasks/roundcube.yml
@@ -1,117 +1,246 @@
- name: Install PHP
- apt: pkg={{ item }}
+ apt: pkg={{ packages }}
+ vars:
+ packages:
+ - php-fpm
+ - php-ldap
+ - php-gd
+ - php
+ # spell-checking
+ - php-enchant
+
+## TODO: run php as a dedicated system user
+- name: Configure PHP 7.4 Zend opcache
+ lineinfile: dest=/etc/php/7.4/fpm/php.ini
+ regexp='^;?{{ item.var }}\\s*='
+ line="{{ item.var }} = {{ item.value }}"
+ owner=root group=root
+ mode=0644
with_items:
- - php5-fpm
- - php5-ldap
- - php5-gd
- - php5-pspell
+ - { var: opcache.memory_consumption, value: 128 }
+ - { var: opcache.revalidate_freq, value: 60 }
+ notify:
+ - Restart php7.4-fpm
+
+- name: Create '_roundcube' user
+ user: name=_roundcube system=yes
+ group=nogroup
+ createhome=no
+ home=/nonexistent
+ shell=/usr/sbin/nologin
+ password=!
+ state=present
+
+- name: Delete PHP 7.4 FPM's www pool
+ file: path=/etc/php/7.4/fpm/pool.d/www.conf state=absent
+ notify:
+ - Restart php7.4-fpm
+
+- name: Configure PHP 7.4 FPM's roundcube pool
+ copy: src=etc/php/fpm/pool.d/roundcube.conf
+ dest=/etc/php/7.4/fpm/pool.d/roundcube.conf
+ owner=root group=root
+ mode=0644
+ notify:
+ - Restart php7.4-fpm
+
+- name: Start php7.4-fpm
+ service: name=php7.4-fpm state=started
+
+# Make it sticky: `dpkg-statoverride --add _roundcube nogroup 0700 /var/lib/roundcube/temp`
+- name: Create cache directory /var/lib/roundcube/temp
+ file: path=/var/lib/roundcube/temp
+ state=directory
+ owner=_roundcube group=nogroup
+ mode=0700
+
+# Make it sticky: `dpkg-statoverride --add _roundcube adm 0750 /var/log/roundcube`
+- name: Create cache directory /var/log/roundcube
+ file: path=/var/log/roundcube
+ state=directory
+ owner=_roundcube group=adm
+ mode=0750
+
+- name: Install GNU Aspell and some dictionaries
+ apt: pkg={{ packages }}
+ vars:
+ packages:
+ - aspell
+ - aspell-da
+ - aspell-de
+ - aspell-en
+ - aspell-es
+ - aspell-fr
+ - aspell-no
+ - aspell-sv
- name: Install Roundcube
- apt: pkg={{ item }} default_release={{ ansible_lsb.codename }}-backports
- with_items:
+ apt: pkg={{ packages }}
+ vars:
+ packages:
- roundcube-core
- roundcube-mysql
- roundcube-plugins
+ - roundcube-plugins-extra
+
+- name: Install plugin dependencies
+ apt: pkg={{ packages }}
+ vars:
+ packages:
+ - php-net-sieve
- name: Copy fripost's logo
- copy: src=var/lib/roundcube/skins/logo_webmail.png
- dest=/var/lib/roundcube/skins/logo_webmail.png
+ copy: src=usr/share/roundcube/program/resources/{{ item }}
+ dest=/usr/share/roundcube/program/resources/{{ item }}
owner=root group=root
mode=0644
+ with_items:
+ - fripost_logo_black.png
+ - fripost_logo_white.png
- name: Configure Roundcube
- lineinfile: dest=/etc/roundcube/main.inc.php
- "regexp=^\\s*\\$rcmail_config\\['{{ item.var }}'\\]\\s*="
- "line=$rcmail_config['{{ item.var }}'] = {{ item.value }};"
- owner=root group=www-data
- mode=0640
+ lineinfile: dest=/etc/roundcube/config.inc.php
+ regexp='^\\s*\\$config\\[\'{{ item.var }}\'\\]\\s*='
+ line='$config[\'{{ item.var }}\'] = {{ item.value }};'
+ owner=_roundcube group=nogroup
+ mode=0600
with_items:
# Logging/Debugging
- - { var: smtp_log, value: "FALSE" }
+ - { var: smtp_log, value: "false" }
# IMAP
- - { var: default_host, value: "'localhost'" }
- - { var: default_port, value: "143" }
- - { var: imap_auth_type, value: "'plain'" }
- - { var: imap_cache, value: "null" }
- - { var: messages_cache, value: "null" }
+ # WARNING: After hostname change update of mail_host column in users
+ # table is required to match old user data records with the new host.
+ - { var: default_host, value: "'{{ imapsvr_addr | ansible.utils.ipaddr }}'" }
+ - { var: default_port, value: "143" }
+ - { var: imap_auth_type, value: "'PLAIN'" }
+ - { var: imap_cache, value: "null" }
+ - { var: imap_timeout, value: "180" }
+ - { var: imap_force_ns, value: "true" }
+ - { var: messages_cache, value: "false" }
# SMTP
- - { var: smtp_server, value: "'localhost'" }
- - { var: smtp_port, value: "2525" }
+ - { var: smtp_server, value: "'{{ postfix_instance.MSA.addr | ansible.utils.ipaddr }}'" }
+ - { var: smtp_port, value: "{{ postfix_instance.MSA.port }}" }
+ - { var: smtp_auth_type, value: "'PLAIN'" }
+ - { var: smtp_user, value: "'%u'" }
+ - { var: smtp_pass, value: "'%p'" }
+ # avoid timeout
+ - { var: max_recipients, value: "15" }
# System
- - { var: force_https, value: "TRUE" }
- - { var: login_autocomplete, value: "2" }
- - { var: skin_logo, value: "'skins/logo_webmail.png'" }
- - { var: username_domain, value: "'fripost.org'" }
- - { var: product_name, value: "'Fripost'" }
+ - { var: force_https, value: "true" }
+ - { var: login_autocomplete, value: "2" }
+ - { var: username_domain, value: "'fripost.org'" }
+ - { var: product_name, value: "'Fripost Webmail'" }
+ - { var: password_charset, value: "'UTF-8'" }
+ - { var: skin_logo, value: 'array("classic:*" => "program/resources/fripost_logo_black.png", "larry:*" => "program/resources/fripost_logo_white.png", "elastic:login[favicon]" => "", "elastic:login" => "program/resources/fripost_logo_black.png")' }
# Plugins
- - { var: plugins, value: "array('additional_message_headers','managesieve','password')" }
+ - { var: plugins, value: "array('archive','additional_message_headers','attachment_reminder','authres_status','emoticons','hide_blockquote','html5_notifier','managesieve','password','thunderbird_labels','vcard_attachments')" }
+ # Spell Checking
+ - { var: enable_spellcheck, value: "'true'" }
+ - { var: spellcheck_engine, value: "'enchant'" }
+ - { var: spellcheck_languages, value: "array('da','de','en','es','fr','no','sv')" }
# User Interface
- - { var: skin, value: "'classic'" }
- - { var: language, value: "'sv_SE'" }
- - { var: create_default_folders, value: "TRUE" }
+ - { var: skin, value: "'elastic'" }
+ - { var: language, value: "'sv_SE'" }
+ - { var: create_default_folders, value: "true" }
+ - { var: support_url, value: "'https://fripost.org/kontakt/'" }
# User Preferences
- - { var: htmleditor, value: "TRUE" }
- - { var: skip_deleted, value: "TRUE" }
- - { var: check_all_folders, value: "FALSE" }
+ - { var: htmleditor, value: "3" }
+ - { var: skip_deleted, value: "true" }
+ - { var: check_all_folders, value: "false" }
+ - { var: hide_blockquote_limit, value: "8" }
+ - { var: attachment_reminder, value: "true" }
+ # Don't allow overriding these settings
+ - { var: dont_override, value: "array('use_fallback_verifier', 'trusted_mtas')" }
- name: Make the logo a hyperlink to the website
lineinfile: dest=/usr/share/roundcube/skins/{{ item }}/templates/login.html
- regexp='^(<roundcube:object name="logo" src="/images/roundcube_logo.png"[^>]* />)$'
- line='<a href="https://fripost.org">\1</a>'
+ regexp='^(\s*)(<roundcube:object name="logo" src="[^"]*"[^>]* />)'
+ line='\1<a href="https://fripost.org">\2</a>'
backrefs=yes
owner=root group=root
mode=0644
with_items:
- classic
- larry
+ - elastic
- name: Configure Roundcube plugins
- template: src=usr/share/roundcube/plugins/{{ item }}/config.inc.php.j2
- dest=/usr/share/roundcube/plugins/{{ item }}/config.inc.php
+ copy: src=etc/roundcube/plugins/{{ item }}/config.inc.php
+ dest=/etc/roundcube/plugins/{{ item }}/config.inc.php
+ owner=root group=root
+ mode=0644
+ with_items:
+ - additional_message_headers
+ - authres_status
+ - password
+ - html5_notifier
+ - thunderbird_labels
+
+- name: Configure Roundcube plugins (2)
+ template: src=etc/roundcube/plugins/{{ item }}/config.inc.php.j2
+ dest=/etc/roundcube/plugins/{{ item }}/config.inc.php
owner=root group=root
mode=0644
with_items:
- - additional_message_headers
- managesieve
- - password
-- name: Start php5-fpm
- service: name=php5-fpm state=started
+- name: Start php7.4-fpm
+ service: name=php7.4-fpm state=started
-- name: Generate a private key and a X.509 certificate for Nginx
- command: genkeypair.sh x509
- --pubkey=/etc/nginx/ssl/mail.fripost.org.pem
- --privkey=/etc/nginx/ssl/mail.fripost.org.key
- --ou=WWW --cn=mail.fripost.org --dns=mail.fripost.org
- -t rsa -b 4096 -h sha512
- register: r1
- changed_when: r1.rc == 0
- failed_when: r1.rc > 1
- notify:
- - Restart Nginx
- tags:
- - genkey
+- name: Copy /etc/cron.d/roundcube-core
+ copy: src=etc/cron.d/roundcube-core
+ dest=/etc/cron.d/roundcube-core
+ owner=root group=root
+ mode=0644
+
+- name: Tweak /etc/logrotate.d/roundcube-core
+ lineinfile: dest=/etc/logrotate.d/roundcube-core
+ regexp='^(\s*)create\s+[0-9]+\s+\S+\s+adm$'
+ backrefs=yes
+ line='\1create 0640 _roundcube adm'
+ owner=root group=root
+ mode=0644
- name: Copy /etc/nginx/sites-available/roundcube
copy: src=etc/nginx/sites-available/roundcube
dest=/etc/nginx/sites-available/roundcube
owner=root group=root
mode=0644
- register: r2
+ register: r1
notify:
- Restart Nginx
- name: Create /etc/nginx/sites-enabled/roundcube
file: src=../sites-available/roundcube
dest=/etc/nginx/sites-enabled/roundcube
owner=root group=root
state=link force=yes
+ register: r2
+ notify:
+ - Restart Nginx
+
+- name: Copy HPKP header snippet
+ # never modify the pined pubkeys as we don't want to lock out our users
+ template: src=etc/nginx/snippets/mail.fripost.org.hpkp-hdr.j2
+ dest=/etc/nginx/snippets/mail.fripost.org.hpkp-hdr
+ validate=/bin/false
+ owner=root group=root
+ mode=0644
register: r3
notify:
- Restart Nginx
- name: Start Nginx
service: name=nginx state=started
when: not (r1.changed or r2.changed or r3.changed)
- meta: flush_handlers
+
+- name: Fetch Nginx's X.509 certificate
+ # Ensure we don't fetch private data
+ become: False
+ fetch_cmd: cmd="openssl x509 -noout -pubkey"
+ stdin=/etc/nginx/ssl/mail.fripost.org.pem
+ dest=certs/public/mail.fripost.org.pub
+ tags:
+ - genkey
diff --git a/roles/webmail/templates/etc/nginx/snippets/mail.fripost.org.hpkp-hdr.j2 b/roles/webmail/templates/etc/nginx/snippets/mail.fripost.org.hpkp-hdr.j2
new file mode 120000
index 0000000..a8ba598
--- /dev/null
+++ b/roles/webmail/templates/etc/nginx/snippets/mail.fripost.org.hpkp-hdr.j2
@@ -0,0 +1 @@
+../../../../../../certs/hpkp-hdr.j2 \ No newline at end of file
diff --git a/roles/webmail/templates/etc/roundcube/plugins/managesieve/config.inc.php.j2 b/roles/webmail/templates/etc/roundcube/plugins/managesieve/config.inc.php.j2
new file mode 100644
index 0000000..7b424e4
--- /dev/null
+++ b/roles/webmail/templates/etc/roundcube/plugins/managesieve/config.inc.php.j2
@@ -0,0 +1,100 @@
+<?php
+
+// managesieve server port. When empty the port will be determined automatically
+// using getservbyname() function, with 4190 as a fallback.
+$config['managesieve_port'] = 4190;
+
+// managesieve server address, default is localhost.
+// Replacement variables supported in host name:
+// %h - user's IMAP hostname
+// %n - http hostname ($_SERVER['SERVER_NAME'])
+// %d - domain (http hostname without the first part)
+// For example %n = mail.domain.tld, %d = domain.tld
+$config['managesieve_host'] = '{{ imapsvr_addr | ansible.utils.ipaddr }}';
+
+// authentication method. Can be CRAM-MD5, DIGEST-MD5, PLAIN, LOGIN, EXTERNAL
+// or none. Optional, defaults to best method supported by server.
+$config['managesieve_auth_type'] = 'PLAIN';
+
+// Optional managesieve authentication identifier to be used as authorization proxy.
+// Authenticate as a different user but act on behalf of the logged in user.
+// Works with PLAIN and DIGEST-MD5 auth.
+$config['managesieve_auth_cid'] = null;
+
+// Optional managesieve authentication password to be used for imap_auth_cid
+$config['managesieve_auth_pw'] = null;
+
+// use or not TLS for managesieve server connection
+// Note: tls:// prefix in managesieve_host is also supported
+$config['managesieve_usetls'] = false;
+
+// Connection scket context options
+// See http://php.net/manual/en/context.ssl.php
+// The example below enables server certificate validation
+//$config['managesieve_conn_options'] = array(
+// 'ssl' => array(
+// 'verify_peer' => true,
+// 'verify_depth' => 3,
+// 'cafile' => '/etc/openssl/certs/ca.crt',
+// ),
+// );
+$config['managesieve_conn_options'] = null;
+
+// default contents of filters script (eg. default spam filter)
+$config['managesieve_default'] = '/etc/dovecot/sieve/global';
+
+// The name of the script which will be used when there's no user script
+$config['managesieve_script_name'] = 'managesieve';
+
+// Sieve RFC says that we should use UTF-8 endcoding for mailbox names,
+// but some implementations does not covert UTF-8 to modified UTF-7.
+// Defaults to UTF7-IMAP
+$config['managesieve_mbox_encoding'] = 'UTF-8';
+
+// I need this because my dovecot (with listescape plugin) uses
+// ':' delimiter, but creates folders with dot delimiter
+$config['managesieve_replace_delimiter'] = '';
+
+// disabled sieve extensions (body, copy, date, editheader, encoded-character,
+// envelope, environment, ereject, fileinto, ihave, imap4flags, index,
+// mailbox, mboxmetadata, regex, reject, relational, servermetadata,
+// spamtest, spamtestplus, subaddress, vacation, variables, virustest, etc.
+// Note: not all extensions are implemented
+$config['managesieve_disabled_extensions'] = array('reject','ereject');
+
+// Enables debugging of conversation with sieve server. Logs it into <log_dir>/sieve
+$config['managesieve_debug'] = false;
+
+// Enables features described in http://wiki.kolab.org/KEP:14
+$config['managesieve_kolab_master'] = false;
+
+// Script name extension used for scripts including. Dovecot uses '.sieve',
+// Cyrus uses '.siv'. Doesn't matter if you have managesieve_kolab_master disabled.
+$config['managesieve_filename_extension'] = '.sieve';
+
+// List of reserved script names (without extension).
+// Scripts listed here will be not presented to the user.
+$config['managesieve_filename_exceptions'] = array();
+
+// List of domains limiting destination emails in redirect action
+// If not empty, user will need to select domain from a list
+$config['managesieve_domains'] = array();
+
+// Enables separate management interface for vacation responses (out-of-office)
+// 0 - no separate section (default),
+// 1 - add Vacation section,
+// 2 - add Vacation section, but hide Filters section
+$config['managesieve_vacation'] = 0;
+
+// Default vacation interval (in days).
+// Note: If server supports vacation-seconds extension it is possible
+// to define interval in seconds here (as a string), e.g. "3600s".
+$config['managesieve_vacation_interval'] = 0;
+
+// Some servers require vacation :addresses to be filled with all
+// user addresses (aliases). This option enables automatic filling
+// of these on initial vacation form creation.
+$config['managesieve_vacation_addresses_init'] = false;
+
+// Supported methods of notify extension. Default: 'mailto'
+$config['managesieve_notify_methods'] = array('mailto');
diff --git a/roles/webmail/templates/etc/stunnel/postfix.conf.j2 b/roles/webmail/templates/etc/stunnel/ldap.conf.j2
index 78922c8..6fce2bc 100644
--- a/roles/webmail/templates/etc/stunnel/postfix.conf.j2
+++ b/roles/webmail/templates/etc/stunnel/ldap.conf.j2
@@ -1,55 +1,41 @@
; **************************************************************************
; * Global options *
; **************************************************************************
-; setuid()/setgid() to the specified user/group in daemon mode
-setuid = stunnel4
-setgid = stunnel4
-
-; PID is created inside the chroot jail
-pid = /var/run/stunnel4/postfix.pid
+pid =
+foreground = yes
; Only log messages at severity warning (4) and higher
debug = 4
; **************************************************************************
; * Service defaults may also be specified in individual service sections *
; **************************************************************************
-; Certificate/key is needed in server mode and optional in client mode
-cert = /etc/postfix/ssl/{{ ansible_fqdn }}.pem
-key = /etc/postfix/ssl/{{ ansible_fqdn }}.key
client = yes
-socket = a:SO_BINDTODEVICE=lo
; Some performance tunings
-socket = l:TCP_NODELAY=1
socket = r:TCP_NODELAY=1
; Prevent MITM attacks
-verify = 4
+verifyPeer = yes
; Disable support for insecure protocols
-options = NO_SSLv2
-options = NO_SSLv3
-options = NO_TLSv1
-options = NO_TLSv1.1
-
-; These options provide additional security at some performance degradation
-options = SINGLE_ECDH_USE
-options = SINGLE_DH_USE
+sslVersionMin = TLSv1.2
+options = NO_COMPRESSION
; Select permitted SSL ciphers
-ciphers = EECDH+AES:EDH+AES:!MEDIUM:!LOW:!EXP:!aNULL:!eNULL:!SSLv2:!SSLv3:!TLSv1:!TLSv1.1
+ciphers = EECDH+AESGCM:EECDH+CHACHA20!MEDIUM!LOW!EXP!aNULL!eNULL
; **************************************************************************
; * Service definitions (remove all services for inetd mode) *
; **************************************************************************
-[smtp]
-accept = localhost:2525
-connect = outgoing.fripost.org:{{ postfix_instance.out.port }}
-CAfile = /etc/stunnel/certs/postfix.pem
-protocol = smtp
+[ldaps]
+; dummy address (socket-activated)
+accept = 127.0.0.1:0
+connect = {{ ipsec[ hostvars[groups.LDAP_provider[0]].inventory_hostname_short ] }}:636
+checkHost = ldap.fripost.org
+CAfile = /etc/stunnel/certs/ldap.pem
; vim:ft=dosini
diff --git a/roles/webmail/templates/usr/share/roundcube/plugins/additional_message_headers/config.inc.php.j2 b/roles/webmail/templates/usr/share/roundcube/plugins/additional_message_headers/config.inc.php.j2
deleted file mode 100644
index e9d0d3d..0000000
--- a/roles/webmail/templates/usr/share/roundcube/plugins/additional_message_headers/config.inc.php.j2
+++ /dev/null
@@ -1,14 +0,0 @@
-<?php
-
-// $rcmail_config['additional_message_headers']['X-Remote-Browser'] = $_SERVER['HTTP_USER_AGENT'];
-$rcmail_config['additional_message_headers']['X-Originating-IP'] = null;
-// $rcmail_config['additional_message_headers']['X-RoundCube-Server'] = $_SERVER['SERVER_ADDR'];
-
-// if( isset( $_SERVER['MACHINE_NAME'] )) {
-// $rcmail_config['additional_message_headers']['X-RoundCube-Server'] .= ' (' . $_SERVER['MACHINE_NAME'] . ')';
-// }
-
-// To remove (e.g. X-Sender) message header use null value
-$rcmail_config['additional_message_headers']['X-Sender'] = null;
-
-?>
diff --git a/roles/webmail/templates/usr/share/roundcube/plugins/managesieve/config.inc.php.j2 b/roles/webmail/templates/usr/share/roundcube/plugins/managesieve/config.inc.php.j2
deleted file mode 100644
index d88a09a..0000000
--- a/roles/webmail/templates/usr/share/roundcube/plugins/managesieve/config.inc.php.j2
+++ /dev/null
@@ -1,67 +0,0 @@
-<?php
-
-// managesieve server port
-$rcmail_config['managesieve_port'] = 4190;
-
-// managesieve server address, default is localhost.
-// Replacement variables supported in host name:
-// %h - user's IMAP hostname
-// %n - http hostname ($_SERVER['SERVER_NAME'])
-// %d - domain (http hostname without the first part)
-// For example %n = mail.domain.tld, %d = domain.tld
-$rcmail_config['managesieve_host'] = 'imap.fripost.org';
-
-// authentication method. Can be CRAM-MD5, DIGEST-MD5, PLAIN, LOGIN, EXTERNAL
-// or none. Optional, defaults to best method supported by server.
-$rcmail_config['managesieve_auth_type'] = 'PLAIN';
-
-// Optional managesieve authentication identifier to be used as authorization proxy.
-// Authenticate as a different user but act on behalf of the logged in user.
-// Works with PLAIN and DIGEST-MD5 auth.
-$rcmail_config['managesieve_auth_cid'] = null;
-
-// Optional managesieve authentication password to be used for imap_auth_cid
-$rcmail_config['managesieve_auth_pw'] = null;
-
-// use or not TLS for managesieve server connection
-// it's because I've problems with TLS and dovecot's managesieve plugin
-// and it's not needed on localhost
-$rcmail_config['managesieve_usetls'] = TRUE;
-
-// default contents of filters script (eg. default spam filter)
-$rcmail_config['managesieve_default'] = '/etc/dovecot/sieve/global';
-
-// The name of the script which will be used when there's no user script
-$rcmail_config['managesieve_script_name'] = 'managesieve';
-
-// Sieve RFC says that we should use UTF-8 endcoding for mailbox names,
-// but some implementations does not covert UTF-8 to modified UTF-7.
-// Defaults to UTF7-IMAP
-$rcmail_config['managesieve_mbox_encoding'] = 'UTF-8';
-
-// I need this because my dovecot (with listescape plugin) uses
-// ':' delimiter, but creates folders with dot delimiter
-$rcmail_config['managesieve_replace_delimiter'] = '';
-
-// disabled sieve extensions (body, copy, date, editheader, encoded-character,
-// envelope, environment, ereject, fileinto, ihave, imap4flags, index,
-// mailbox, mboxmetadata, regex, reject, relational, servermetadata,
-// spamtest, spamtestplus, subaddress, vacation, variables, virustest, etc.
-// Note: not all extensions are implemented
-$rcmail_config['managesieve_disabled_extensions'] = array();
-
-// Enables debugging of conversation with sieve server. Logs it into <log_dir>/sieve
-$rcmail_config['managesieve_debug'] = false;
-
-// Enables features described in http://wiki.kolab.org/KEP:14
-$rcmail_config['managesieve_kolab_master'] = false;
-
-// Script name extension used for scripts including. Dovecot uses '.sieve',
-// Cyrus uses '.siv'. Doesn't matter if you have managesieve_kolab_master disabled.
-$rcmail_config['managesieve_filename_extension'] = '.sieve';
-
-// List of reserved script names (without extension).
-// Scripts listed here will be not presented to the user.
-$rcmail_config['managesieve_filename_exceptions'] = array();
-
-?>