From 4f36b72dd6a4602b3af0879b47beb899858735ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philipp=20D=C3=B6rfler?= Date: Tue, 13 Mar 2018 10:43:30 +0000 Subject: [PATCH] Added dovecot option for mail_max_userip_connections defaulting to 100 --- default.nix | 12 +++++++++++- mail-server/dovecot.nix | 8 ++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/default.nix b/default.nix index 77dca63..43041a5 100644 --- a/default.nix +++ b/default.nix @@ -408,12 +408,22 @@ in type = types.bool; default = false; description = '' - Whether to enable verbose logging for mailserver related services. This + Whether to enable verbose logging for mailserver related services. This intended be used for development purposes only, you probably don't want to enable this unless you're hacking on nixos-mailserver. ''; }; + maxConnectionsPerUser = mkOption { + type = types.int; + default = 100; + description = '' + Maximum number of IMAP/POP3 connections allowed for a user from each IP address. + E.g. a value of 50 allows for 50 IMAP and 50 POP3 connections at the same + time for a single user. + ''; + }; + localDnsResolver = mkOption { type = types.bool; default = true; diff --git a/mail-server/dovecot.nix b/mail-server/dovecot.nix index 26a8002..4294a2d 100644 --- a/mail-server/dovecot.nix +++ b/mail-server/dovecot.nix @@ -67,6 +67,14 @@ in verbose_ssl = yes ''} + protocol imap { + mail_max_userip_connections = ${toString cfg.maxConnectionsPerUser} + } + + protocol pop3 { + mail_max_userip_connections = ${toString cfg.maxConnectionsPerUser} + } + mail_access_groups = ${vmailGroupName} ssl = required ${lib.optionalString (dovecotVersion.major == 2 && dovecotVersion.minor >= 3) ''