Commit caadef69 authored by Nigel Kukard's avatar Nigel Kukard
Browse files

Fixed up package naming, see UPGRADING

parent e86cd31b
......@@ -38,9 +38,9 @@ $ mysql -u root -p policyd < policyd.mysql
2. Put cluebringer.conf in your /etc directory and adjust cluebringer.conf with your MySQL database details
3. Copy the cbp/ directory into /usr/local/lib/policyd-2.0/
mkdir /usr/local/lib/policyd-2.0
cp -r cbp /usr/local/lib/policyd-2.0/
3. Copy the cbp/ directory into /usr/local/lib/policyd-cluebringer-2.0/
mkdir /usr/local/lib/policyd-cluebringer-2.0
cp -r cbp /usr/local/lib/policyd-cluebringer-2.0/
4. Copy cbpolicyd and cbpadmin into /usr/local/bin
cp cbpadmin /usr/local/bin/
......
Updating from < 2.0.15 to 2.0.15+
--------------------------------------------------------------
The location of the configuration file /etc/cluebringer.conf has changed to
/etc/policyd-cluebringer/cluebringer.conf .
The library locations have also changed from */policyd-2.0 to
*/policyd-cluebringer-2.0 .
The pid file location hs changed from /var/run/cbpolicyd.pid to
/var/run/policyd-cluebringer/cbpolicyd.pid .
The log file location hs changed from /var/log/cbpolicyd.log to
/var/log/policyd-cluebringer/cbpolicyd.log .
Updating database from < 2.0.12 to 2.0.12+
--------------------------------------------------------------
......
......@@ -22,7 +22,7 @@ use strict;
use warnings;
use lib('/usr/local/lib/policyd-2.0','/usr/lib/policyd-2.0');
use lib('/usr/local/lib/policyd-cluebringer-2.0','/usr/lib/policyd-cluebringer-2.0','/usr/lib64/policyd-cluebringer-2.0');
use Config::IniFiles;
use Getopt::Long;
......@@ -52,7 +52,7 @@ if ($opts{'help'}) {
# Set defaults
my $cfg;
$cfg->{'config_file'} = "/etc/cluebringer.conf";
$cfg->{'config_file'} = "/etc/policyd-cluebringer/cluebringer.conf";
# Check if we must override
if (defined($opts{'config'}) && $opts{'config'} ne "") {
......
......@@ -22,7 +22,7 @@
use strict;
use warnings;
use lib('/usr/local/lib/policyd-2.0','/usr/lib/policyd-2.0','/usr/lib64/policyd-2.0');
use lib('/usr/local/lib/policyd-cluebringer-2.0','/usr/lib/policyd-cluebringer-2.0','/usr/lib64/policyd-cluebringer-2.0');
package cbp;
......@@ -53,15 +53,15 @@ sub configure {
# Set defaults
$cfg->{'config_file'} = "/etc/cluebringer.conf";
$cfg->{'config_file'} = "/etc/policyd-cluebringer/cluebringer.conf";
$server->{'timeout'} = 120;
$server->{'timeout_idle'} = 1015;
$server->{'timeout_busy'} = 115;
$server->{'background'} = "yes";
$server->{'pid_file'} = "/var/run/cbpolicyd.pid";
$server->{'pid_file'} = "/var/run/policyd-cluebringer/cbpolicyd.pid";
$server->{'log_level'} = 2;
$server->{'log_file'} = "/var/log/cbpolicyd.log";
$server->{'log_file'} = "/var/log/policyd-cluebringer/cbpolicyd.log";
$server->{'host'} = "*";
$server->{'port'} = 10031;
......
%define apacheconfdir %{_sysconfdir}/httpd/conf.d
# this path is hardcoded
%define cblibdir %{_libdir}/policyd-2.0
%define cblibdir %{_libdir}/policyd-cluebringer-2.0
%define version @PKG_VER_MAIN_CLEAN@
%define release 1
%define tarver v%{version}
Summary: Postfix Policy Daemon
Name: cluebringer
Summary: Email server policy daemon
Name: policyd-cluebringer
Version: %{version}
Release: %{release}
License: GPLv2
Group: System/Daemons
URL: http://www.policyd.org
Source0: http://downloads.sourceforge.net/policyd/%{name}-%{tarver}.tar.bz2
Source0: http://downloads.policyd.org/%{version}/%{name}-%{version}.tar.bz2
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
BuildArch: noarch
Provides: cbpolicyd
Provides: cbpolicyd = %{version}
Obsoletes: cbpolicyd
Provides: policyd = %{version}
Obsoletes: policyd
......@@ -39,7 +39,7 @@ hosting industry.
%prep
%setup -q -n %{name}-%{tarver}
%setup -q -n %{name}-%{version}
# hack to prevent rpmbuild from automatically detecting "requirements" that
# aren't actually external requirements. See https://fedoraproject.org/wiki/Packaging/Perl#In_.25prep_.28preferred.29
......@@ -48,7 +48,7 @@ cat << EOF > %{name}-req
%{__perl_requires} $* | sed -e '/perl(cbp::/d'
EOF
%define __perl_requires %{_builddir}/%{name}-%{tarver}/%{name}-req
%define __perl_requires %{_builddir}/%{name}-%{version}/%{name}-req
chmod +x %{__perl_requires}
......@@ -74,21 +74,22 @@ rm -rf $RPM_BUILD_ROOT
mkdir -p $RPM_BUILD_ROOT%{cblibdir}
mkdir -p $RPM_BUILD_ROOT%{_sbindir}
mkdir -p $RPM_BUILD_ROOT%{_initrddir}
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/policyd
mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/log/policyd-cluebringer
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/policyd-cluebringer
cp -R cbp $RPM_BUILD_ROOT%{cblibdir}
install -m 755 cbpolicyd cbpadmin database/convert-tsql $RPM_BUILD_ROOT%{_sbindir}
install -m 644 cluebringer.conf $RPM_BUILD_ROOT%{_sysconfdir}/policyd/cluebringer.conf
install -m 755 cbpolicyd cbpadmin $RPM_BUILD_ROOT%{_sbindir}
install -m 644 cluebringer.conf $RPM_BUILD_ROOT%{_sysconfdir}/policyd-cluebringer/cluebringer.conf
install -m 755 contrib/initscripts/Fedora/cbpolicyd $RPM_BUILD_ROOT%{_initrddir}
# Webui
mkdir -p $RPM_BUILD_ROOT%{_datadir}/%{name}/webui
mkdir -p $RPM_BUILD_ROOT%{_datadir}/policyd-cluebringer/webui
mkdir -p $RPM_BUILD_ROOT%{apacheconfdir}
cp -R webui/* $RPM_BUILD_ROOT%{_datadir}/%{name}/webui/
install -m 644 contrib/httpd/cluebringer-httpd.conf $RPM_BUILD_ROOT%{apacheconfdir}/cluebringer.conf
cp -R webui/* $RPM_BUILD_ROOT%{_datadir}/policyd-cluebringer/webui/
install -m 644 contrib/httpd/cluebringer-httpd.conf $RPM_BUILD_ROOT%{apacheconfdir}/policyd-cluebringer.conf
# Move config into /etc
mv $RPM_BUILD_ROOT%{_datadir}/%{name}/webui/includes/config.php $RPM_BUILD_ROOT%{_sysconfdir}/policyd/webui.conf
ln -s %{_sysconfdir}/policyd/webui.conf $RPM_BUILD_ROOT%{_datadir}/%{name}/webui/includes/config.php
chmod 0640 $RPM_BUILD_ROOT%{_sysconfdir}/policyd/webui.conf
mv $RPM_BUILD_ROOT%{_datadir}/policyd-cluebringer/webui/includes/config.php $RPM_BUILD_ROOT%{_sysconfdir}/policyd-cluebringer/webui.conf
ln -s %{_sysconfdir}/policyd-cluebringer/webui.conf $RPM_BUILD_ROOT%{_datadir}/policyd-cluebringer/webui/includes/config.php
chmod 0640 $RPM_BUILD_ROOT%{_sysconfdir}/policyd-cluebringer/webui.conf
# Docdir
mkdir -p $RPM_BUILD_ROOT%{_docdir}/%{name}-%{version}/contrib
......@@ -112,16 +113,15 @@ rm -rf $RPM_BUILD_ROOT
%{cblibdir}/
%{_sbindir}/cbpolicyd
%{_sbindir}/cbpadmin
%{_sbindir}/convert-tsql
%{_initrddir}/cbpolicyd
%dir %{_datadir}/%{name}
%attr(-,root,apache) %{_datadir}/%{name}/webui/
%dir %{_datadir}/policyd-cluebringer
%attr(-,root,apache) %{_datadir}/policyd-cluebringer/webui/
%dir %{_sysconfdir}/policyd
%config(noreplace) %{_sysconfdir}/policyd/cluebringer.conf
%dir %{_sysconfdir}/policyd-cluebringer
%config(noreplace) %{_sysconfdir}/policyd-cluebringer/cluebringer.conf
%attr(-,root,apache) %config(noreplace) %{_sysconfdir}/policyd/webui.conf
%attr(-,root,apache) %config(noreplace) %{_sysconfdir}/policyd-cluebringer/webui.conf
%config(noreplace) %{apacheconfdir}/cluebringer.conf
......
# Cluebringer policy support for amavisd-new
# Copyright (C) 2009, AllWorldIT
# Copyright (C) 2009-2014, AllWorldIT
# Copyright (C) 2008, LinuxRulz
#
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
......@@ -20,7 +20,8 @@
package Amavis::Custom;
use strict;
use lib('/usr/local/lib/policyd-2.0','/usr/lib/policyd-2.0');
use lib('/usr/local/lib/policyd-cluebringer-2.0','/usr/lib/policyd-cluebringer-2.0','/usr/lib64/policyd-cluebringer-2.0');
my $DB_dsn = "DBI:SQLite:dbname=/tmp/cluebringer.sqlite";
......@@ -36,7 +37,7 @@ my %ruleOptions = (
bypass_banned_checks
bypass_spam_checks
bypass_header_checks
spam_modifies_subject
) ],
......@@ -53,12 +54,12 @@ my %ruleOptions = (
spam_tag_subject
spam_tag2_subject
spam_tag3_subject
quarantine_virus
quarantine_banned_file
quarantine_bad_header
quarantine_spam
bcc_to
) ],
......@@ -112,7 +113,7 @@ sub new {
$self->{'inifile'}{'database'}{'username'} = $DB_user;
$self->{'inifile'}{'database'}{'password'} = $DB_pass;
cbp::config::Init($self);
# Init system stuff
$self->{'dbh'} = cbp::dbilayer::Init($self);
if (!defined($self->{'dbh'})) {
......@@ -136,7 +137,7 @@ sub process_policy {
my($self,$conn,$msginfo,$pbn) = @_;
do_log(5,"policyd/process_policy: Starting");
# Get message ID
my (undef,undef,$lastReceived) = $msginfo->get_header_field('received',0);
if (!($lastReceived =~ /with E?SMTPS?A? id ([0-9A-Z]+)/)) {
......@@ -186,7 +187,7 @@ sub process_policy {
# Loop with email addies
foreach my $emailAddy (keys %recip_to_policy) {
# Start with a blank config
# Start with a blank config
my %amavisConfig = ();
# Loop with priorities, low to high
......@@ -494,7 +495,7 @@ sub process_policy {
# Whitelist & blacklist
# Check if we have a list of sender whitelists
if (defined($amavisConfig{'sender_whitelist'})) {
# If the lookup tables isn't a hash ref, make one
......@@ -518,7 +519,7 @@ sub process_policy {
# Save...
$pbn->{'per_recip_whitelist_sender_lookup_tables'}{$emailAddy} = \@vals;
}
# Check if we have a list of sender blacklists
if (defined($amavisConfig{'sender_blacklist'})) {
# If the lookup tables isn't a hash ref, make one
......@@ -545,35 +546,35 @@ sub process_policy {
# Admin notifications
# Check if we have a list of new virus admins
if (defined($amavisConfig{'notify_admin_newvirus'})) {
push(@{$pbn->{'newvirus_admin_maps'}},\{
$emailAddy => $amavisConfig{'notify_admin_newvirus'}
});
}
# Check if we have a list of virus admins
if (defined($amavisConfig{'notify_admin_virus'})) {
push(@{$pbn->{'virus_admin_maps'}},\{
$emailAddy => $amavisConfig{'notify_admin_virus'}
});
}
# Check if we have a list of spam admins
if (defined($amavisConfig{'notify_admin_spam'})) {
push(@{$pbn->{'spam_admin_maps'}},\{
$emailAddy => $amavisConfig{'notify_admin_spam'}
});
}
# Check if we have a list of banned file admins
if (defined($amavisConfig{'notify_admin_banned_file'})) {
push(@{$pbn->{'banned_admin_maps'}},\{
$emailAddy => $amavisConfig{'notify_admin_banned_file'}
});
}
# Check if we have a list of bad header admins
if (defined($amavisConfig{'notify_admin_bad_header'})) {
push(@{$pbn->{'bad_header_admin_maps'}},\{
......@@ -583,7 +584,7 @@ sub process_policy {
# Quarantine options
# Check if we must quarantine a virus
if (defined($amavisConfig{'quarantine_virus'})) {
push(@{$pbn->{'virus_quarantine_to_maps'}},\{
......@@ -613,7 +614,7 @@ sub process_policy {
}
# Interception
# Email addy to BCC to
if (defined($amavisConfig{'bcc_to'})) {
if (!defined($pbn->{'always_bcc'}) || $pbn->{'always_bcc'} eq "") {
......@@ -633,7 +634,7 @@ sub process_policy {
sub amail_done
{
my($self,$conn,$msginfo) = @_;
my($mail_id) = $msginfo->mail_id;
my($spam_level) = $msginfo->spam_level;
my($sid) = $msginfo->sender_maddr_id;
......@@ -672,10 +673,10 @@ sub getAmavisRule
{
my ($self,$policyID) = @_;
# Query amavis rules table
my $sth = DBSelect("
SELECT
SELECT
ID,
bypass_virus_checks, bypass_banned_checks, bypass_spam_checks, bypass_header_checks,
......@@ -698,11 +699,11 @@ sub getAmavisRule
notify_admin_newvirus, notify_admin_virus, notify_admin_spam, notify_admin_banned_file, notify_admin_bad_header,
notify_admin_newvirus_m, notify_admin_virus_m, notify_admin_spam_m, notify_admin_banned_file_m, notify_admin_bad_header_m,
quarantine_virus, quarantine_banned_file, quarantine_bad_header, quarantine_spam,
quarantine_virus_m, quarantine_banned_file_m, quarantine_bad_header_m, quarantine_spam_m,
bcc_to,
bcc_to_m
......@@ -736,7 +737,7 @@ sub log
my ($self,$level,$msg,@args) = @_;
# Check log level and set text
my $logtxt = "UNKNOWN";
my $logtxt = "UNKNOWN";
my $loglvl = 1;
# Check levels...
if ($level == LOG_DEBUG) {
......@@ -754,7 +755,7 @@ sub log
} elsif ($level == LOG_ERR) {
$logtxt = "ERROR";
$loglvl = -2;
}
}
# Parse message nicely
if ($msg =~ /^(\[[^\]]+\]) (.*)/s) {
......
......@@ -8,9 +8,9 @@
# as well as the authors' long time involvement in large scale mail
# hosting industry.
Alias /cluebringer /usr/share/cluebringer/webui
Alias /policyd-cluebringer /usr/share/policyd-cluebringer/webui
<Directory /usr/share/cluebringer/webui>
<Directory /usr/share/policyd-cluebringer/webui>
# Comment out the following 3 lines to make web ui accessible from anywhere
Order Deny,Allow
Deny from all
......
......@@ -3,8 +3,8 @@
# chkconfig: - 75 25
# description: Postfix Policy Daemon
# processname: httpd
# config: /etc/policyd/cluebringer.conf
# pidfile: /var/run/cbpolicyd.pid
# config: /etc/policyd-cluebringer/cluebringer.conf
# pidfile: /var/run/policyd-cluebringer/cbpolicyd.pid
# processname: cbpolicyd
# source function library
......@@ -21,8 +21,9 @@ RETVAL=0
start() {
[ ! -d /var/run/policyd-cluebringer ] && install -m 0755 -d /var/run/policyd-cluebringer
echo -n $"Starting cbpolicyd: "
daemon /usr/sbin/cbpolicyd --config /etc/policyd/cluebringer.conf
daemon /usr/sbin/cbpolicyd --config /etc/policyd-cluebringer/cluebringer.conf
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/cbpolicyd
......
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