Hey guys!
I noticed that cbpolicyd does not initialize correctly in version 24.7.0 and 27.7.1 and after research I found a workaround to start the service.
This solution was developed by @anahuac which serves to initialize cbpolicy correctly:
Edit the /opt/zextras/bin/zmcbpolicydctl file and replace the getpid set.
getpid() {
# pid=$(pidof /opt/zextras/common/bin/cbpolicyd)
pid=$(ps aux | grep"/opt/zextras/common/bin/cbpolicyd" | grep -v grep | tr -s ' ' | cut -d" " -f2 | tr '\n' ' ')
}
Once the correction was made to the file, cbpolicy loads without errors:
zextras@mail:~$ zmcontrol status
Host mail.example.tec.br
amavis Running
antispam Running
antivirus Running
cbpolicyd Running
directory-server Running
mailbox Running
memcached Running
mta Running
opendkim Running
proxy Running
service webapp Running
service-discover Running
stats Running
config service Running
zextras@mail:~$
But when I check the apache log /var/log/apache2/error.log this message appears for all actions:
[php:warn] [pid 161998] [client 10.5.0.170:62643] PHP Warning: Undefined variable $DB_TABLE_PREFIX in /opt/zextras/common/...
Does anyone have any idea how to fix this, or what the problem is?
I managed to resolve the Undefined variable $DB_TABLE_PREFIX warning message by changing the file:
/opt/zextras/common/share/webui/includes/config.php
leaving it like this:
<?php
#$DB_DSN="mysql:host=localhost;dbname=cluebringer";
$DB_DSN="sqlite:/opt/zextras/data/cbpolicyd/db/cbpolicyd.sqlitedb";
$DB_USER="root"
$DB_TABLE_PREFIX="";?>
But now another error has appeared apparently looking like the table does not exist.
[php:error] [pid 374889] [client 10.5.0.170:64999] PHP Fatal error: Uncaught PDOException: SQLSTATE[HY000]: General error: 1 no such table: quota_limits in /opt/zextras/common/share/webui/quotas-limits-main.php:40\nStack trace:\n#0
I accessed the cbpolicyd.sqlite db file and checked the tables:
root@mail:/opt/zextras/data/cbpolicyd/db# sqlite3 cbpolicyd.sqlitedb
SQLite version 3.37.2 2022-01-06 13:25:41
Enter ".help" for usage hints.
sqlite> .tables
access_control greylisting_autowhitelist
accounting greylisting_tracking
accounting_tracking greylisting_whitelist
amavis_rules policies
checkhelo policy_group_members
checkhelo_blacklist policy_groups
checkhelo_tracking policy_members
checkhelo_whitelist quotas
checkspf quotas_limits
greylisting quotas_tracking
greylisting_autoblacklist session_tracking
sqlite>select * from quotas_limits;
1|1|MessageCount|10||0
2|1|MessageCumulativeSize|8000||0
3|2|MessageCount|12||0
sqlite>
Hey
cbpolicyd does not initialize correctly in version 24.7.0 CE
Starting cbpolicyd...Failed.
Starting policyd...failed.