|
@@ -29,6 +29,7 @@ ${REDIS_CMDLINE} SET DOVECOT_REPL_HEALTH 1 > /dev/null
|
|
|
# Create missing directories
|
|
|
[[ ! -d /etc/dovecot/sql/ ]] && mkdir -p /etc/dovecot/sql/
|
|
|
[[ ! -d /etc/dovecot/lua/ ]] && mkdir -p /etc/dovecot/lua/
|
|
|
+[[ ! -d /etc/dovecot/conf.d/ ]] && mkdir -p /etc/dovecot/conf.d/
|
|
|
[[ ! -d /var/vmail/_garbage ]] && mkdir -p /var/vmail/_garbage
|
|
|
[[ ! -d /var/vmail/sieve ]] && mkdir -p /var/vmail/sieve
|
|
|
[[ ! -d /etc/sogo ]] && mkdir -p /etc/sogo
|
|
@@ -109,7 +110,14 @@ EOF
|
|
|
|
|
|
echo -n ${ACL_ANYONE} > /etc/dovecot/acl_anyone
|
|
|
|
|
|
-if [[ "${SKIP_SOLR}" =~ ^([yY][eE][sS]|[yY])+$ ]]; then
|
|
|
+if [[ "${FLATCURVE_EXPERIMENTAL}" =~ ^([yY][eE][sS]|[yY]) ]]; then
|
|
|
+echo -e "\e[33mActivating Flatcurve as FTS Backend...\e[0m"
|
|
|
+echo -e "\e[33mDepending on your previous setup a full reindex might be needed... \e[0m"
|
|
|
+echo -e "\e[34mVisit https://docs.mailcow.email/manual-guides/Dovecot/u_e-dovecot-fts/#fts-related-dovecot-commands to learn how to reindex\e[0m"
|
|
|
+echo -n 'quota acl zlib mail_crypt mail_crypt_acl mail_log notify fts fts_flatcurve listescape replication' > /etc/dovecot/mail_plugins
|
|
|
+echo -n 'quota imap_quota imap_acl acl zlib imap_zlib imap_sieve mail_crypt mail_crypt_acl notify mail_log fts fts_flatcurve listescape replication' > /etc/dovecot/mail_plugins_imap
|
|
|
+echo -n 'quota sieve acl zlib mail_crypt mail_crypt_acl fts fts_flatcurve notify listescape replication' > /etc/dovecot/mail_plugins_lmtp
|
|
|
+elif [[ "${SKIP_SOLR}" =~ ^([yY][eE][sS]|[yY])+$ ]]; then
|
|
|
echo -n 'quota acl zlib mail_crypt mail_crypt_acl mail_log notify listescape replication' > /etc/dovecot/mail_plugins
|
|
|
echo -n 'quota imap_quota imap_acl acl zlib imap_zlib imap_sieve mail_crypt mail_crypt_acl notify listescape replication mail_log' > /etc/dovecot/mail_plugins_imap
|
|
|
echo -n 'quota sieve acl zlib mail_crypt mail_crypt_acl notify listescape replication' > /etc/dovecot/mail_plugins_lmtp
|
|
@@ -239,6 +247,47 @@ function script_deinit()
|
|
|
end
|
|
|
EOF
|
|
|
|
|
|
+# Temporarily set FTS depending on user choice inside mailcow.conf. Will be removed as soon as Solr is dropped
|
|
|
+if [[ "${FLATCURVE_EXPERIMENTAL}" =~ ^([yY][eE][sS]|[yY])$ ]]; then
|
|
|
+cat <<EOF > /etc/dovecot/conf.d/fts.conf
|
|
|
+# Autogenerated by mailcow
|
|
|
+plugin {
|
|
|
+ fts_autoindex = yes
|
|
|
+ fts_autoindex_exclude = \Junk
|
|
|
+ fts_autoindex_exclude2 = \Trash
|
|
|
+ fts = flatcurve
|
|
|
+
|
|
|
+ # These are not flatcurve settings, but required for Dovecot FTS. See
|
|
|
+ # Dovecot FTS Configuration link above for further information.
|
|
|
+ fts_languages = en es de
|
|
|
+ fts_tokenizer_generic = algorithm=simple
|
|
|
+ fts_tokenizers = generic email-address
|
|
|
+
|
|
|
+ # OPTIONAL: Recommended default FTS core configuration
|
|
|
+ fts_filters = normalizer-icu snowball stopwords
|
|
|
+ fts_filters_en = lowercase snowball english-possessive stopwords
|
|
|
+}
|
|
|
+EOF
|
|
|
+elif [[ ! "${SKIP_SOLR}" =~ ^([yY][eE][sS]|[yY])$ ]]; then
|
|
|
+cat <<EOF > /etc/dovecot/conf.d/fts.conf
|
|
|
+# Autogenerated by mailcow
|
|
|
+plugin {
|
|
|
+ fts = solr
|
|
|
+ fts_autoindex = yes
|
|
|
+ fts_autoindex_exclude = \Junk
|
|
|
+ fts_autoindex_exclude2 = \Trash
|
|
|
+ fts_solr = url=http://solr:8983/solr/dovecot-fts/
|
|
|
+
|
|
|
+ fts_tokenizers = generic email-address
|
|
|
+ fts_tokenizer_generic = algorithm=simple
|
|
|
+
|
|
|
+ fts_filters = normalizer-icu snowball stopwords
|
|
|
+ fts_filters_en = lowercase snowball english-possessive stopwords
|
|
|
+}
|
|
|
+EOF
|
|
|
+fi
|
|
|
+
|
|
|
+
|
|
|
# Replace patterns in app-passdb.lua
|
|
|
sed -i "s/__DBUSER__/${DBUSER}/g" /etc/dovecot/lua/passwd-verify.lua
|
|
|
sed -i "s/__DBPASS__/${DBPASS}/g" /etc/dovecot/lua/passwd-verify.lua
|
|
@@ -343,7 +392,6 @@ mail_replica = tcp:${MAILCOW_REPLICA_IP}:${DOVEADM_REPLICA_PORT}
|
|
|
EOF
|
|
|
fi
|
|
|
|
|
|
-
|
|
|
# 401 is user dovecot
|
|
|
if [[ ! -s /mail_crypt/ecprivkey.pem || ! -s /mail_crypt/ecpubkey.pem ]]; then
|
|
|
openssl ecparam -name prime256v1 -genkey | openssl pkey -out /mail_crypt/ecprivkey.pem
|
|
@@ -387,7 +435,8 @@ chmod +x /usr/lib/dovecot/sieve/rspamd-pipe-ham \
|
|
|
/usr/local/bin/maildir_gc.sh \
|
|
|
/usr/local/sbin/stop-supervisor.sh \
|
|
|
/usr/local/bin/quota_notify.py \
|
|
|
- /usr/local/bin/repl_health.sh
|
|
|
+ /usr/local/bin/repl_health.sh \
|
|
|
+ /usr/local/bin/optimize-fts.sh
|
|
|
|
|
|
# Prepare environment file for cronjobs
|
|
|
printenv | sed 's/^\(.*\)$/export \1/g' > /source_env.sh
|