Commit cf484f1b authored by Nigel Kukard's avatar Nigel Kukard

Cosmetic fixes and code cleanup

parent 8a6e8bb3
Installing Policyd v2.
Installing PolicyD v2.
*
* Requirements for Policyd v2
* Requirements for PolicyD v2
*
Note: For CentOS you will need to use RPMForge repositories.
......
# Bizanga protocol support module
# Copyright (C) 2009-2015, 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.
......@@ -36,15 +36,15 @@ use cbp::protocols;
# User plugin info
our $pluginInfo = {
name => "Bizanga Protocol Support Module",
init => \&init,
priority => 50,
protocol_init => \&protocol_init,
protocol_check => \&protocol_check,
protocol_parse => \&protocol_parse,
protocol_response => \&protocol_response,
protocol_getresponse => \&protocol_getresponse,
protocol_validate => \&protocol_validate,
name => "Bizanga Protocol Support Module",
ini => \&init,
priority => 50,
protocol_init => \&protocol_init,
protocol_check => \&protocol_check,
protocol_parse => \&protocol_parse,
protocol_response => \&protocol_response,
protocol_getresponse => \&protocol_getresponse,
protocol_validate => \&protocol_validate,
};
# Module configuration
......@@ -82,7 +82,7 @@ sub protocol_init {
sub protocol_check {
my ($server,$buffer) = @_;
my $log = defined($server->{'config'}{'logging'}{'protocols'});
# If we not enabled, don't do anything
return undef if (!$config{'enable'});
......@@ -143,7 +143,7 @@ sub protocol_parse {
# Process response
sub protocol_response
sub protocol_response
{
my ($server,$resp,$data) = @_;
my $log = defined($server->{'config'}{'logging'}{'protocols'});
......@@ -215,13 +215,13 @@ sub protocol_response
$response_data = defined($data) ? $data : "Database error";
$server->log(LOG_DEBUG,"[PROTOCOL/Bizanga] Received PROTO_DB_ERROR with response '$response':'$response_data'") if ($log);
return CBP_STOP;
} elsif ($resp == PROTO_DATA_ERROR) {
$response = "502";
$response_data = defined($data) ? $data : "Database record error";
$server->log(LOG_DEBUG,"[PROTOCOL/Bizanga] Received PROTO_DATA_ERROR with response '$response':'$response_data'") if ($log);
return CBP_STOP;
# Fallthrough
} else {
$server->log(LOG_ERR,"[PROTOCOL/Bizanga] Cannot understand response code '$resp'");
......@@ -231,7 +231,7 @@ sub protocol_response
# Get protocol response
sub protocol_getresponse
sub protocol_getresponse
{
my $resp;
......@@ -243,7 +243,7 @@ sub protocol_getresponse
}
# Check if we have any additional data
$response_data = "" if (!defined($response_data));
$response_data = "" if (!defined($response_data));
# Get timestamp
my $timestamp = strftime("%a, %d %b %Y %H:%M:%S %Z",localtime());
......@@ -253,7 +253,7 @@ sub protocol_getresponse
Date: $timestamp
Content-Length: 0
Content-Type: text/plain
Server: Policyd/".VERSION." (Cluebringer)
Server: PolicyD/".VERSION." (Cluebringer)
Connection: close
";
......@@ -265,7 +265,7 @@ Connection: close
sub protocol_validate {
my ($server,$request) = @_;
my $log = defined($server->{'config'}{'logging'}{'protocols'});
# Check params
if (!awitpt::netip::is_valid($request->{'client_address'})) {
......@@ -289,6 +289,5 @@ sub protocol_validate {
1;
# vim: ts=4
......@@ -2,17 +2,17 @@
# Cluebringer administration tool
# Copyright (C) 2009-2015, 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.
......@@ -31,8 +31,8 @@ use cbp::logging;
use cbp::version;
print("Policyd Admin Tool (ClueBringer) v".VERSION." - Copyright (c) 2007-2010 AllWorldIT\n");
print("PolicyD Admin Tool (Cluebringer) v".VERSION." - Copyright (c) 2009-2014 AllWorldIT\n");
# Fire up commandline processing...
my %opts;
......@@ -109,7 +109,7 @@ if ($opts{'cleanup'}) {
#
# Misc functions
#
#
# Register plugin info
......@@ -160,13 +160,13 @@ sub loadModules
push(@modulelist,$module);
}
}
# Emulate server
$server = new cbpserver;
$server->{'inifile'} = \%config;
$server->{'inifile'} = \%config;
# Init everything
$server->init();
# Load modules
foreach my $module (@modulelist) {
# Split off dir and mod name
......@@ -222,7 +222,7 @@ sub new
my $self = {
};
bless $self, $class;
return $self;
};
......@@ -253,23 +253,9 @@ sub log
my ($self,$level,@msg) = @_;
# FIXME: we shouldn't ignore $level
print(@msg, "\n");
print(@msg, "\n");
}
# Load modules we need and run cleanup() function
# Cleanup session_tracking older than 24hr
# Cleanup quotas_tracking
# - check last update, if its older than now - period, remove
# CheckHelo
# - Remove checkhelo_tracking older than specified period, default to 1 month
# vim: ts=4
......@@ -154,9 +154,9 @@ sub configure {
if (ref($config{'server'}{'modules'}) eq "ARRAY") {
foreach my $module (@{$config{'server'}{'modules'}}) {
$module =~ s/\s+//g;
# Skip comments
next if ($module =~ /^#/);
$module = "modules/$module";
# Skip comments
next if ($module =~ /^#/);
$module = "modules/$module";
push(@{$cfg->{'module_list'}},$module);
}
} else {
......@@ -172,11 +172,11 @@ sub configure {
if (ref($config{'server'}{'protocols'}) eq "ARRAY") {
foreach my $module (@{$config{'server'}{'protocols'}}) {
$module =~ s/\s+//g;
# Skip comments
next if ($module =~ /^#/);
$module = "protocols/$module";
# Skip comments
next if ($module =~ /^#/);
$module = "protocols/$module";
push(@{$cfg->{'module_list'}},$module);
}
}
} else {
my @protocolList = split(/\s+/,$config{'server'}{'protocols'});
foreach my $module (@protocolList) {
......@@ -239,7 +239,7 @@ sub post_configure_hook {
my $log_mail = $self->{'config'}{'log_mail'};
$self->log(LOG_NOTICE,"[CBPOLICYD] Policyd v2 / Cluebringer - v".VERSION);
$self->log(LOG_NOTICE,"[CBPOLICYD] PolicyD v2 / Cluebringer - v".VERSION);
$self->log(LOG_NOTICE,"[CBPOLICYD] Initializing system modules.");
# Init config
......@@ -761,7 +761,7 @@ sub protocol_getresponse
# Display help
sub displayHelp {
print(STDERR "Policyd (ClueBringer) v".VERSION." - Copyright (c) 2007-2009 AllWorldIT\n");
print(STDERR "PolicyD (Cluebringer) v".VERSION." - Copyright (c) 2007-2014 AllWorldIT\n");
print(STDERR<<EOF);
......@@ -775,9 +775,9 @@ EOF
__PACKAGE__->run;
1;
# vim: ts=4
......@@ -37,13 +37,13 @@ AutoProv: no
%description
Policyd v2 (codenamed "cluebringer") is a multi-platform policy server
PolicyD v2 (codenamed "cluebringer") is a multi-platform policy server
for popular MTAs. This policy daemon is designed mostly for large
scale mail hosting environments. The main goal is to implement as many
spam combating and email compliance features as possible while at the
same time maintaining the portability, stability and performance
required for mission critical email hosting of today. Most of the
ideas and methods implemented in Policyd v2 stem from Policyd v1
ideas and methods implemented in PolicyD v2 stem from PolicyD v1
as well as the authors' long time involvement in large scale mail
hosting industry.
......
# Policyd v2 (codenamed "cluebringer") is a multi-platform policy server
# for popular MTAs. This policy daemon is designed mostly for large
# scale mail hosting environments. The main goal is to implement as many
# spam combating and email compliance features as possible while at the
# same time maintaining the portability, stability and performance
# required for mission critical email hosting of today. Most of the
# ideas and methods implemented in Policyd v2 stem from Policyd v1
# as well as the authors' long time involvement in large scale mail
# hosting industry.
Alias /cluebringer /usr/share/cluebringer/webui
<Directory /usr/share/cluebringer/webui>
# Comment out the following 3 lines to make web ui accessible from anywhere
Order Deny,Allow
Deny from all
Allow from 127.0.0.1
</Directory>
# PolicyD v2 (codenamed "cluebringer") is a multi-platform policy server
# for popular MTAs. This policy daemon is designed mostly for large
# scale mail hosting environments. The main goal is to implement as many
# spam combating and email compliance features as possible while at the
# same time maintaining the portability, stability and performance
# required for mission critical email hosting of today. Most of the
# ideas and methods implemented in PolicyD v2 stem from PolicyD v1
# as well as the authors' long time involvement in large scale mail
# hosting industry.
Alias /cluebringer /usr/share/cluebringer/webui
<Directory /usr/share/cluebringer/webui>
# Comment out the following 3 lines to make web ui accessible from anywhere
Order Deny,Allow
Deny from all
Allow from 127.0.0.1
</Directory>
# Amavis module schema
# Copyright (C) 2009-2015, 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.
/* Amavisd-new integration for Policyd */
/* Amavisd-new integration for PolicyD */
CREATE TABLE @PREFIX@amavis_rules (
ID @SERIAL_TYPE@,
......@@ -32,7 +32,7 @@ Mode of operation (the _m columns):
0 - Inherit
1 - Merge (only valid for lists)
2 - Overwrite
2 - Overwrite
*/
......@@ -75,10 +75,10 @@ Mode of operation (the _m columns):
spam_tag_subject VARCHAR(255), /* _SCORE_ is the score, _REQD_ is the required score */
spam_tag_subject_m SMALLINT NOT NULL DEFAULT '0',
spam_tag2_subject VARCHAR(255),
spam_tag2_subject_m SMALLINT NOT NULL DEFAULT '0',
spam_tag3_subject VARCHAR(255),
spam_tag3_subject_m SMALLINT NOT NULL DEFAULT '0',
......@@ -125,7 +125,7 @@ Mode of operation (the _m columns):
quarantine_bad_header VARCHAR(255),
quarantine_bad_header_m SMALLINT NOT NULL DEFAULT '0',
quarantine_spam VARCHAR(255),
quarantine_spam_m SMALLINT NOT NULL DEFAULT '0',
......@@ -148,8 +148,8 @@ INSERT INTO @PREFIX@amavis_rules
Name,
max_message_size,max_message_size_m,
bypass_banned_checks, bypass_banned_checks_m
)
VALUES
)
VALUES
(
1,
'Default system amavis policy',
......
......@@ -22,13 +22,13 @@ Breaks:
Recommends: cluebringer-webui
Suggests: mysql-server
Description: Postfix Policy Daemon
Policyd v2 (codenamed "cluebringer") is a multi-platform policy server
PolicyD v2 (codenamed "cluebringer") is a multi-platform policy server
for popular MTAs. This policy daemon is designed mostly for large
scale mail hosting environments. The main goal is to implement as many
spam combating and email compliance features as possible while at the
same time maintaining the portability, stability and performance
required for mission critical email hosting of today. Most of the
ideas and methods implemented in Policyd v2 stem from Policyd v1
ideas and methods implemented in PolicyD v2 stem from PolicyD v1
as well as the authors' long time involvement in large scale mail
hosting industry.
......@@ -37,14 +37,14 @@ Architecture: all
Depends: ${misc:Depends}
Suggests: apache2, php5, php5-mysql
Description: Postfix Policy Daemon (webui)
Policyd v2 (codenamed "cluebringer") is a multi-platform policy server
PolicyD v2 (codenamed "cluebringer") is a multi-platform policy server
for popular MTAs. This policy daemon is designed mostly for large
scale mail hosting environments. The main goal is to implement as many
spam combating and email compliance features as possible while at the
same time maintaining the portability, stability and performance
required for mission critical email hosting of today. Most of the
ideas and methods implemented in Policyd v2 stem from Policyd v1
ideas and methods implemented in PolicyD v2 stem from PolicyD v1
as well as the authors' long time involvement in large scale mail
hosting industry.
.
This package contains the webui for Policyd.
This package contains the webui for PolicyD.
......@@ -2,17 +2,17 @@
# Database functions
# Copyright (C) 2009-2015, 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.
......@@ -35,7 +35,7 @@ function connect_db()
$dbh->setAttribute(PDO::ATTR_CASE,PDO::CASE_LOWER);
} catch (PDOException $e) {
die("Error connecting to Policyd v2 DB: " . $e->getMessage());
die("Error connecting to the database: " . $e->getMessage());
}
return $dbh;
......@@ -64,5 +64,4 @@ function connect_postfix_db()
}
# vim: ts=4
?>
......@@ -2,24 +2,24 @@
# Page footer
# Copyright (C) 2009-2015, 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.
# Print page footer
function printFooter()
function printFooter()
{
?>
</td>
......@@ -32,11 +32,10 @@ function printFooter()
</tr>
<tr>
<td id="footer">Policyd - Copyright &copy; 2008, LinuxRulz - <a href="http://www.policyd.org/v2/">http://www.policyd.org/v2/</a></td>
<td id="footer">PolicyD - Copyright &copy; 2008-2015, AllWorldIT - <a href="http://www.policyd.org/v2/">http://www.policyd.org/v2/</a></td>
</tr>
</table>
</body>
</body>
</html>
<?php
}
?>
......@@ -2,17 +2,17 @@
# Page header
# Copyright (C) 2009-2015, 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.
......@@ -27,8 +27,8 @@ function printHeader($params = NULL)
global $DB_POSTFIX_DSN;
# Pull in params
if (!is_null($params)) {
# Pull in params
if (!is_null($params)) {
if (isset($params['Tabs'])) {
$tabs = $params['Tabs'];
}
......@@ -38,20 +38,20 @@ function printHeader($params = NULL)
if (isset($params['Title'])) {
$title = $params['Title'];
}
}
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Policyd Web Administration</title>
<head>
<title>PolicyD Web Administration</title>
<link rel="stylesheet" type="text/css" href="stylesheet.css" />
<script type="text/javascript" src="tooltips/BubbleTooltips.js"></script>
<script type="text/javascript">
window.onload=function(){enableTooltips(null,"img")};
</script>
</head>
</head>
<body<?php if (!empty($jsOnLoad)) { echo " onLoad=\"".$jsOnLoad."\""; } ?>>
......@@ -59,7 +59,7 @@ function printHeader($params = NULL)
<table id="maintable">
<tr>
<td id="header">Policyd Web Administration</td>
<td id="header">PolicyD Web Administration</td>
</tr>
<tr>
......@@ -67,8 +67,8 @@ function printHeader($params = NULL)
<table>
<tr>
<td id="menu">
<img style="margin-top:-1px; margin-left:-1px;" src="images/top2.jpg" alt="" />
<p><a href=".">Home</a></p>
<img style="margin-top:-1px; margin-left:-1px;" src="images/top2.jpg" alt="" />
<p><a href=".">Home</a></p>
<p>Policies</p>
<ul>
......@@ -78,57 +78,57 @@ function printHeader($params = NULL)
<p>Access Control</p>
<ul>
<li><a href="accesscontrol-main.php">Configure</a></li>
<li><a href="accesscontrol-main.php">Configure</a></li>
</ul>
<p>HELO/EHLO Checks</p>
<ul>
<li><a href="checkhelo-main.php">Configure</a></li>
<li><a href="checkhelo-blacklist-main.php">Blacklist</a></li>
<li><a href="checkhelo-whitelist-main.php">Whitelist</a></li>
<li><a href="checkhelo-main.php">Configure</a></li>
<li><a href="checkhelo-blacklist-main.php">Blacklist</a></li>
<li><a href="checkhelo-whitelist-main.php">Whitelist</a></li>
</ul>
<p>SPF Checks</p>
<ul>
<li><a href="checkspf-main.php">Configure</a></li>
<li><a href="checkspf-main.php">Configure</a></li>
</ul>
<p>Greylisting</p>
<ul>
<li><a href="greylisting-main.php">Configure</a></li>
<li><a href="greylisting-whitelist-main.php">Whitelist</a></li>
<li><a href="greylisting-main.php">Configure</a></li>
<li><a href="greylisting-whitelist-main.php">Whitelist</a></li>
</ul>
<p>Quotas</p>
<ul>
<li><a href="quotas-main.php">Configure</a></li>
<li><a href="quotas-main.php">Configure</a></li>
</ul>
<p>Accounting</p>
<ul>
<li><a href="accounting-main.php">Configure</a></li>
<li><a href="accounting-main.php">Configure</a></li>
</ul>
<p>Amavis Integration</p>
<ul>
<li><a href="amavis-main.php">Configure</a></li>
<li><a href="amavis-main.php">Configure</a></li>
</ul>
<?php
# Check if postfix DSN is set
if (isset($DB_POSTFIX_DSN) && !empty($DB_POSTFIX_DSN))
if (isset($DB_POSTFIX_DSN) && !empty($DB_POSTFIX_DSN))
{
?>
<p>Postfix Integration</p>
<ul>
<li><a href="postfix-transports-main.php">Transports</a></li>
<li><a href="postfix-mailboxes-main.php">Mailboxes</a></li>
<li><a href="postfix-aliases-main.php">Aliases</a></li>
<li><a href="postfix-distgroups-main.php">Distribution Groups</a></li>
<li><a href="postfix-transports-main.php">Transports</a></li>
<li><a href="postfix-mailboxes-main.php">Mailboxes</a></li>
<li><a href="postfix-aliases-main.php">Aliases</a></li>
<li><a href="postfix-distgroups-main.php">Distribution Groups</a></li>
</ul>
<?php
}
?>
<img style="margin-left:-1px; margin-bottom: -6px" src="images/specs_bottom.jpg" alt="" />
?>
<img style="margin-left:-1px; margin-bottom: -6px" src="images/specs_bottom.jpg" alt="" />
</td>
<td class="content">
......@@ -141,16 +141,15 @@ function printHeader($params = NULL)
<?php
foreach ($tabs as $key => $value) {
?> <li>
<a href="<?php echo $value ?>"
title="<?php echo $key ?>">
<a href="<?php echo $value ?>" title="<?php echo $key ?>">
<span><?php echo $key ?></span></a>
</li>
<?php
}
?>
</ul></td></tr>
</ul></td></tr>
<?php
}
}
?>
<tr>
<td>
......@@ -158,5 +157,5 @@ function printHeader($params = NULL)
}
# vim: ts=4
?>
Markdown is supported
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