From iRedMail
iRedMail implements sender & recipient throttling via policyd-1.8.x, but it's disabled by default. You can enable it by follow below steps on FreeBSD:
We choose to run two Policyd instances/daemons:
- one listens on port 10031, used for greylisting, white/blacklisting and recipient throttling.
- another one listens on port 10032, used for sender throttling.
Here we go:
- Disable sender throttling in '/usr/local/etc/postfix-policyd-sf.conf, but enable recipient throttling:
| File: /usr/local/etc/postfix-policyd-sf.conf
|
SENDERTHROTTLE=0
SENDER_THROTTLE_SASL=0
SENDER_THROTTLE_HOST=0
# Enable recipient throttling in this instance, will be invoked in Postfix
# smtpd_recipient_restrictions.
RECIPIENTTHROTTLE=1
|
- Enable throttling in /usr/local/etc/policyd_sender_throttle.conf:
| File: /usr/local/etc/policyd_sender_throttle.conf
|
SENDERTHROTTLE=1
SENDER_THROTTLE_SASL=1
SENDER_THROTTLE_HOST=0
# Disable recipient throttling in this instance.
# Recipient Throttling can not work at smtpd_end_of_data_restrictions. Policyd v2 (a.k.a. Cluebringer)
# overcomes this and tracks the recipients for each smtpd instance. To track quotas
# precisely v2 can be used in smtpd_recipient_restrictions and smtpd_end_of_data_restrictions.
# v2 knows about the various restrictions.
# Reference: http://comments.gmane.org/gmane.mail.postfix.policyd/826
RECIPIENTTHROTTLE=0
|
- Create another policyd rc script:
| Terminal:
|
# cd /usr/local/etc/rc.d/
# cp policyd policyd_sender_throttle
# perl -pi -e 's#postfix-policyd-sf#policyd_sender_throttle#g' policyd_sender_throttle
# perl -pi -e 's#^(command=).*#${1}/usr/local/sbin/postfix-policyd-sf#' policyd_sender_throttle
|
- Append below line to /etc/rc.conf:
| File: /etc/rc.conf
|
policyd_sender_throttle_enable='YES'
|
- Restart policyd service now:
| Terminal:
|
# /usr/local/etc/rc.d/policyd restart
# /usr/local/etc/rc.d/policyd_sender_throttle restart
|
It will listen on two ports: 10031, 10032. You can verify it via command sockstat:
| Terminal:
|
# sockstat -4 | grep -i 1003
policyd postfix-po 1193 6 tcp4 127.0.0.1:10032 *:*
policyd postfix-po 911 6 tcp4 127.0.0.1:10031 *:*
|
- Enable throttling in Postfix /usr/local/etc/postfix/main.cf:
| File: /usr/local/etc/postfix/main.cf
|
smtpd_end_of_data_restrictions = check_policy_service inet:127.0.0.1:10032
|
Restart postfix:
| Terminal:
|
# /usr/local/etc/rc.d/postfix restart
|
That's all.
Refer to Policyd official documentation to set throttling: http://policyd.sourceforge.net/readme.html