Skip to content

Commit

Permalink
Increase mail_max_userip_connections for trusted connections
Browse files Browse the repository at this point in the history
Implement the same configuration of NS7: if the connection comes from a
trusted network (cluster VPN) the connection limit per user is
increased.

This is a workaround for Webtop client, that opens many connections
simultaneously.
  • Loading branch information
DavidePrincipi committed Oct 30, 2024
1 parent 099ffdf commit 93aedf1
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion dovecot/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ Private TCP ports:
- `DOVECOT_SPAM_SUBJECT_PREFIX`, default empty. If set, the string is prefixed to the message `Subject:` header.
- `DOVECOT_SPAMT_PASS`, password for Rspamd API, required for ham/spam training
- `DOVECOT_TRASH_FOLDER`, default `Trash`. Mailbox folder name where messages are moved when they are deleted.
- `DOVECOT_MAX_USERIP_CONNECTIONS`, default `20`. Set dovecot `mail_max_userip_connections` configuration parameter.
- `DOVECOT_MAX_USERIP_CONNECTIONS`, default `20`. Set dovecot `mail_max_userip_connections` configuration parameter. This limit is rasied 5 times for connections coming from trusted networks
- `DOVECOT_SHAREDSEEN`, default empty. If set, the SEEN flag of shared folders is stored in a `dovecot.pvt*` index file, for every user

## Logs
Expand Down
13 changes: 13 additions & 0 deletions dovecot/usr/local/bin/reload-config
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ fi
# Add the user_domain to /etc/hosts to quiet dns queries
if ! grep -qxF '#user_domain' /etc/hosts; then
# user_domain is not present in /etc/hosts
# shellcheck disable=SC3036
echo -e "\n#user_domain\n${ldap_host} ${ldap_domain}" >> /etc/hosts
else
# /etc/hosts is mounted in the container,
Expand All @@ -116,6 +117,18 @@ fi
fi
)

(
exec >/etc/dovecot/trusted_networks.conf
echo "# Special settings for trusted networks"
# shellcheck disable=SC3060
for network in ${DOVECOT_TRUSTED_NETWORKS//,/ } ; do
echo "remote ${network} {"
echo " mail_max_userip_connections =" $(( ${DOVECOT_MAX_USERIP_CONNECTIONS:-20} * 5 ))
echo "}"
echo ""
done
)

if [ -f /run/dovecot/master.pid ]; then
doveadm reload
fi

0 comments on commit 93aedf1

Please sign in to comment.