install: deb7,deb8
Installation
1. Install a DBMS (MySQL for instance), cluebringer, and cluebringer-webui :
apt-get install mysql-server cluebringer cluebringer-mysql cluebringer-webui
Note that cluebringer-webui will install apache as a dependency if you don’t already have a webserver.
2.Set-up the Cluebringer databaseGet the initial database schema that correspond to your DBMS, for instance mysql :
cp /usr/share/doc/postfix-cluebringer/database/policyd-db.mysql.gz ~/ && gunzip ~/policyd-db.mysql.gz
3.Create the database, and populate it with the initial dump :
# cd ~/ && mysql -u root -pmysql> CREATE DATABASE cluebringer;
mysql> CREATE USER 'cluebringer'@'localhost' IDENTIFIED BY 'mypassword';
mysql> GRANT ALL PRIVILEGES ON cluebringer.* TO 'cluebringer'@'localhost';
mysql> \. policyd-db.mysql
mysql> quit
mysql> Bye
Note that on Debian I had to modify the dump to make it work, TYPE=InnoDB was rejected by MySQL as an invalid syntax.Editors db.mysql you replace the Policy-TYPE = InnoDB -> ENGINE = InnoDB
4.Configure CluebringerAdd your DBMS credentials to the file /etc/cluebringer/cluebringer.conf
DSN=DBI:mysql:dbname=cluebringer;host=localhost
DB_Type=mysql
DB_Host=localhost
DB_Port=3306
DB_Name=cluebringer
Username=cluebringer
Password=mypassword
service postfix-cluebringer start
5.Configure Cluebringer webuiConfigure the file /etc/cluebringer/cluebringer-webui.conf with your DBMS credentials :
<?php$DB_DSN="mysql:host=localhost;dbname=cluebringer";$DB_USER="cluebringer";$DB_PASS="mypassword";
Cluebringer Webui needs a web server to run. Copy the sample configuration from the package documentation :
cp /usr/share/doc/postfix-cluebringer-webui/examples/httpd/cluebringer-httpd.conf /etc/apache2/conf.d/
Restart Apache :
service apache2 restart
6.Configure Cluebringer using its webuiAdd a policy
Under Policies -> Main, disable Test policy (select policy and choose Action -> Change and switch Disabled to yes, validate)
Add a new policy : Action -> Add, give it a name and a description
Activate your new policy : select policy and choose Action -> Change (switch Disabled to no)
Add a new member to your policy : select it and choose Action -> Members, and then Action -> Add. Specify any as source and any as destination.
Go back to your policy, choose Action -> Members, and the select your member, do Action -> Change, and activate your new member (switch Disabled tono).
Add a quota
Under Quotas -> Configure, disable Test quotas.
Add a new quota : Choose Action -> Add
- Name : whatever you want
- Track : user@domain
- Period (seconds) : 3600
- Link to policy : specify the policy you created here
- Verdict : Defer
- Data : set a custom error message here
- Comment : whatever you want
Activate your quota : switch Disabled to no.
Add a limit to your quota : select your quota, and choose Action -> Limits, then Action -> Add.
- Type : MessageCount
- Counter Limit : 200
Activate your limit : switch Disabled to no.
7.Configure Postfix to call Cluebringer for each mail sent
Open /etc/postfix/main.cf and locate the line smtpd_sender_restrictions.
Add check_policy_service inet:127.0.0.1:10031 at the end of the line, for instance :
smtpd_sender_restrictions = check_sender_access mysql:/etc/postfix/mysql-virtual_sender.cf, check_policy_service inet:127.0.0.1:10031
f the line does not exists, simply add it.
Don’t forget to restart Postfix :
service postfix restart
8.Check your configYou can now send some mails to see what happens. To check if these mails are passed to Cluebringer, connect to MySQL as the cluebringer user :
# mysql -u cluebringer -p cluebringer
And execute the query :
mysql> SELECT * FROM quotas_tracking;
You should see the value LastUpdate and Counter updating when sending a mail. Note that sending to multiple recipient will count like multiple mails were sent.Cluebringer versions prior to 2.1.x does not support IPv6, your customers won’t be able to send any mail if they have an IPv6 connection.Unfortunately, the Debian stable version (wheezy) provides Cluebringer 2.0.10 within its repositories, as well as the experimental release of Debian (sid). As an alternative, you should consider installing the 2.1.x experimental Cluebringer from official website instead of Debian packages from repositories.