Difference between revisions of "CBpolicyd"

(How to configure quotas/groups for cbpolicyd (sqlite).)
(How to configure quotas/groups for cbpolicyd (sqlite).)
Line 1: Line 1:
  
== '''How to configure quotas/groups for cbpolicyd (sqlite).''' ==
+
== '''How to configure quotas for cbpolicyd (sqlite).''' ==
  
  
Line 24: Line 24:
  
  
To configure the quotas, we will predominantly work with the '''policies''', '''policy_members''', '''policy_groups''', '''policy_group_members''', '''quotas''' and '''quotas_limits''' tables. First, we need to navigate to and enter the sqlite database:
+
We will predominantly work with the '''policies''', '''policy_members''', '''policy_groups''', '''policy_group_members''', '''quotas''' and '''quotas_limits''' tables. First, we need to navigate to and enter the sqlite database:
  
$ cd /opt/zimbra/data/cbpolicyd/db/
+
$ cd /opt/zimbra/data/cbpolicyd/db/
 +
$ sqlite3 cbpolicyd.sqlitedb
 +
SQLite version 3.6.20
 +
Enter ".help" for instructions
 +
Enter SQL statements terminated with a ";"
 +
sqlite>
  
$ sqlite3 cbpolicyd.sqlitedb
 
SQLite version 3.6.20
 
Enter ".help" for instructions
 
Enter SQL statements terminated with a ";"
 
sqlite>
 
  
 +
To configure cbpolicyd is important to understand the logic flow and the schema structure of the tables, as it might be confusing at the beginning. With the examples below I will also include the schema structure to understand the flow better. There are two possibilities: to configure policy with groups or without groups.
  
The next step is to list the tables which are used for the configuration:
+
For both possibilities we need to create the following:
 +
1. Create a policy in the '''policies''' tables.
 +
2. Configure the policy members of the newly created policy in the '''policy_members''' table.
  
 +
a) If we are not to use groups, then after configuring the policy and policy members, we edit the '''quota''' and '''quotas_limits''' tables.
 +
b) If you are to configure groups, then after configuring the policies, we configure the groups and then the quotas.
  
The first step is to create our own policy:
+
----
  
sqlite> insert into policies(Name,Priority,Disabled) VALUES ('test_policy',0,0);
+
'''Creating policy:'''
  
The above command will create a policy named test_policy, it will be enabled and will have priority 0, which means it will be picked up first from the list of the policies. The priorities goes as 1, then 2 and so on.
+
The following command creates policy with name "test_policy", with priority 0 and is enabled:
Here is our newly created policy:
 
  
sqlite> select * from policies;
+
sqlite> insert into policies(Name,Priority,Disabled) VALUES ('test_policy',0,0);
1|test_policy|0||0
 
  
  
The next thing to do is to edit the policy_members table, to specify what members will be included in the policy.  
+
Priority '''0''', means it will be picked up first from the list of the policies. The priorities goes as 1, then 2 and so on.
 +
 
 +
Example of our newly created policy:
 +
 
 +
sqlite> select * from policies;
 +
ID|Name      |Priority|Description |Disabled
 +
  1|test_policy|0      |            |0
 +
 
 +
The next thing to do is to edit the policy_members table, to specify the members that will be included in the policy.  
  
  
 
--IN PROGRESS--
 
--IN PROGRESS--

Revision as of 13:45, 10 November 2014

How to configure quotas for cbpolicyd (sqlite).

PolicyD v2 (codenamed "cluebringer") is a multi-platform policy server for popular MTAs. The main goal is to implement as many spam combating and email compliance features as possible. The configuration of cbpolicyd under Zimbra is done by editing the sqlite database as shown in the examples below.

Sqlite contains couple of tables, which are used for the configuration of cbpolicyd:

sqlite> .tables
access_control             greylisting_tracking
accounting                 greylisting_whitelist
accounting_tracking        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
greylisting_autowhitelist


We will predominantly work with the policies, policy_members, policy_groups, policy_group_members, quotas and quotas_limits tables. First, we need to navigate to and enter the sqlite database:

$ cd /opt/zimbra/data/cbpolicyd/db/
$ sqlite3 cbpolicyd.sqlitedb
SQLite version 3.6.20
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite>


To configure cbpolicyd is important to understand the logic flow and the schema structure of the tables, as it might be confusing at the beginning. With the examples below I will also include the schema structure to understand the flow better. There are two possibilities: to configure policy with groups or without groups.

For both possibilities we need to create the following:

1. Create a policy in the policies tables. 
2. Configure the policy members of the newly created policy in the policy_members table.
a) If we are not to use groups, then after configuring the policy and policy members, we edit the quota and quotas_limits tables. 
b) If you are to configure groups, then after configuring the policies, we configure the groups and then the quotas. 

Creating policy:

The following command creates policy with name "test_policy", with priority 0 and is enabled:

sqlite> insert into policies(Name,Priority,Disabled) VALUES ('test_policy',0,0);


Priority 0, means it will be picked up first from the list of the policies. The priorities goes as 1, then 2 and so on.

Example of our newly created policy:

sqlite> select * from policies;
ID|Name       |Priority|Description |Disabled
 1|test_policy|0       |            |0

The next thing to do is to edit the policy_members table, to specify the members that will be included in the policy.


--IN PROGRESS--

Jump to: navigation, search