Debugging Dovecot IMAP Connection Limits: Why mail_max_userip_connections Settings Are Ignored


8 views

When you see Dovecot stubbornly enforcing a 10-connection limit despite explicitly setting mail_max_userip_connections = 50, several factors could be at play. Let's examine this systematically.

Dovecot processes configuration files in a specific order. From your grep output, we see multiple instances of the parameter:

/etc/dovecot/conf.d/20-managesieve.conf:  #mail_max_userip_connections = 10
/etc/dovecot/conf.d/20-pop3.conf:  #mail_max_userip_connections = 3
/etc/dovecot/conf.d/20-imap.conf:  mail_max_userip_connections = 50

Even though 20-imap.conf sets the correct value, other protocol files might be interfering. The solution is to explicitly override all instances:

# In /etc/dovecot/conf.d/90-overrides.conf
protocol imap {
    mail_max_userip_connections = 50
}

protocol pop3 {
    mail_max_userip_connections = 50
}

protocol managesieve {
    mail_max_userip_connections = 50
}

Dovecot has a hierarchical configuration structure. Global settings can be overridden by protocol-specific settings, which in turn can be overridden by service-specific settings. Check if you have any service blocks overriding your settings:

service imap {
    # This would override protocol settings
    mail_max_userip_connections = 10
}

After making changes, verify what Dovecot actually sees using:

dovecot -n

This will show the final compiled configuration with all includes processed. Look for mail_max_userip_connections in the output.

1. Incorrect config reload: Some distributions need systemctl reload dovecot while others need a full restart
2. Multiple config directories: Check both /etc/dovecot/conf.d and /etc/dovecot/conf.d/*.conf
3. Cached connections: Existing connections might count against your limit until they timeout

For real-time monitoring of IMAP connections:

doveadm who
doveadm connected -v

These will show active connections and their counts per user/IP.

If you need different limits for different users, consider using dict-based configuration:

plugin {
    mail_max_userip_connections = dict:user/%u/limit
}

Then populate the dictionary with user-specific values.


When working with Dovecot IMAP servers, connection limits can be particularly frustrating when they don't behave as expected. Let's examine why your mail_max_userip_connections=50 setting might be getting overridden by the default value of 10.

Dovecot loads configuration files in a specific order, and later files can override earlier ones. Your grep output shows:

/etc/dovecot/conf.d/20-managesieve.conf:  #mail_max_userip_connections = 10
/etc/dovecot/conf.d/20-pop3.conf:  #mail_max_userip_connections = 3
/etc/dovecot/conf.d/20-imap.conf:  mail_max_userip_connections = 50

The key insight here is that the commented-out value in managesieve.conf might still be taking precedence over your explicit setting in imap.conf.

To properly diagnose this issue:

  1. Check the actual effective configuration:
    doveconf -n | grep mail_max_userip_connections
  2. Verify the load order of your config files:
    doveconf -a | grep include
  3. Look for service-specific overrides that might be limiting IMAP connections

To ensure your setting takes effect:

# Create or modify /etc/dovecot/conf.d/99-custom.conf
service imap {
  mail_max_userip_connections = 50
}

After making changes:

systemctl restart dovecot
doveconf -n | grep mail_max_userip_connections
tail -f /var/log/mail.log

Remember that some clients (especially mobile) may create multiple connections, so monitor actual usage patterns.