Commit 50d157c3 authored by Nigel Kukard's avatar Nigel Kukard
Browse files

* Better handling of the cache file used, added config file option cache_file

* Changed location of runtime files, they're now in /var/run/cbpolicyd/ by default
* Changed location of log file to /var/log/cbpolicyd/
- Thanks goes to Tomoyuki Murakami for his input & patches
parent 121b1658
......@@ -43,10 +43,18 @@ cp cbpadmin /usr/local/bin/
cp cbpolicyd /usr/local/sbin/
5. Install the webui/* into your apache directory, check out includes/config.php and adjust the MySQL server details.
5. Setup system dirs ...
mkdir /var/log/cbpolicyd
mkdir /var/run/cbpolicyd
If you are running cbpolicyd as an unpriv user, then ...
chown cbpolicyd.cbpolicyd /var/log/cbpolicyd /var/run/cbpolicyd
6. Setup Postfix to use cbpolicyd...
6. Install the webui/* into your apache directory, check out includes/config.php and adjust the MySQL server details.
7. Setup Postfix to use cbpolicyd...
Add the following Postfix config...
check_policy_service inet:127.0.0.1:10031
in BOTH smtpd_recipient_restrictions and smtpd_end_of_data_restrictions.
......@@ -54,18 +62,18 @@ in BOTH smtpd_recipient_restrictions and smtpd_end_of_data_restrictions.
** Optional Amavisd Supprt ***
7. Copy your amavisd from /usr/sbin/amavisd and patch it with contrib/amavisd-new-2.5.3_policyd-200802070918.patch like this...
8. Copy your amavisd from /usr/sbin/amavisd and patch it with contrib/amavisd-new-2.5.3_policyd-200802070918.patch like this...
$ patch < contrib/amavisd-new-2.5.3_policyd-200802070918.patch
After this change your initscripts to start the patched amavisd.
8. Copy amavisd-policyd.pm where you see fit, and add this configuration line to your amavisd.conf file...
9. Copy amavisd-policyd.pm where you see fit, and add this configuration line to your amavisd.conf file...
include_config_files('/path/to/amavisd-policyd.pm');
9. Edit the top of amavisd-policyd.pm and change ...
10. Edit the top of amavisd-policyd.pm and change ...
use lib('/root/cluebringer-trunk'); # to point to the directory which contains cbp/
my $DB_dsn = "DBI:mysql:database=policyd;host=localhost"; # to point to your MySQL DB
10. Fire everything up and browse to the web gui to configure
11. Fire everything up and browse to the web gui to configure
......@@ -58,13 +58,14 @@ sub configure {
# Set defaults
$cfg->{'config_file'} = "/etc/cluebringer.conf";
$cfg->{'cache_file'} = '/var/run/cbpolicyd/cache';
$cfg->{'track_sessions'} = 0;
$server->{'timeout'} = 120;
$server->{'background'} = "yes";
$server->{'pid_file'} = "/var/run/cbpolicyd.pid";
$server->{'pid_file'} = "/var/run/cbpolicyd/cbpolicyd.pid";
$server->{'log_level'} = 2;
$server->{'log_file'} = "/var/log/cbpolicyd.log";
$server->{'log_file'} = "/var/log/cbpolicyd/cbpolicyd.log";
$server->{'proto'} = "tcp";
$server->{'host'} = "*";
......@@ -215,7 +216,13 @@ sub configure {
$cfg->{'log_mail'} = $config{'server'}{'log_mail'};
}
}
# Check if the user specified a cache_file in the config
if (defined($config{'server'}{'cache_file'})) {
$cfg->{'cache_file'} = $config{'server'}{'cache_file'};
}
# Save our config and stuff
$self->{'config'} = $cfg;
$self->{'cmdline'} = $cmdline;
......@@ -236,10 +243,13 @@ sub post_configure_hook {
# Init config
cbp::config::Init($self);
# Init caching engine
awitpt::cache::Init($self);
awitpt::cache::Init($self,{
'cache_file' => $self->{'config'}{'cache_file'},
'cache_file_user' => $self->{'server'}->{'user'},
'cache_file_group' => $self->{'server'}->{'group'}
});
$self->log(LOG_NOTICE,"[CBPOLICYD] System modules initialized.");
$self->log(LOG_NOTICE,"[CBPOLICYD] Module load started...");
# Load modules
foreach my $module (@{$self->{'config'}{'module_list'}}) {
......
......@@ -26,7 +26,10 @@ EOT
#group=
# Filename to store pid of parent process
#pid_file=/var/run/cbpolicyd.pid
#pid_file=/var/run/cbpolicyd/cbpolicyd.pid
# Cache file
#cache_file=/var/run/cbpolicyd/cache
# Uncommenting the below option will prevent cbpolicyd going into the background
#background=no
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment