I'm running Zimbra 8.8.9 and I'm trying to rate limit the number of messages that a single user can send over smtp after authenticating with smtp-auth. The purpose is to limit the damage in case one of the passwords of my users is guessed/obtained by a spammer.
Zimbra ships CBPolicyD (www.policyd.org) as part of zimbra-mta package, but it's disabled by default.
I followed the howto at https://wiki.zimbra.com/wiki/How-to_for_cbpolicyd and enabled policyd with:
zmprov ms zimbra.mydomain.tld +zimbraServiceInstalled cbpolicyd
zmprov ms zimbra.mydomain.tld +zimbraServiceEnabled cbpolicyd
I also activated the web interface:
sudo -s
cd /opt/zimbra/data/httpd/htdocs
ln -s ../../../common/share/webui
and setup Zimbra's Apache to serve this new dir:
- edit /opt/zimbra/conf/httpd.conf
- add
Alias /webui /opt/zimbra/common/share/webui/
to the end of the file - restart Zimbra
I edited the config file at /opt/zimbra/common/share/webui/includes/config.php
to point to the proper sqlite db:
$DB_DSN="sqlite:/opt/zimbra/data/cbpolicyd/db/cbpolicyd.sqlitedb";
and finally added a cronjob to periodically cleanup the tracking database at the end of zimbra's crontab:
# ZIMBRAEND -- DO NOT EDIT ANYTHING BETWEEN THIS LINE AND ZIMBRASTART
0 * * * * cat /opt/zimbra/log/clean_cbpolicyd_daily.sql | sqlite3 /opt/zimbra/data/cbpolicyd/db/cbpolicyd.sqlitedb
I couldn't find a step-by-step example of how to setup the rate limiting using policyd webui and the interface is far from intuitive to use.
How do I have policyd count emails sent by each account and rate limit them?