diff --git a/.env.dist b/.env.dist index 819bfe01..81ae68dd 100644 --- a/.env.dist +++ b/.env.dist @@ -101,6 +101,16 @@ ENABLE_POSTFIX_VIRTUAL_TRANSPORT= # etc. POSTFIX_DAGENT= +# Set the mailbox size limit for all users. If set to zero, the size will be unlimited (default). +# +# empty => 0 +POSTFIX_MAILBOX_SIZE_LIMIT= + +# Set the message size limit for all users. If set to zero, the size will be unlimited (not recommended!) +# +# empty => 1048576 (10 MB) +POSTFIX_MESSAGE_SIZE_LIMIT= + # Enables a report being sent (created by pflogsumm) on a regular basis. # **0** => Report emails are disabled # 1 => Using POSTMASTER_ADDRESS as the recipient diff --git a/README.md b/README.md index 12996be6..729c35ec 100644 --- a/README.md +++ b/README.md @@ -190,6 +190,7 @@ services: - SASLAUTHD_LDAP_PASSWORD=admin - SASLAUTHD_LDAP_SEARCH_BASE=ou=people,dc=localhost,dc=localdomain - POSTMASTER_ADDRESS=postmaster@localhost.localdomain + - POSTFIX_MESSAGE_SIZE_LIMIT=100000000 cap_add: - NET_ADMIN - SYS_PTRACE @@ -303,6 +304,18 @@ Enabled by ENABLE_POSTFIX_VIRTUAL_TRANSPORT. Specify the final delivery of postf - `lmtp::2003` (use kopano as mailstore) - etc. +##### POSTFIX\_MAILBOX\_SIZE\_LIMIT + +Set the mailbox size limit for all users. If set to zero, the size will be unlimited (default). + +- **empty** => 0 (no limit) + +##### POSTFIX\_MESSAGE\_SIZE\_LIMIT + +Set the message size limit for all users. If set to zero, the size will be unlimited (not recommended!) + +- **empty** => 1048576 (10 MB) + ##### ENABLE_MANAGESIEVE - **empty** => Managesieve service disabled diff --git a/docker-compose.yml.dist b/docker-compose.yml.dist index 5a6f84f1..8768e57d 100644 --- a/docker-compose.yml.dist +++ b/docker-compose.yml.dist @@ -36,6 +36,8 @@ services: - VIRUSMAILS_DELETE_DELAY=${VIRUSMAILS_DELETE_DELAY} - ENABLE_POSTFIX_VIRTUAL_TRANSPORT=${ENABLE_POSTFIX_VIRTUAL_TRANSPORT} - POSTFIX_DAGENT=${POSTFIX_DAGENT} + - POSTFIX_MAILBOX_SIZE_LIMIT=${POSTFIX_MAILBOX_SIZE_LIMIT} + - POSTFIX_MESSAGE_SIZE_LIMIT=${POSTFIX_MESSAGE_SIZE_LIMIT} - ENABLE_SPAMASSASSIN=${ENABLE_SPAMASSASSIN} - SA_TAG=${SA_TAG} - SA_TAG2=${SA_TAG2} diff --git a/target/start-mailserver.sh b/target/start-mailserver.sh index e4b8d1df..2a610d68 100644 --- a/target/start-mailserver.sh +++ b/target/start-mailserver.sh @@ -19,6 +19,8 @@ DEFAULT_VARS["ENABLE_POSTGREY"]="${ENABLE_POSTGREY:="0"}" DEFAULT_VARS["POSTGREY_DELAY"]="${POSTGREY_DELAY:="300"}" DEFAULT_VARS["POSTGREY_MAX_AGE"]="${POSTGREY_MAX_AGE:="35"}" DEFAULT_VARS["POSTGREY_TEXT"]="${POSTGREY_TEXT:="Delayed by postgrey"}" +DEFAULT_VARS["POSTFIX_MESSAGE_SIZE_LIMIT"]="${POSTFIX_MESSAGE_SIZE_LIMIT:="1048576"}" # 10 MB by default +DEFAULT_VARS["POSTFIX_MAILBOX_SIZE_LIMIT"]="${POSTFIX_MAILBOX_SIZE_LIMIT:="0"}" # no limit by default DEFAULT_VARS["ENABLE_SASLAUTHD"]="${ENABLE_SASLAUTHD:="0"}" DEFAULT_VARS["SMTP_ONLY"]="${SMTP_ONLY:="0"}" DEFAULT_VARS["DMS_DEBUG"]="${DMS_DEBUG:="0"}" @@ -123,6 +125,7 @@ function register_functions() { _register_setup_function "_setup_postfix_vhost" _register_setup_function "_setup_postfix_dhparam" _register_setup_function "_setup_postfix_postscreen" + _register_setup_function "_setup_postfix_sizelimits" if [ "$SPOOF_PROTECTION" = 1 ]; then _register_setup_function "_setup_spoof_protection" @@ -653,6 +656,13 @@ function _setup_postfix_postscreen() { -e "s/postscreen_bare_newline_action = enforce/postscreen_bare_newline_action = $POSTSCREEN_ACTION/" /etc/postfix/main.cf } +function _setup_postfix_sizelimits() { + notify 'inf' "Configuring postfix message size limit" + postconf -e "message_size_limit = ${DEFAULT_VARS["POSTFIX_MESSAGE_SIZE_LIMIT"]}" + notify 'inf' "Configuring postfix mailbox size limit" + postconf -e "mailbox_size_limit = ${DEFAULT_VARS["POSTFIX_MAILBOX_SIZE_LIMIT"]}" +} + function _setup_spoof_protection () { notify 'inf' "Configuring Spoof Protection" sed -i 's|smtpd_sender_restrictions =|smtpd_sender_restrictions = reject_authenticated_sender_login_mismatch,|' /etc/postfix/main.cf