Comments on Improve Spam abuse protection in dovecot by restricting access to mail accounts by IP address (e. g. with ISPConfig 3)
Improve Spam abuse protection in dovecot by restricting access to mail accounts by IP address (e. g. with ISPConfig 3) This howto will show you how to add ip restrictions to single mail accounts when using dovecot with MySQL. This is especially useful if you need to access a mail account from only one single ip or a few ips or if you want to block specific ip addresses from accessing the mail account (e. g. due to spam abuse).
4 Comment(s)
Comments
Hi,
Be careful, it seems that there is a little mistake into the new user_query.You forgot a "b" in the second LEFT JOIN : "rb.service".
user_query = SELECT m.email as user, m.maildir as home, CONCAT('maildir:', m.maildir, '/Maildir') as mail, m.uid, m.gid, CONCAT('*:storage=', m.quota, 'B') AS quota_rule, CONCAT(m.maildir, '/.sieve') as sieve
FROM mail_user as m LEFT JOIN mail_user_ip_restriction as r ON (r.mailuser_id = m.mailuser_id AND r.mode = 'w' AND r.service IN ('', '%Ls'))
LEFT JOIN mail_user_ip_restriction as rb ON (rb.mailuser_id = m.mailuser_id AND rb.ip = '%r' AND rb.mode = 'b' AND rb.service IN ('', '%Ls'))
WHERE (m.login = '%u' OR m.email = '%u') AND m.disable%Ls = 'n' AND (r.ip IS NULL OR r.ip = '%r') AND rb.ip IS NULL b.service IN ('', '%Ls'))
Thanks a lot for this tutorial. It works fine.
Best regards,
Johan.
Thanks a lot for your hint. Of course it has to be rb.service in the second join. My fault :) Corrected it in the howto.
I would like to see this in ISPConfig since it is a very useful functionality.
There are thoughts regarding this, but sadly courier does not support this and there is no way getting courier do deal with it.
Since ISPConfig supports dovecot and courier it might lead to problems having this integrated.