Centos – Limit concurrent connections to Postfix server

centosconcurrencypostfixsmtpd

I'm having trouble limiting the number of concurrent connections from the same client to my Postfix server. Limiting the maximal number of concurrent processes, from the same or different clients, is done easily.

Here are the two parameters that I'm using on main.cf to do so:

default_process_limit = 50
smtpd_client_connection_count_limit = 25

When testing, I run 100 concurrent connections (threads) from the same client, but it limits at 50 smtpd processes instead of just 25. Here is how I'm counting the smtpd processes at the server:

ps -C smtpd | wc -l

Does anyone know why this happens?

Best Answer

If you want to change the maximal number of smtpd running you should make your changes in /etc/postfix/master.cf. You change - to 50 in the 7th column then restart postfix with postfix restart (or a distro specific substitute).

# ==========================================================================
# service type  private unpriv  chroot  wakeup  maxproc command + args
#               (yes)   (yes)   (yes)   (never) (100)
# ==========================================================================
smtp      inet  n       -       -       -       -       smtpd

change this to

smtp      inet  n       -       -       -       50      smtpd

smtpd_client_connection_count_limit limits how many connections an smtp client can make.

It does not say how many smtpd servers will run by default. (smtpd_client_connection_count_limit is by default half of the default process limit.)