diff --git a/data/Dockerfiles/acme/docker-entrypoint.sh b/data/Dockerfiles/acme/docker-entrypoint.sh
index bb9a5a53..c8501168 100755
--- a/data/Dockerfiles/acme/docker-entrypoint.sh
+++ b/data/Dockerfiles/acme/docker-entrypoint.sh
@@ -42,7 +42,6 @@ mkdir -p ${ACME_BASE}/acme
[[ -f ${ACME_BASE}/acme/private/privkey.pem ]] && mv ${ACME_BASE}/acme/private/privkey.pem ${ACME_BASE}/acme/key.pem
[[ -f ${ACME_BASE}/acme/private/account.key ]] && mv ${ACME_BASE}/acme/private/account.key ${ACME_BASE}/acme/account.pem
-
reload_configurations(){
# Reading container IDs
# Wrapping as array to ensure trimmed content when calling $NGINX etc.
@@ -156,6 +155,7 @@ else
exec env TRIGGER_RESTART=1 $(readlink -f "$0")
fi
fi
+chmod 600 ${ACME_BASE}/key.pem
log_f "Waiting for database... " no_nl
while ! mysqladmin status --socket=/var/run/mysqld/mysqld.sock -u${DBUSER} -p${DBPASS} --silent; do
@@ -196,6 +196,9 @@ while true; do
log_f "Using existing Lets Encrypt account key ${ACME_BASE}/acme/account.pem"
fi
+ chmod 600 ${ACME_BASE}/acme/key.pem
+ chmod 600 ${ACME_BASE}/acme/account.pem
+
# Skipping IP check when we like to live dangerously
if [[ "${SKIP_IP_CHECK}" =~ ^([yY][eE][sS]|[yY])+$ ]]; then
SKIP_IP_CHECK=y
diff --git a/data/Dockerfiles/dovecot/Dockerfile b/data/Dockerfiles/dovecot/Dockerfile
index 1320df1f..bc4fca5c 100644
--- a/data/Dockerfiles/dovecot/Dockerfile
+++ b/data/Dockerfiles/dovecot/Dockerfile
@@ -3,8 +3,8 @@ LABEL maintainer "Andre Peters "
ARG DEBIAN_FRONTEND=noninteractive
ENV LC_ALL C
-ENV DOVECOT_VERSION 2.3.4
-ENV PIGEONHOLE_VERSION 0.5.4
+ENV DOVECOT_VERSION 2.3.5
+ENV PIGEONHOLE_VERSION 0.5.5
RUN apt-get update && apt-get -y --no-install-recommends install \
automake \
diff --git a/data/Dockerfiles/dovecot/docker-entrypoint.sh b/data/Dockerfiles/dovecot/docker-entrypoint.sh
index 28b31420..7034fc08 100755
--- a/data/Dockerfiles/dovecot/docker-entrypoint.sh
+++ b/data/Dockerfiles/dovecot/docker-entrypoint.sh
@@ -106,7 +106,7 @@ chmod 644 /usr/local/etc/dovecot/mail_plugins /usr/local/etc/dovecot/mail_plugin
cat < /usr/local/etc/dovecot/sql/dovecot-dict-sql-userdb.conf
driver = mysql
connect = "host=/var/run/mysqld/mysqld.sock dbname=${DBNAME} user=${DBUSER} password=${DBPASS}"
-user_query = SELECT CONCAT(JSON_UNQUOTE(JSON_EXTRACT(attributes, '$.mailbox_format')), mailbox_path_prefix, '%d/%n/:VOLATILEDIR=/var/volatile/%u') AS mail, 5000 AS uid, 5000 AS gid, concat('*:bytes=', quota) AS quota_rule FROM mailbox WHERE username = '%u' AND active = '1'
+user_query = SELECT CONCAT(JSON_UNQUOTE(JSON_EXTRACT(attributes, '$.mailbox_format')), mailbox_path_prefix, '%d/%n/${MAILDIR_SUB}:VOLATILEDIR=/var/volatile/%u') AS mail, 5000 AS uid, 5000 AS gid, concat('*:bytes=', quota) AS quota_rule FROM mailbox WHERE username = '%u' AND active = '1'
iterate_query = SELECT username FROM mailbox WHERE active='1';
EOF
@@ -127,6 +127,10 @@ if [[ $(stat -c %U /var/vmail/) != "vmail" ]] ; then chown -R vmail:vmail /var/v
if [[ $(stat -c %U /var/vmail/_garbage) != "vmail" ]] ; then chown -R vmail:vmail /var/vmail/_garbage ; fi
if [[ $(stat -c %U /var/attachments) != "vmail" ]] ; then chown -R vmail:vmail /var/attachments ; fi
+# Cleanup random user maildirs
+rm -rf /var/vmail/mailcow.local/*
+
+
# Create random master for SOGo sieve features
RAND_USER=$(cat /dev/urandom | tr -dc 'a-z0-9' | fold -w 16 | head -n 1)
RAND_PASS=$(cat /dev/urandom | tr -dc 'a-z0-9' | fold -w 24 | head -n 1)
@@ -189,7 +193,7 @@ echo '30 3 * * * vmail /usr/local/bin/doveadm quota recalc -A' > /etc/cron.d/d
echo '* * * * * vmail /usr/local/bin/trim_logs.sh >> /dev/console 2>&1' > /etc/cron.d/trim_logs
echo '25 * * * * vmail /usr/local/bin/maildir_gc.sh >> /dev/console 2>&1' > /etc/cron.d/maildir_gc
echo '30 1 * * * root /usr/local/bin/sa-rules.sh >> /dev/console 2>&1' > /etc/cron.d/sa-rules
-echo '0 2 * * * root /usr/bin/curl http://solr:8983/solr/dovecot/update?optimize=true >> /dev/console 2>&1' > /etc/cron.d/solr-optimize
+echo '0 2 * * * root /usr/bin/curl http://solr:8983/solr/dovecot-fts/update?optimize=true >> /dev/console 2>&1' > /etc/cron.d/solr-optimize
echo '*/20 * * * * vmail /usr/local/bin/quarantine_notify.py >> /dev/console 2>&1' > /etc/cron.d/quarantine_notify
# Fix more than 1 hardlink issue
diff --git a/data/Dockerfiles/phpfpm/docker-entrypoint.sh b/data/Dockerfiles/phpfpm/docker-entrypoint.sh
index 76c4035e..bf055f3a 100755
--- a/data/Dockerfiles/phpfpm/docker-entrypoint.sh
+++ b/data/Dockerfiles/phpfpm/docker-entrypoint.sh
@@ -25,23 +25,26 @@ CONTAINER_ID=
# Todo: Better check if upgrade failed
# This can happen due to a broken sogo_view
[ -s /mysql_upgrade_loop ] && SQL_LOOP_C=$(cat /mysql_upgrade_loop)
-CONTAINER_ID=$(curl --silent --insecure https://dockerapi/containers/json | jq -r ".[] | {name: .Config.Labels[\"com.docker.compose.service\"], id: .Id}" | jq -rc "select( .name | tostring | contains(\"mysql-mailcow\")) | .id")
-if [[ ! -z "${CONTAINER_ID}" ]] && [[ "${CONTAINER_ID}" =~ [^a-zA-Z0-9] ]]; then
- SQL_UPGRADE_RETURN=$(curl --silent --insecure -XPOST https://dockerapi/containers/${CONTAINER_ID}/exec -d '{"cmd":"system", "task":"mysql_upgrade"}' --silent -H 'Content-type: application/json' | jq -r .type)
- if [[ ${SQL_UPGRADE_RETURN} == 'warning' ]]; then
- if [ -z ${SQL_LOOP_C} ]; then
- echo 1 > /mysql_upgrade_loop
- echo "MySQL applied an upgrade, restarting PHP-FPM..."
- exit 1
- else
- rm /mysql_upgrade_loop
- echo "MySQL was not applied previously, skipping. Restart php-fpm-mailcow to retry or run mysql_upgrade manually."
- while ! mysqladmin status --socket=/var/run/mysqld/mysqld.sock -u${DBUSER} -p${DBPASS} --silent; do
- echo "Waiting for SQL to return..."
- sleep 2
- done
- fi
+until [[ ! -z "${CONTAINER_ID}" ]] && [[ "${CONTAINER_ID}" =~ ^[[:alnum:]]*$ ]]; do
+ CONTAINER_ID=$(curl --silent --insecure https://dockerapi/containers/json | jq -r ".[] | {name: .Config.Labels[\"com.docker.compose.service\"], id: .Id}" 2> /dev/null | jq -rc "select( .name | tostring | contains(\"mysql-mailcow\")) | .id" 2> /dev/null)
+done
+echo "MySQL @ ${CONTAINER_ID}"
+SQL_UPGRADE_RETURN=$(curl --silent --insecure -XPOST https://dockerapi/containers/${CONTAINER_ID}/exec -d '{"cmd":"system", "task":"mysql_upgrade"}' --silent -H 'Content-type: application/json' | jq -r .type)
+if [[ ${SQL_UPGRADE_RETURN} == 'warning' ]]; then
+ if [ -z ${SQL_LOOP_C} ]; then
+ echo 1 > /mysql_upgrade_loop
+ echo "MySQL applied an upgrade, restarting PHP-FPM..."
+ exit 1
+ else
+ rm /mysql_upgrade_loop
+ echo "MySQL was not applied previously, skipping. Restart php-fpm-mailcow to retry or run mysql_upgrade manually."
+ while ! mysqladmin status --socket=/var/run/mysqld/mysqld.sock -u${DBUSER} -p${DBPASS} --silent; do
+ echo "Waiting for SQL to return..."
+ sleep 2
+ done
fi
+else
+ echo "MySQL is up-to-date"
fi
# Trigger db init
diff --git a/data/Dockerfiles/postfix/postfix.sh b/data/Dockerfiles/postfix/postfix.sh
index 6ec5cc1d..d3e9ed0c 100755
--- a/data/Dockerfiles/postfix/postfix.sh
+++ b/data/Dockerfiles/postfix/postfix.sh
@@ -104,8 +104,8 @@ query = SELECT CONCAT_WS(':', username, password) AS auth_data FROM relayhosts
WHERE id IN (
SELECT relayhost FROM domain
WHERE CONCAT('@', domain) = '%s'
- OR '%s' IN (
- SELECT CONCAT('@', alias_domain) FROM alias_domain
+ OR domain IN (
+ SELECT target_domain FROM alias_domain WHERE CONCAT('@', alias_domain) = '%s'
)
)
AND active = '1'
diff --git a/data/Dockerfiles/rspamd/Dockerfile b/data/Dockerfiles/rspamd/Dockerfile
index a2b5f7f8..87d92139 100644
--- a/data/Dockerfiles/rspamd/Dockerfile
+++ b/data/Dockerfiles/rspamd/Dockerfile
@@ -13,7 +13,6 @@ RUN apt-get update && apt-get install -y \
&& echo "deb https://rspamd.com/apt-stable/ bionic main" > /etc/apt/sources.list.d/rspamd.list \
&& apt-get update && apt-get install -y rspamd \
&& rm -rf /var/lib/apt/lists/* \
- && echo '.include $LOCAL_CONFDIR/local.d/rspamd.conf.local' > /etc/rspamd/rspamd.conf.local \
&& apt-get autoremove --purge \
&& apt-get clean \
&& mkdir -p /run/rspamd \
@@ -21,7 +20,6 @@ RUN apt-get update && apt-get install -y \
COPY settings.conf /etc/rspamd/settings.conf
COPY docker-entrypoint.sh /docker-entrypoint.sh
-COPY metadata_exporter.lua /usr/share/rspamd/lua/metadata_exporter.lua
ENTRYPOINT ["/docker-entrypoint.sh"]
diff --git a/data/Dockerfiles/solr/Dockerfile b/data/Dockerfiles/solr/Dockerfile
index 67cd3384..1c74fde8 100644
--- a/data/Dockerfiles/solr/Dockerfile
+++ b/data/Dockerfiles/solr/Dockerfile
@@ -1,9 +1,12 @@
-FROM solr:7-alpine
+FROM solr:7.7-alpine
USER root
COPY docker-entrypoint.sh /
+COPY solr-config-7.7.0.xml /
+COPY solr-schema-7.7.0.xml /
+
RUN apk --no-cache add su-exec curl tzdata \
&& chmod +x /docker-entrypoint.sh \
- && /docker-entrypoint.sh --bootstrap
+ && bash /docker-entrypoint.sh --bootstrap
ENTRYPOINT ["/docker-entrypoint.sh"]
diff --git a/data/Dockerfiles/solr/docker-entrypoint.sh b/data/Dockerfiles/solr/docker-entrypoint.sh
old mode 100755
new mode 100644
index 108f8b5a..5a33620d
--- a/data/Dockerfiles/solr/docker-entrypoint.sh
+++ b/data/Dockerfiles/solr/docker-entrypoint.sh
@@ -18,403 +18,44 @@ fi
set -e
-# allow easier debugging with `docker run -e VERBOSE=yes`
-if [[ "$VERBOSE" = "yes" ]]; then
- set -x
-fi
-
# run the optional initdb
. /opt/docker-solr/scripts/run-initdb
-function solr_config() {
- curl -XPOST http://localhost:8983/solr/dovecot/schema -H 'Content-type:application/json' -d '{
- "add-field-type":{
- "name":"long",
- "class":"solr.TrieLongField"
- },
- "add-field-type":{
- "name":"dovecot_text",
- "class":"solr.TextField",
- "autoGeneratePhraseQueries":true,
- "positionIncrementGap":100,
- "indexAnalyser":{
- "charFilter":{
- "class":"solr.MappingCharFilterFactory",
- "mapping":"mapping-FoldToASCII.txt"
- },
- "charFilter":{
- "class":"solr.MappingCharFilterFactory",
- "mapping":"mapping-ISOLatin1Accent.txt"
- },
- "charFilter":{
- "class":"solr.HTMLStripCharFilterFactory"
- },
- "tokenizer":{
- "class":"solr.StandardTokenizerFactory"
- },
- "filter":{
- "class":"solr.StopFilterFactory",
- "words":"stopwords.txt",
- "ignoreCase":true
- },
- "filter":{
- "class":"solr.WordDelimiterGraphFilterFactory",
- "generateWordParts":1,
- "generateNumberParts":1,
- "splitOnCaseChange":1,
- "splitOnNumerics":1,
- "catenateWords":1,
- "catenateNumbers":1,
- "catenateAll":1
- },
- "filter":{
- "class":"solr.FlattenGraphFilterFactory"
- },
- "filter":{
- "class":"solr.LowerCaseFilterFactory"
- },
- "filter":{
- "class":"solr.KeywordMarkerFilterFactory",
- "protected":"protwords.txt"
- },
- "filter":{
- "class":"solr.PorterStemFilterFactory"
- }
- },
- "queryAnalyzer":{
- "tokenizer":{
- "class":"solr.StandardTokenizerFactory"
- },
- "filter":{
- "class":"solr.SynonymGraphFilterFactory",
- "expand":true,
- "ignoreCase":true,
- "synonyms":synonyms.txt
- },
- "filter":{
- "class":"solr.FlattenGraphFilterFactory"
- },
- "filter":{
- "class":"solr.StopFilterFactory",
- "words":"stopwords.txt",
- "ignoreCase":true
- },
- "filter":{
- "class":"solr.WordDelimiterGraphFilterFactory",
- "generateWordParts":1,
- "generateNumberParts":1,
- "splitOnCaseChange":1,
- "splitOnNumerics":1,
- "catenateWords":1,
- "catenateNumbers":1,
- "catenateAll":1
- },
- "filter":{
- "class":"solr.LowerCaseFilterFactory"
- },
- "filter":{
- "class":"solr.KeywordMarkerFilterFactory",
- "protected":"protwords.txt"
- },
- "filter":{
- "class":"solr.PorterStemFilterFactory"
- }
- }
- },
- "add-field":{
- "name":"uid",
- "type":"long",
- "indexed":true,
- "stored":true,
- "required":true
- },
- "add-field":{
- "name":"box",
- "type":"string",
- "indexed":true,
- "stored":true,
- "required":true
- },
- "add-field":{
- "name":"user",
- "type":"string",
- "indexed":true,
- "stored":true,
- "required":true
- },
- "add-field":{
- "name":"hdr",
- "type":"dovecot_text",
- "indexed":true,
- "stored":false
-
- },
- "add-field":{
- "name":"body",
- "type":"dovecot_text",
- "indexed":true,
- "stored":false
- },
- "add-field":{
- "name":"from",
- "type":"dovecot_text",
- "indexed":true,
- "stored":false
- },
- "add-field":{
- "name":"to",
- "type":"dovecot_text",
- "indexed":true,
- "stored":false
- },
- "add-field":{
- "name":"cc",
- "type":"dovecot_text",
- "indexed":true,
- "stored":false
- },
- "add-field":{
- "name":"bcc",
- "type":"dovecot_text",
- "indexed":true,
- "stored":false
- },
- "add-field":{
- "name":"subject",
- "type":"dovecot_text",
- "indexed":true,
- "stored":false
- }
- }'
-
- curl -XPOST http://localhost:8983/solr/dovecot/schema -H 'Content-type:application/json' -d '{
- "replace-field-type":{
- "name":"long",
- "class":"solr.TrieLongField"
- },
- "replace-field-type":{
- "name":"dovecot_text",
- "class":"solr.TextField",
- "autoGeneratePhraseQueries":true,
- "positionIncrementGap":100,
- "indexAnalyser":{
- "charFilter":{
- "class":"solr.MappingCharFilterFactory",
- "mapping":"mapping-FoldToASCII.txt"
- },
- "charFilter":{
- "class":"solr.MappingCharFilterFactory",
- "mapping":"mapping-ISOLatin1Accent.txt"
- },
- "charFilter":{
- "class":"solr.HTMLStripCharFilterFactory"
- },
- "tokenizer":{
- "class":"solr.StandardTokenizerFactory"
- },
- "filter":{
- "class":"solr.StopFilterFactory",
- "words":"stopwords.txt",
- "ignoreCase":true
- },
- "filter":{
- "class":"solr.WordDelimiterGraphFilterFactory",
- "generateWordParts":1,
- "generateNumberParts":1,
- "splitOnCaseChange":1,
- "splitOnNumerics":1,
- "catenateWords":1,
- "catenateNumbers":1,
- "catenateAll":1
- },
- "filter":{
- "class":"solr.FlattenGraphFilterFactory"
- },
- "filter":{
- "class":"solr.LowerCaseFilterFactory"
- },
- "filter":{
- "class":"solr.KeywordMarkerFilterFactory",
- "protected":"protwords.txt"
- },
- "filter":{
- "class":"solr.PorterStemFilterFactory"
- }
- },
- "queryAnalyzer":{
- "tokenizer":{
- "class":"solr.StandardTokenizerFactory"
- },
- "filter":{
- "class":"solr.SynonymGraphFilterFactory",
- "expand":true,
- "ignoreCase":true,
- "synonyms":synonyms.txt
- },
- "filter":{
- "class":"solr.FlattenGraphFilterFactory"
- },
- "filter":{
- "class":"solr.StopFilterFactory",
- "words":"stopwords.txt",
- "ignoreCase":true
- },
- "filter":{
- "class":"solr.WordDelimiterGraphFilterFactory",
- "generateWordParts":1,
- "generateNumberParts":1,
- "splitOnCaseChange":1,
- "splitOnNumerics":1,
- "catenateWords":1,
- "catenateNumbers":1,
- "catenateAll":1
- },
- "filter":{
- "class":"solr.LowerCaseFilterFactory"
- },
- "filter":{
- "class":"solr.KeywordMarkerFilterFactory",
- "protected":"protwords.txt"
- },
- "filter":{
- "class":"solr.PorterStemFilterFactory"
- }
- }
- },
- "replace-field":{
- "name":"uid",
- "type":"long",
- "indexed":true,
- "stored":true,
- "required":true
- },
- "replace-field":{
- "name":"box",
- "type":"string",
- "indexed":true,
- "stored":true,
- "required":true
- },
- "replace-field":{
- "name":"user",
- "type":"string",
- "indexed":true,
- "stored":true,
- "required":true
- },
- "replace-field":{
- "name":"hdr",
- "type":"dovecot_text",
- "indexed":true,
- "stored":false
-
- },
- "replace-field":{
- "name":"body",
- "type":"dovecot_text",
- "indexed":true,
- "stored":false
- },
- "replace-field":{
- "name":"from",
- "type":"dovecot_text",
- "indexed":true,
- "stored":false
- },
- "replace-field":{
- "name":"to",
- "type":"dovecot_text",
- "indexed":true,
- "stored":false
- },
- "replace-field":{
- "name":"cc",
- "type":"dovecot_text",
- "indexed":true,
- "stored":false
- },
- "replace-field":{
- "name":"bcc",
- "type":"dovecot_text",
- "indexed":true,
- "stored":false
- },
- "replace-field":{
- "name":"subject",
- "type":"dovecot_text",
- "indexed":true,
- "stored":false
- }
- }'
-
- curl -XPOST http://localhost:8983/solr/dovecot/config -H 'Content-type:application/json' -d '{
- "update-requesthandler":{
- "name":"/select",
- "class":"solr.SearchHandler",
- "defaults":{
- "wt":"xml"
- }
- }
- }'
-
- curl -XPOST http://localhost:8983/solr/dovecot/config/updateHandler -d '{
- "set-property": {
- "updateHandler.autoSoftCommit.maxDocs":500,
- "updateHandler.autoSoftCommit.maxTime":120000,
- "updateHandler.autoCommit.maxDocs":200,
- "updateHandler.autoCommit.maxTime":1800000,
- "updateHandler.autoCommit.openSearcher":false
- }
- }'
-}
-
# fixing volume permission
-
-[[ -d /opt/solr/server/solr/dovecot/data ]] && chown -R solr:solr /opt/solr/server/solr/dovecot/data
+[[ -d /opt/solr/server/solr/dovecot-fts/data ]] && chown -R solr:solr /opt/solr/server/solr/dovecot-fts/data
if [[ "${1}" != "--bootstrap" ]]; then
sed -i '/SOLR_HEAP=/c\SOLR_HEAP="'${SOLR_HEAP:-1024}'m"' /opt/solr/bin/solr.in.sh
else
sed -i '/SOLR_HEAP=/c\SOLR_HEAP="256m"' /opt/solr/bin/solr.in.sh
fi
-# start a Solr so we can use the Schema API, but only on localhost,
-# so that clients don't see Solr until we have configured it.
+if [[ "${1}" == "--bootstrap" ]]; then
+ echo "Creating initial configuration"
+ echo "Modifying default config set"
+ cp /solr-config-7.7.0.xml /opt/solr/server/solr/configsets/_default/conf/solrconfig.xml
+ cp /solr-schema-7.7.0.xml /opt/solr/server/solr/configsets/_default/conf/schema.xml
+ rm /opt/solr/server/solr/configsets/_default/conf/managed-schema
-echo "Starting local Solr instance to setup configuration"
-su-exec solr start-local-solr
+ echo "Starting local Solr instance to setup configuration"
+ su-exec solr start-local-solr
-# keep a sentinel file so we don't try to create the core a second time
-# for example when we restart a container.
-
-SENTINEL=/opt/docker-solr/core_created
-
-if [[ -f ${SENTINEL} ]]; then
- echo "skipping core creation"
-else
- echo "Creating core \"dovecot\""
- su-exec solr /opt/solr/bin/solr create -c "dovecot"
+ echo "Creating core \"dovecot-fts\""
+ su-exec solr /opt/solr/bin/solr create -c "dovecot-fts"
# See https://github.com/docker-solr/docker-solr/issues/27
echo "Checking core"
while ! wget -O - 'http://localhost:8983/solr/admin/cores?action=STATUS' | grep -q instanceDir; do
echo "Could not find any cores, waiting..."
- sleep 5
+ sleep 3
done
- echo "Created core \"dovecot\""
- touch ${SENTINEL}
-fi
-echo "Starting configuration"
-while ! wget -O - 'http://localhost:8983/solr/admin/cores?action=STATUS' | grep -q instanceDir; do
- echo "Waiting for Solr..."
- sleep 5
-done
-solr_config
-echo "Stopping local Solr"
-su-exec solr stop-local-solr
+ echo "Created core \"dovecot-fts\""
+
+ echo "Stopping local Solr"
+ su-exec solr stop-local-solr
-if [[ "${1}" == "--bootstrap" ]]; then
exit 0
-else
- exec su-exec solr solr-foreground
fi
+
+exec su-exec solr solr-foreground
+
diff --git a/data/Dockerfiles/solr/solr-config-7.7.0.xml b/data/Dockerfiles/solr/solr-config-7.7.0.xml
new file mode 100644
index 00000000..3661874d
--- /dev/null
+++ b/data/Dockerfiles/solr/solr-config-7.7.0.xml
@@ -0,0 +1,289 @@
+
+
+
+
+
+
+ 7.7.0
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ${solr.data.dir:}
+
+
+
+
+
+
+ ${solr.ulog.dir:}
+ ${solr.ulog.numVersionBuckets:65536}
+
+
+
+
+ ${solr.autoCommit.maxTime:15000}
+ false
+
+
+
+
+ ${solr.autoSoftCommit.maxTime:-1}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+ 20
+
+
+ 200
+
+
+ false
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ explicit
+ 10
+
+
+
+
+
+ _text_
+
+
+
+
+
+
diff --git a/data/Dockerfiles/solr/solr-schema-7.7.0.xml b/data/Dockerfiles/solr/solr-schema-7.7.0.xml
new file mode 100644
index 00000000..2c2e6343
--- /dev/null
+++ b/data/Dockerfiles/solr/solr-schema-7.7.0.xml
@@ -0,0 +1,49 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ id
+
diff --git a/data/Dockerfiles/watchdog/watchdog.sh b/data/Dockerfiles/watchdog/watchdog.sh
index ed9b568d..a9db9321 100755
--- a/data/Dockerfiles/watchdog/watchdog.sh
+++ b/data/Dockerfiles/watchdog/watchdog.sh
@@ -37,7 +37,7 @@ progress() {
log_msg() {
if [[ ${2} != "no_redis" ]]; then
redis-cli -h redis LPUSH WATCHDOG_LOG "{\"time\":\"$(date +%s)\",\"message\":\"$(printf '%s' "${1}" | \
- tr '%&;$"_[]{}-\r\n' ' ')\"}" > /dev/null
+ tr '\r\n%&;$"_[]{}-' ' ')\"}" > /dev/null
fi
echo $(date) $(printf '%s\n' "${1}")
}
@@ -115,7 +115,7 @@ nginx_checks() {
# Reduce error count by 2 after restarting an unhealthy container
trap "[ ${err_count} -gt 1 ] && err_count=$(( ${err_count} - 2 ))" USR1
while [ ${err_count} -lt ${THRESHOLD} ]; do
- cat /dev/null > /tmp/nginx-mailcow
+ touch /tmp/nginx-mailcow; echo "$(tail -50 /tmp/nginx-mailcow)" > /tmp/nginx-mailcow
host_ip=$(get_container_ip nginx-mailcow)
err_c_cur=${err_count}
/usr/lib/nagios/plugins/check_http -4 -H ${host_ip} -u / -p 8081 2>> /tmp/nginx-mailcow 1>&2; err_count=$(( ${err_count} + $? ))
@@ -140,7 +140,7 @@ unbound_checks() {
# Reduce error count by 2 after restarting an unhealthy container
trap "[ ${err_count} -gt 1 ] && err_count=$(( ${err_count} - 2 ))" USR1
while [ ${err_count} -lt ${THRESHOLD} ]; do
- cat /dev/null > /tmp/unbound-mailcow
+ touch /tmp/unbound-mailcow; echo "$(tail -50 /tmp/unbound-mailcow)" > /tmp/unbound-mailcow
host_ip=$(get_container_ip unbound-mailcow)
err_c_cur=${err_count}
/usr/lib/nagios/plugins/check_dns -s ${host_ip} -H stackoverflow.com 2>> /tmp/unbound-mailcow 1>&2; err_count=$(( ${err_count} + $? ))
@@ -172,7 +172,7 @@ mysql_checks() {
# Reduce error count by 2 after restarting an unhealthy container
trap "[ ${err_count} -gt 1 ] && err_count=$(( ${err_count} - 2 ))" USR1
while [ ${err_count} -lt ${THRESHOLD} ]; do
- cat /dev/null > /tmp/mysql-mailcow
+ touch /tmp/mysql-mailcow; echo "$(tail -50 /tmp/mysql-mailcow)" > /tmp/mysql-mailcow
host_ip=$(get_container_ip mysql-mailcow)
err_c_cur=${err_count}
/usr/lib/nagios/plugins/check_mysql -s /var/run/mysqld/mysqld.sock -u ${DBUSER} -p ${DBPASS} -d ${DBNAME} 2>> /tmp/mysql-mailcow 1>&2; err_count=$(( ${err_count} + $? ))
@@ -198,7 +198,7 @@ sogo_checks() {
# Reduce error count by 2 after restarting an unhealthy container
trap "[ ${err_count} -gt 1 ] && err_count=$(( ${err_count} - 2 ))" USR1
while [ ${err_count} -lt ${THRESHOLD} ]; do
- cat /dev/null > /tmp/sogo-mailcow
+ touch /tmp/sogo-mailcow; echo "$(tail -50 /tmp/sogo-mailcow)" > /tmp/sogo-mailcow
host_ip=$(get_container_ip sogo-mailcow)
err_c_cur=${err_count}
/usr/lib/nagios/plugins/check_http -4 -H ${host_ip} -u /SOGo.index/ -p 20000 -R "SOGo\.MainUI" 2>> /tmp/sogo-mailcow 1>&2; err_count=$(( ${err_count} + $? ))
@@ -223,7 +223,7 @@ postfix_checks() {
# Reduce error count by 2 after restarting an unhealthy container
trap "[ ${err_count} -gt 1 ] && err_count=$(( ${err_count} - 2 ))" USR1
while [ ${err_count} -lt ${THRESHOLD} ]; do
- cat /dev/null > /tmp/postfix-mailcow
+ touch /tmp/postfix-mailcow; echo "$(tail -50 /tmp/postfix-mailcow)" > /tmp/postfix-mailcow
host_ip=$(get_container_ip postfix-mailcow)
err_c_cur=${err_count}
/usr/lib/nagios/plugins/check_smtp -4 -H ${host_ip} -p 589 -f "watchdog@invalid" -C "RCPT TO:null@localhost" -C DATA -C . -R 250 2>> /tmp/postfix-mailcow 1>&2; err_count=$(( ${err_count} + $? ))
@@ -249,7 +249,7 @@ clamd_checks() {
# Reduce error count by 2 after restarting an unhealthy container
trap "[ ${err_count} -gt 1 ] && err_count=$(( ${err_count} - 2 ))" USR1
while [ ${err_count} -lt ${THRESHOLD} ]; do
- cat /dev/null > /tmp/clamd-mailcow
+ touch /tmp/clamd-mailcow; echo "$(tail -50 /tmp/clamd-mailcow)" > /tmp/clamd-mailcow
host_ip=$(get_container_ip clamd-mailcow)
err_c_cur=${err_count}
/usr/lib/nagios/plugins/check_clamd -4 -H ${host_ip} 2>> /tmp/clamd-mailcow 1>&2; err_count=$(( ${err_count} + $? ))
@@ -274,7 +274,7 @@ dovecot_checks() {
# Reduce error count by 2 after restarting an unhealthy container
trap "[ ${err_count} -gt 1 ] && err_count=$(( ${err_count} - 2 ))" USR1
while [ ${err_count} -lt ${THRESHOLD} ]; do
- cat /dev/null > /tmp/dovecot-mailcow
+ touch /tmp/dovecot-mailcow; echo "$(tail -50 /tmp/dovecot-mailcow)" > /tmp/dovecot-mailcow
host_ip=$(get_container_ip dovecot-mailcow)
err_c_cur=${err_count}
/usr/lib/nagios/plugins/check_smtp -4 -H ${host_ip} -p 24 -f "watchdog@invalid" -C "RCPT TO:" -L -R "User doesn't exist" 2>> /tmp/dovecot-mailcow 1>&2; err_count=$(( ${err_count} + $? ))
@@ -303,7 +303,7 @@ phpfpm_checks() {
# Reduce error count by 2 after restarting an unhealthy container
trap "[ ${err_count} -gt 1 ] && err_count=$(( ${err_count} - 2 ))" USR1
while [ ${err_count} -lt ${THRESHOLD} ]; do
- cat /dev/null > /tmp/php-fpm-mailcow
+ touch /tmp/php-fpm-mailcow; echo "$(tail -50 /tmp/php-fpm-mailcow)" > /tmp/php-fpm-mailcow
host_ip=$(get_container_ip php-fpm-mailcow)
err_c_cur=${err_count}
/usr/lib/nagios/plugins/check_tcp -H ${host_ip} -p 9001 2>> /tmp/php-fpm-mailcow 1>&2; err_count=$(( ${err_count} + $? ))
@@ -358,10 +358,11 @@ ipv6nat_checks() {
trap "[ ${err_count} -gt 1 ] && err_count=$(( ${err_count} - 2 ))" USR1
while [ ${err_count} -lt ${THRESHOLD} ]; do
err_c_cur=${err_count}
- IPV6NAT_CONTAINER_ID=$(curl --silent --insecure https://dockerapi/containers/json | jq -r ".[] | {name: .Config.Labels[\"com.docker.compose.service\"], id: .Id}" | jq -rc "select( .name | tostring | contains(\"ipv6nat-mailcow\")) | .id")
+ CONTAINERS=$(curl --silent --insecure https://dockerapi/containers/json)
+ IPV6NAT_CONTAINER_ID=$(echo ${CONTAINERS} | jq -r ".[] | {name: .Config.Labels[\"com.docker.compose.service\"], id: .Id}" | jq -rc "select( .name | tostring | contains(\"ipv6nat-mailcow\")) | .id")
if [[ ! -z ${IPV6NAT_CONTAINER_ID} ]]; then
- LATEST_STARTED="$(curl --silent --insecure https://dockerapi/containers/json | jq -r ".[] | {name: .Config.Labels[\"com.docker.compose.service\"], StartedAt: .State.StartedAt}" | jq -rc "select( .name | tostring | contains(\"ipv6nat-mailcow\") | not)" | jq -rc .StartedAt | xargs -n1 date +%s -d | sort | tail -n1)"
- LATEST_IPV6NAT="$(curl --silent --insecure https://dockerapi/containers/json | jq -r ".[] | {name: .Config.Labels[\"com.docker.compose.service\"], StartedAt: .State.StartedAt}" | jq -rc "select( .name | tostring | contains(\"ipv6nat-mailcow\"))" | jq -rc .StartedAt | xargs -n1 date +%s -d | sort | tail -n1)"
+ LATEST_STARTED="$(echo ${CONTAINERS} | jq -r ".[] | {name: .Config.Labels[\"com.docker.compose.service\"], StartedAt: .State.StartedAt}" | jq -rc "select( .name | tostring | contains(\"ipv6nat-mailcow\") | not)" | jq -rc .StartedAt | xargs -n1 date +%s -d | sort | tail -n1)"
+ LATEST_IPV6NAT="$(echo ${CONTAINERS} | jq -r ".[] | {name: .Config.Labels[\"com.docker.compose.service\"], StartedAt: .State.StartedAt}" | jq -rc "select( .name | tostring | contains(\"ipv6nat-mailcow\"))" | jq -rc .StartedAt | xargs -n1 date +%s -d | sort | tail -n1)"
DIFFERENCE_START_TIME=$(expr ${LATEST_IPV6NAT} - ${LATEST_STARTED} 2>/dev/null)
if [[ "${DIFFERENCE_START_TIME}" -lt 30 ]]; then
err_count=$(( ${err_count} + 1 ))
@@ -375,12 +376,13 @@ ipv6nat_checks() {
sleep 1
else
diff_c=0
- sleep 3600
+ sleep 300
fi
done
return 1
}
+
rspamd_checks() {
err_count=0
diff_c=0
@@ -388,15 +390,14 @@ rspamd_checks() {
# Reduce error count by 2 after restarting an unhealthy container
trap "[ ${err_count} -gt 1 ] && err_count=$(( ${err_count} - 2 ))" USR1
while [ ${err_count} -lt ${THRESHOLD} ]; do
- cat /dev/null > /tmp/rspamd-mailcow
+ touch /tmp/rspamd-mailcow; echo "$(tail -50 /tmp/rspamd-mailcow)" > /tmp/rspamd-mailcow
host_ip=$(get_container_ip rspamd-mailcow)
err_c_cur=${err_count}
- SCORE=$(/usr/bin/curl -s --data-binary @- --unix-socket /var/lib/rspamd/rspamd.sock http://rspamd/scan -d '
-To: null@localhost
+ SCORE=$(echo 'To: null@localhost
From: watchdog@localhost
Empty
-' | jq -rc .required_score)
+' | usr/bin/curl -s --data-binary @- --unix-socket /var/lib/rspamd/rspamd.sock http://rspamd/scan | jq -rc .required_score)
if [[ ${SCORE} != "9999" ]]; then
echo "Rspamd settings check failed" 2>> /tmp/rspamd-mailcow 1>&2
err_count=$(( ${err_count} + 1))
@@ -561,6 +562,9 @@ while true; do
CONTAINER_ID=
HAS_INITDB=
read com_pipe_answer prepare("SELECT UNIX_TIMESTAMP(UPDATE_TIME) AS `db_update_time` FROM information_schema.tables
+ WHERE `TABLE_NAME` = 'filterconf'
+ AND TABLE_SCHEMA = :dbname;");
+$stmt->execute(array(
+ ':dbname' => $database_name
+));
+$db_update_time = $stmt->fetch(PDO::FETCH_ASSOC)['db_update_time'];
+
+if (isset($headers['If-Modified-Since']) && (strtotime($headers['If-Modified-Since']) == $db_update_time)) {
+ header('Last-Modified: '.gmdate('D, d M Y H:i:s', $db_update_time).' GMT', true, 304);
+ exit;
+} else {
+ header('Last-Modified: '.gmdate('D, d M Y H:i:s', $db_update_time).' GMT', true, 200);
+}
+*/
+
function parse_email($email) {
if (!filter_var($email, FILTER_VALIDATE_EMAIL)) return false;
$a = strrpos($email, '@');
@@ -107,8 +126,8 @@ function ucl_rcpts($object, $type) {
settings {
watchdog {
priority = 10;
- rcpt = "/null@localhost/i";
- from = "/watchdog@localhost/i";
+ rcpt_mime = "/null@localhost/i";
+ from_mime = "/watchdog@localhost/i";
apply "default" {
actions {
reject = 9999.0;
@@ -199,12 +218,13 @@ while ($row = array_shift($rows)) {
?>
whitelist_=$username_sane;?> {
prepare("SELECT `value` FROM `filterconf`
WHERE `object`= :object
AND `option` = 'whitelist_from'");
$stmt->execute(array(':object' => $row['object']));
$list_items = $stmt->fetchAll(PDO::FETCH_ASSOC);
- while ($item = array_shift($list_items)) {
+ foreach ($list_items as $item) {
?>
from = "/='^' . str_replace('\*', '.*', preg_quote($item['value'], '/')) . '$' ;?>/i";
{
+ whitelist_mime_=$username_sane;?> {
prepare("SELECT `value` FROM `filterconf`
- WHERE `object`= :object
- AND `option` = 'whitelist_from'");
- $stmt->execute(array(':object' => $row['object']));
- $list_items = $stmt->fetchAll(PDO::FETCH_ASSOC);
+ foreach ($list_items as $item) {
?>
- header = {
+ from_mime = "/='^' . str_replace('\*', '.*', preg_quote($item['value'], '/')) . '$' ;?>/i";
- "From" = "/(=implode('|', $header_from);?>)/i";
- }
-
priority = 5;
@@ -297,13 +306,13 @@ while ($row = array_shift($rows)) {
?>
blacklist_=$username_sane;?> {
prepare("SELECT `value` FROM `filterconf`
WHERE `object`= :object
AND `option` = 'blacklist_from'");
$stmt->execute(array(':object' => $row['object']));
$list_items = $stmt->fetchAll(PDO::FETCH_ASSOC);
- while ($item = array_shift($list_items)) {
+ foreach ($list_items as $item) {
?>
from = "/='^' . str_replace('\*', '.*', preg_quote($item['value'], '/')) . '$' ;?>/i";
{
prepare("SELECT `value` FROM `filterconf`
- WHERE `object`= :object
- AND `option` = 'blacklist_from'");
- $stmt->execute(array(':object' => $row['object']));
- $list_items = $stmt->fetchAll(PDO::FETCH_ASSOC);
+ foreach ($list_items as $item) {
?>
- header = {
+ from_mime = "/='^' . str_replace('\*', '.*', preg_quote($item['value'], '/')) . '$' ;?>/i";
- "From" = "/(=implode('|', $header_from);?>)/i";
- }
-
priority = 5;
diff --git a/data/conf/rspamd/local.d/rspamd.conf.local b/data/conf/rspamd/local.d/rspamd.conf.local
deleted file mode 100644
index 0662c47d..00000000
--- a/data/conf/rspamd/local.d/rspamd.conf.local
+++ /dev/null
@@ -1,16 +0,0 @@
-# rspamd.conf.local
-
-worker "fuzzy" {
- # Socket to listen on (UDP and TCP from rspamd 1.3)
- bind_socket = "*:11445";
- allow_update = ["127.0.0.1", "::1"];
- # Number of processes to serve this storage (useful for read scaling)
- count = 2;
- # Backend ("sqlite" or "redis" - default "sqlite")
- backend = "redis";
- # Hashes storage time (3 months)
- expire = 90d;
- # Synchronize updates to the storage each minute
- sync = 1min;
-}
-
diff --git a/data/conf/rspamd/meta_exporter/pipe.php b/data/conf/rspamd/meta_exporter/pipe.php
index 3e29d207..692a0c2e 100644
--- a/data/conf/rspamd/meta_exporter/pipe.php
+++ b/data/conf/rspamd/meta_exporter/pipe.php
@@ -84,6 +84,9 @@ $rcpt_final_mailboxes = array();
// Loop through all rcpts
foreach (json_decode($rcpts, true) as $rcpt) {
+ // Remove tag
+ $rcpt = preg_replace('/^(.*?)\+.*(@.*)$/', '$1$2', $rcpt);
+
// Break rcpt into local part and domain part
$parsed_rcpt = parse_email($rcpt);
diff --git a/data/conf/rspamd/override.d/worker-fuzzy.inc b/data/conf/rspamd/override.d/worker-fuzzy.inc
new file mode 100644
index 00000000..09b39c93
--- /dev/null
+++ b/data/conf/rspamd/override.d/worker-fuzzy.inc
@@ -0,0 +1,12 @@
+# Socket to listen on (UDP and TCP from rspamd 1.3)
+bind_socket = "*:11445";
+allow_update = ["127.0.0.1", "::1"];
+# Number of processes to serve this storage (useful for read scaling)
+count = 2;
+# Backend ("sqlite" or "redis" - default "sqlite")
+backend = "redis";
+# Hashes storage time (3 months)
+expire = 90d;
+# Synchronize updates to the storage each minute
+sync = 1min;
+
diff --git a/data/conf/rspamd/override.d/worker-proxy.inc b/data/conf/rspamd/override.d/worker-proxy.inc
index 0df926a7..92527f2b 100644
--- a/data/conf/rspamd/override.d/worker-proxy.inc
+++ b/data/conf/rspamd/override.d/worker-proxy.inc
@@ -1,6 +1,6 @@
bind_socket = "rspamd:9900";
milter = true;
-upstream {
+upstream "local" {
name = "localhost";
default = true;
hosts = "rspamd:11333"
diff --git a/data/web/admin.php b/data/web/admin.php
index 6ca89e97..6826fec5 100644
--- a/data/web/admin.php
+++ b/data/web/admin.php
@@ -746,6 +746,7 @@ $tfa_data = get_tfa();
+
'
- );
- });
- }
- else {
- $( "#qid_detail_atts" ).text('-');
- }
+ $('body').on('click', '.show_qid_info', function (e) {
+ e.preventDefault();
+ var qitem = $(this).data('item');
+ var qError = $("#qid_error");
+
+ $('#qidDetailModal').modal('show');
+ qError.hide();
+
+ $.ajax({
+ url: '/inc/ajax/qitem_details.php',
+ data: { id: qitem },
+ dataType: 'json',
+ success: function(data){
+ if (typeof data.error !== 'undefined') {
+ qError.text(data.error);
+ qError.show();
}
- });
- })
- }
+ $('[data-id="qitems_single"]').each(function(index) {
+ $(this).attr("data-item", qitem);
+ });
+
+ $('#qid_detail_subj').text(data.subject);
+ $('#qid_detail_text').text(data.text_plain);
+ $('#qid_detail_text_from_html').text(data.text_html);
+
+ if (typeof data.attachments !== 'undefined') {
+ qAtts = $("#qid_detail_atts");
+ qAtts.text('');
+ $.each(data.attachments, function(index, value) {
+ qAtts.append(
+ '' + value[0] + ' (' + value[1] + ')' +
+ ' - ' + lang.check_hash + '
'
+ );
+ });
+ }
+ else {
+ qAtts.text('-');
+ }
+ }
+ });
+ });
+
// Initial table drawings
draw_quarantine_table();
});
diff --git a/data/web/lang/lang.de.php b/data/web/lang/lang.de.php
index 77aab3c6..b5fc4642 100644
--- a/data/web/lang/lang.de.php
+++ b/data/web/lang/lang.de.php
@@ -607,11 +607,11 @@ $lang['admin']['forwarding_hosts_hint'] = 'Eingehende Nachrichten werden von den
$lang['admin']['forwarding_hosts_add_hint'] = 'Sie können entweder IPv4/IPv6-Adressen, Netzwerke in CIDR-Notation, Hostnamen (die zu IP-Adressen aufgelöst werden), oder Domainnamen (die zu IP-Adressen aufgelöst werden, indem ihr SPF-Record abgefragt wird oder, in dessen Abwesenheit, ihre MX-Records) angeben.';
$lang['admin']['relayhosts_hint'] = 'Erstellen Sie senderabhängige Transporte, um diese im Einstellungsdialog einer Domain auszuwählen.
Der Transporttyp lautet immer "smtp:". Benutzereinstellungen bezüglich Verschlüsselungsrichtlinie werden beim Transport berücksichtigt.';
-$lang['admin']['transports_hint'] = 'Transport Maps überwiegen senderabhängige Transport Maps und ignorieren die individuellen Einstellungen eines Benutzers bezüglich Verschlüsselungsrichtlinie, da der Absender bei Ermittlung der Transportregel nicht berücksichtigt wird.
- Der Transport erfolgt immer via "smtp:".
- Ein Eintrag in der TLS Policy Map kann eine Verschlüsselung erzwingen.
- Die Authentifizierung wird anhand des Host Parameters ermittelt, hierbei würde bei einem beispielhaften Next Hop "[host]:25" immer zuerst "host" abfragt und erst im Anschluss "[host]:25".
- Dieses Verhalten schließt die gleichzeitige Verwendung von Einträgen der Art "host" sowie "[host]:25" aus.';
+$lang['admin']['transports_hint'] = '→ Transport Maps überwiegen senderabhängige Transport Maps.
+→ Transport Maps ignorieren Mailbox-Einstellungen für ausgehende Verschlüsselung. Eine serverweite TLS-Richtlinie wird jedoch angewendet.
+→ Der Transport erfolgt immer via "smtp:".
+→ Adressen, die mit "/localhost$/" übereinstimmen, werden immer via "local:" transportiert, daher sind sie von einer Zieldefinition "*" ausgeschlossen.
+→ Die Authentifizierung wird anhand des "Next hop" Parameters ermittelt. Hierbei würde bei einem beispielhaften Wert "[host]:25" immer zuerst "host" abfragt und erst im Anschluss "[host]:25". Dieses Verhalten schließt die gleichzeitige Verwendung von Einträgen der Art "host" sowie "[host]:25" aus.';
$lang['admin']['add_relayhost_hint'] = 'Bitte beachten Sie, dass Anmeldedaten unverschlüsselt gespeichert werden.
Angelegte Transporte dieser Art sind senderabhängig und müssen erst einer Domain zugewiesen werden, bevor sie als Transport verwendet werden.
Diese Einstellungen entsprechen demach nicht dem "relayhost" Parameter in Postfix.';
diff --git a/data/web/lang/lang.en.php b/data/web/lang/lang.en.php
index a8a276e0..0329a92d 100644
--- a/data/web/lang/lang.en.php
+++ b/data/web/lang/lang.en.php
@@ -631,9 +631,11 @@ $lang['admin']['forwarding_hosts_hint'] = 'Incoming messages are unconditionally
$lang['admin']['forwarding_hosts_add_hint'] = 'You can either specify IPv4/IPv6 addresses, networks in CIDR notation, host names (which will be resolved to IP addresses), or domain names (which will be resolved to IP addresses by querying SPF records or, in their absence, MX records).';
$lang['admin']['relayhosts_hint'] = 'Define sender-dependent transports to be able to select them in a domains configuration dialog.
The transport service is always "smtp:". A users individual outbound TLS policy setting is taken into account.';
-$lang['admin']['transports_hint'] = 'A transport map entry overrules a sender-dependent transport map.
-Outbound TLS policy settings per-user are ignored and can only be enfored by TLS policy map entries. The transport service is always "smtp:".
-To determine credentials for an exemplary next hop "[host]:25", Postfix always queries for "nexthop" before searching for "[nexthop]:25". This behavior makes it impossible to use "nexthop" and "[nexthop]:25" at the same time.';
+$lang['admin']['transports_hint'] = '→ A transport map entry overrules a sender-dependent transport map.
+→ Outbound TLS policy settings per-user are ignored and can only be enfored by TLS policy map entries.
+→ The transport service for defined transports is always "smtp:".
+→ Adresses matching "/localhost$/" will always be transported via "local:", therefore a "*" destination will not apply to those addresses.
+→ To determine credentials for an exemplary next hop "[host]:25", Postfix always queries for "host" before searching for "[host]:25". This behavior makes it impossible to use "host" and "[host]:25" at the same time.';
$lang['admin']['add_relayhost_hint'] = 'Please be aware that authentication data, if any, will be stored as plain text.';
$lang['admin']['add_transports_hint'] = 'Please be aware that authentication data, if any, will be stored as plain text.';
$lang['admin']['host'] = 'Host';
diff --git a/data/web/modals/footer.php b/data/web/modals/footer.php
index b5e49b15..b7ebaf08 100644
--- a/data/web/modals/footer.php
+++ b/data/web/modals/footer.php
@@ -81,7 +81,7 @@ if (isset($_SESSION['mailcow_cc_role']) && ($_SESSION['mailcow_cc_role'] == "adm
-
=$lang['tfa']['scan_qr_code'];?>
-
+
=$lang['tfa']['enter_qr_code'];?>:
=$totp_secret;?>
diff --git a/data/web/modals/mailbox.php b/data/web/modals/mailbox.php
index c12df381..11abbc58 100644
--- a/data/web/modals/mailbox.php
+++ b/data/web/modals/mailbox.php
@@ -785,24 +785,3 @@ if (!isset($_SESSION['mailcow_cc_role'])) {
-
diff --git a/data/web/sogo-auth.php b/data/web/sogo-auth.php
index 0cc4beee..08fb1b0b 100644
--- a/data/web/sogo-auth.php
+++ b/data/web/sogo-auth.php
@@ -5,7 +5,7 @@ $ALLOW_ADMIN_EMAIL_LOGIN = (preg_match(
$_ENV["ALLOW_ADMIN_EMAIL_LOGIN"]
));
-$session_var_user = 'sogo-sso-user';
+$session_var_user_allowed = 'sogo-sso-user-allowed';
$session_var_pass = 'sogo-sso-pass';
// prevent if feature is disabled
@@ -44,10 +44,10 @@ elseif (isset($_GET['login'])) {
// load master password
$sogo_sso_pass = file_get_contents("/etc/sogo-sso/sogo-sso.pass");
// register username and password in session
- $_SESSION[$session_var_user] = $login;
+ $_SESSION[$session_var_user_allowed][] = $login;
$_SESSION[$session_var_pass] = $sogo_sso_pass;
// redirect to sogo (sogo will get the correct credentials via nginx auth_request
- header("Location: /SOGo/");
+ header("Location: /SOGo/so/${login}");
exit;
}
}
@@ -55,24 +55,32 @@ elseif (isset($_GET['login'])) {
header('HTTP/1.0 403 Forbidden');
exit;
}
-// do not check for admin-login / sogo-sso for EAS and DAV requests, SOGo can check auth itself if no authorization header is set
+// only check for admin-login on sogo GUI requests
elseif (
- strcasecmp(substr($_SERVER['HTTP_X_ORIGINAL_URI'], 0, 28), "/Microsoft-Server-ActiveSync") !== 0 &&
- strcasecmp(substr($_SERVER['HTTP_X_ORIGINAL_URI'], 0, 9), "/SOGo/dav") !== 0
+ strcasecmp(substr($_SERVER['HTTP_X_ORIGINAL_URI'], 0, 9), "/SOGo/so/") === 0
) {
// this is an nginx auth_request call, we check for existing sogo-sso session variables
session_start();
- if (isset($_SESSION[$session_var_user]) && filter_var($_SESSION[$session_var_user], FILTER_VALIDATE_EMAIL)) {
- $username = $_SESSION[$session_var_user];
- $password = $_SESSION[$session_var_pass];
- header("X-User: $username");
- header("X-Auth: Basic ".base64_encode("$username:$password"));
- header("X-Auth-Type: Basic");
- } else {
- // if username is empty, SOGo will display the normal login form
- header("X-User: ");
- header("X-Auth: ");
- header("X-Auth-Type: ");
+ // extract email address from "/SOGo/so/user@domain/xy"
+ $url_parts = explode("/", $_SERVER['HTTP_X_ORIGINAL_URI']);
+ $email = $url_parts[3];
+ // check if this email is in session allowed list
+ if (
+ !empty($email) &&
+ filter_var($email, FILTER_VALIDATE_EMAIL) &&
+ is_array($_SESSION[$session_var_user_allowed]) &&
+ in_array($email, $_SESSION[$session_var_user_allowed])
+ ) {
+ $username = $email;
+ $password = $_SESSION[$session_var_pass];
+ header("X-User: $username");
+ header("X-Auth: Basic ".base64_encode("$username:$password"));
+ header("X-Auth-Type: Basic");
+ exit;
}
- exit;
}
+
+// if username is empty, SOGo will use the normal login methods / login form
+header("X-User: ");
+header("X-Auth: ");
+header("X-Auth-Type: ");
diff --git a/docker-compose.yml b/docker-compose.yml
index 46317570..f5265f89 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -71,7 +71,7 @@ services:
- clamd
rspamd-mailcow:
- image: mailcow/rspamd:1.34
+ image: mailcow/rspamd:1.38
build: ./data/Dockerfiles/rspamd
stop_grace_period: 30s
depends_on:
@@ -94,7 +94,7 @@ services:
- rspamd
php-fpm-mailcow:
- image: mailcow/phpfpm:1.34
+ image: mailcow/phpfpm:1.35
build: ./data/Dockerfiles/phpfpm
command: "php-fpm -d date.timezone=${TZ} -d expose_php=0"
depends_on:
@@ -195,6 +195,7 @@ services:
- MAILDIR_GC_TIME=${MAILDIR_GC_TIME:-1440}
- ACL_ANYONE=${ACL_ANYONE:-disallow}
- SKIP_SOLR=${SKIP_SOLR:-y}
+ - MAILDIR_SUB=${MAILDIR_SUB:-}
ports:
- "${DOVEADM_PORT:-127.0.0.1:19991}:12345"
- "${IMAP_PORT:-143}:143"
@@ -219,7 +220,7 @@ services:
- dovecot
postfix-mailcow:
- image: mailcow/postfix:1.29
+ image: mailcow/postfix:1.31
build: ./data/Dockerfiles/postfix
volumes:
- ./data/conf/postfix:/opt/postfix/conf
@@ -306,7 +307,7 @@ services:
acme-mailcow:
depends_on:
- nginx-mailcow
- image: mailcow/acme:1.48
+ image: mailcow/acme:1.49
build: ./data/Dockerfiles/acme
dns:
- ${IPV4_NETWORK:-172.22.1}.254
@@ -357,7 +358,7 @@ services:
- /lib/modules:/lib/modules:ro
watchdog-mailcow:
- image: mailcow/watchdog:1.35
+ image: mailcow/watchdog:1.37
# Debug
#command: /watchdog.sh
build: ./data/Dockerfiles/watchdog
@@ -405,11 +406,11 @@ services:
- dockerapi
solr-mailcow:
- image: mailcow/solr:1.2
+ image: mailcow/solr:1.4
build: ./data/Dockerfiles/solr
restart: always
volumes:
- - solr-vol-1:/opt/solr/server/solr/dovecot/data
+ - solr-vol-1:/opt/solr/server/solr/dovecot-fts/data
dns:
- ${IPV4_NETWORK:-172.22.1}.254
environment:
diff --git a/generate_config.sh b/generate_config.sh
index e6005b72..7ef9b7fe 100755
--- a/generate_config.sh
+++ b/generate_config.sh
@@ -16,6 +16,7 @@ if [ -f mailcow.conf ]; then
case $response in
[yY][eE][sS]|[yY])
mv mailcow.conf mailcow.conf_backup
+ chmod 600 mailcow.conf_backup
;;
*)
exit 1
@@ -237,9 +238,14 @@ IPV6_NETWORK=fd4d:6169:6c63:6f77::/64
#API_KEY=
#API_ALLOW_FROM=127.0.0.1,1.2.3.4
+# mail_home is ~/Maildir
+MAILDIR_SUB=Maildir
+
EOF
mkdir -p data/assets/ssl
+chmod 600 mailcow.conf
+
# copy but don't overwrite existing certificate
cp -n data/assets/ssl-example/*.pem data/assets/ssl/
diff --git a/helper-scripts/nextcloud.sh b/helper-scripts/nextcloud.sh
index d04f52d4..2ddac47a 100755
--- a/helper-scripts/nextcloud.sh
+++ b/helper-scripts/nextcloud.sh
@@ -76,9 +76,8 @@ elif [[ ${NC_UPDATE} == "y" ]]; then
curl -L# -o nextcloud.tar.bz2 "https://download.nextcloud.com/server/releases/latest-15.tar.bz2" || { echo "Failed to download Nextcloud archive."; exit 1; } \
&& tar -xjf nextcloud.tar.bz2 -C ./data/web/ \
&& rm nextcloud.tar.bz2 \
- && rm -rf ./data/web/nextcloud/updater \
+ #&& rm -rf ./data/web/nextcloud/updater \
&& mkdir -p ./data/web/nextcloud/data \
- && mkdir -p ./data/web/nextcloud/custom_apps \
&& chmod +x ./data/web/nextcloud/occ
docker exec -it $(docker ps -f name=php-fpm-mailcow -q) bash -c "chown www-data:www-data -R /web/nextcloud"
docker exec -it -u www-data $(docker ps -f name=php-fpm-mailcow -q) bash -c "/web/nextcloud/occ --no-warnings upgrade"
@@ -106,12 +105,11 @@ elif [[ ${NC_INSTALL} == "y" ]]; then
curl -L# -o nextcloud.tar.bz2 "https://download.nextcloud.com/server/releases/latest-15.tar.bz2" || { echo "Failed to download Nextcloud archive."; exit 1; } \
&& tar -xjf nextcloud.tar.bz2 -C ./data/web/ \
&& rm nextcloud.tar.bz2 \
- && rm -rf ./data/web/nextcloud/updater \
+ #&& rm -rf ./data/web/nextcloud/updater \
&& mkdir -p ./data/web/nextcloud/data \
- && mkdir -p ./data/web/nextcloud/custom_apps \
&& chmod +x ./data/web/nextcloud/occ
- docker exec -it $(docker ps -f name=php-fpm-mailcow -q) /bin/bash -c "chown -R www-data:www-data /web/nextcloud/data /web/nextcloud/config /web/nextcloud/apps /web/nextcloud/custom_apps"
+ docker exec -it $(docker ps -f name=php-fpm-mailcow -q) /bin/bash -c "chown -R www-data:www-data /web/nextcloud/data /web/nextcloud/config /web/nextcloud/apps"
docker exec -it -u www-data $(docker ps -f name=php-fpm-mailcow -q) /web/nextcloud/occ --no-warnings maintenance:install \
--database mysql \
--database-host mysql \
diff --git a/update.sh b/update.sh
index 9c18e0cc..00d64b2b 100755
--- a/update.sh
+++ b/update.sh
@@ -6,9 +6,12 @@ if [ "$(id -u)" -ne "0" ]; then
exit 1
fi
-#exit on error and pipefail
+# Exit on error and pipefail
set -o pipefail
+# Add /opt/bin to PATH
+PATH=$PATH:/opt/bin
+
umask 0022
for bin in curl docker-compose docker git awk sha1sum; do
@@ -68,8 +71,12 @@ while (($#)); do
case "${1}" in
--check|-c)
echo "Checking remote code for updates..."
- git fetch origin #${BRANCH}
- if [[ -z $(git log HEAD --pretty=format:"%H" | grep $(git rev-parse origin/${BRANCH})) ]]; then
+ LATEST_REV=$(git ls-remote --exit-code --refs --quiet https://github.com/mailcow/mailcow-dockerized ${BRANCH} | cut -f1)
+ if [ $? -ne 0 ]; then
+ echo "A problem occurred while trying to fetch the latest revision from github."
+ exit 99
+ fi
+ if [[ -z $(git log HEAD --pretty=format:"%H" | grep "${LATEST_REV}") ]]; then
echo "Updated code is available."
exit 0
else
@@ -98,6 +105,7 @@ while (($#)); do
done
[[ ! -f mailcow.conf ]] && { echo "mailcow.conf is missing"; exit 1;}
+chmod 600 mailcow.conf
source mailcow.conf
DOTS=${MAILCOW_HOSTNAME//[^.]};
if [ ${#DOTS} -lt 2 ]; then
@@ -127,6 +135,7 @@ CONFIG_ARRAY=(
"API_KEY"
"API_ALLOW_FROM"
"MAILDIR_GC_TIME"
+ "MAILDIR_SUB"
"ACL_ANYONE"
"SOLR_HEAP"
"SKIP_SOLR"
@@ -236,6 +245,13 @@ for option in ${CONFIG_ARRAY[@]}; do
echo '# Disable Solr or if you do not want to store a readable index of your mails in solr-vol-1.' >> mailcow.conf
echo "SKIP_SOLR=y" >> mailcow.conf
fi
+ elif [[ ${option} == "MAILDIR_SUB" ]]; then
+ if ! grep -q ${option} mailcow.conf; then
+ echo "Adding new option \"${option}\" to mailcow.conf"
+ echo '# MAILDIR_SUB defines a path in a users virtual home to keep the maildir in. Leave empty for updated setups.' >> mailcow.conf
+ echo "#MAILDIR_SUB=Maildir" >> mailcow.conf
+ echo "MAILDIR_SUB=" >> mailcow.conf
+ fi
elif ! grep -q ${option} mailcow.conf; then
echo "Adding new option \"${option}\" to mailcow.conf"
echo "${option}=n" >> mailcow.conf
@@ -352,9 +368,8 @@ if grep -q 'SYSCTL_IPV6_DISABLED=1' mailcow.conf; then
read -p "Press any key to continue..." < /dev/tty
fi
-echo -e "Fixing project name... "
+# Checking for old project name bug
sed -i 's#COMPOSEPROJECT_NAME#COMPOSE_PROJECT_NAME#g' mailcow.conf
-sed -i '/COMPOSE_PROJECT_NAME=/s/-//g' mailcow.conf
echo -e "Fixing PHP-FPM worker ports for Nginx sites..."
sed -i 's#phpfpm:9000#phpfpm:9002#g' data/conf/nginx/*.conf