One of the modules provided by PolicyD is Accounting module. Accounting module has similar function as the Quota module that performs the Message Count Limit Counter or Message Cumulative Size in email. The differences between them are in in the policy period. Accounting module divided into three periods : Daily, Weekly dan Monthly. One example of the use of accounting module in PolicyD is to restrict sending mail from a particular user to a maximum of 100 thousand emails per month.
Accounting module supported on PolicyD since version r343 (v2.1.0). This module supports message count and message cumulative size over a fixed period of time. Message counters can be based on (Tracked) depending on sender, recipient or sender IP.
On previous tutorial : Zimbra Tips : Rate-Limit Sending Message With Policyd, Accounting module is not activated by default. Below is a tutorial on the procedure for activation of the accounting module in PolicyD.
cd /opt/zimbra/cbpolicyd/share/database/
./convert-tsql sqlite accounting.tsql > /tmp/accounting.sql
vi /tmp/accounting.sql
On accounting sql file, remove all line starting with hash/comment tag (#) and then save.
Login as the Zimbra user and enable Accounting modules PolicyD
su - zimbra
zmlocalconfig -e cbpolicyd_module_accounting=1
vi /opt/zimbra/conf/cbpolicyd.conf.in
Edit the section ‘Modules to Load’ to be like this :
# Modules to load
modules=<
and contents on the bottom gonna be like this :
[AccessControl]
enable=@@cbpolicyd_module_accesscontrol@@
[Accounting]
enable=@@cbpolicyd_module_accounting@@
[Greylisting]
enable=@@cbpolicyd_module_greylisting@@
[CheckHelo]
enable=@@cbpolicyd_module_checkhelo@@
[CheckSPF]
enable=@@cbpolicyd_module_checkspf@@
[Quotas]
enable=@@cbpolicyd_module_quotas@@
Inject the newly converted accounting database
sqlite3 /opt/zimbra/data/cbpolicyd/db/cbpolicyd.sqlitedb < /tmp/accounting.sql
Restart Service PolicyD
zmcbpolicydctl restart
Next you can use the PolicyD web admin to enable accounting module and applying some restriction.