[-]
[+]
|
Changed |
mtpolicyd.spec
|
|
[-]
[+]
|
Deleted |
_service:download_files:Mail-MtPolicyd-1.23.tar.gz/debian
^
|
-(directory)
|
[-]
[+]
|
Deleted |
_service:download_files:Mail-MtPolicyd-1.23.tar.gz/debian/changelog
^
|
@@ -1,171 +0,0 @@
-mtpolicyd (1.23) jessie; urgency=low
- * adjust rbl/dbl unit tests to changes SpamHaus output
- * prune README.pod link
- * create data folder in debian package
- * change distribution in changelog to jessie
- * fix debian package dependencies
- * Remove RPM dependency on cron
-
- -- Markus Benning <ich@markusbenning.de> Mon, 14 Dec 2015 16:00:05 +0000
-
-mtpolicyd (1.22) jessie; urgency=low
- * fixes to ldap latest LDAP code
- * Added support for LDAP
- Support for an global LDAP connection has been added to mtpolicyd.
- The new plugin LdapUserConfig uses this connection to read
- parameters from a LDAP server.
-
- -- Markus Benning <ich@markusbenning.de> Sat, 7 Nov 2015 19:11:24 +0000
-
-mtpolicyd (1.21) jessie; urgency=low
- * New plugin SMTPVerify
- The SMTPVerify plugin implements address verification at a remote
- SMTP server with MAIL FROM and RCPT TO commands.
- It support the following checks:
- * check if the remote SMTP server would accept mail for a address.
- Apply actions or scores if a permanent or temporary error is returned
- * If the remote server support the SIZE extension the SIZE will be
- passed to the remote SMTP server. This way it could be checked
- if the message exceeds the message size limit or the quota limit
- of the recipient.
- * Check if the remote SMTP server announces support for STARTTLS
- * Check if there is a TLSA record for the remote SMTP server
- * Check if there is OPENPGPKEY for the recipient.
- * use Test::Memcached also in plugin-greylist.t
- * another try for travis
- * one more for travis...
- * try init.d instead of systemctl in travis
- * try using a local resolver in travis
- * new feature vhost_by_policy_context
- New option vhost_by_policy_context will if activated tell mtpolicyd
- to select the VirtualHost based on the policy_context.
- For example in postfix main.cf use advanced syntax:
- check_policy_service { inet:localhost:12345,
- policy_context=reputation }
- ...
- check_policy_service { inet:localhost:12345,
- policy_context=accounting }
- In mtpolicyd.conf:
- port="127.0.0.1:12345" # only 1 port
- vhost_by_policy_context=1
- <VirtualHost 12345>
- name=reputation
- ... plugins ...
- </VirtualHost>
- <VirtualHost 12345>
- name=accounting
- ... plugins ...
- </VirtualHost>
- The policy_context feature will be available in postfix 3.1 and
- later.
- * fix RBL plugin testcase
- spamhaus removed '"' in response?
- * replace README.md with a link to pod docs
- * add DBD::SQLite as a test prereq
- * add cpanm --sudo option in travis
- * update .travis.yml
- * use cpanm --notest for prereqs in travis ci
- * install libdb-dev in travis
- * added minimum perl version
-
- -- Markus Benning <ich@markusbenning.de> Tue, 22 Sep 2015 11:04:58 +0000
-
-mtpolicyd (1.20) jessie; urgency=low
- * enable TravisCI
- * fix SQL connection handling after child fork
- Closing the connection after child fork did not cause a reconnect on
- all DBI versions. Instead do a reconnect by overwriting the
- previous connection.
- * improve request logging
- mtpolicyd now logs the plugin that caused the result.
- The new log format is:
- <vhost>: instance=<instance>, type=<type>, t=<time>ms,
- plugin=<plugin>, result=<result>
-
- -- Markus Benning <ich@markusbenning.de> Tue, 18 Aug 2015 18:13:36 +0000
-
-mtpolicyd (1.19) jessie; urgency=low
- * escape control characters in logs
- The logging method in Mail::MtPolicyd now extends the Net::Server log
- method with a mechanism to escape control and special characters.
- * update debian/ copyright and control file
- * even more lintian fixes
- * add DEBHELPER comments to maintainer scripts
- * fix some spelling errors
-
- -- Markus Benning <ich@markusbenning.de> Mon, 3 Aug 2015 22:06:43 +0000
-
-mtpolicyd (1.18) jessie; urgency=low
- * add debian upload files to gitignore
- * fixed lintian packaging errors
- * more lintian fixes
- * lintian package adjustments
- * more fixes for packaging
-
- -- Markus Benning <ich@markusbenning.de> Wed, 22 Apr 2015 22:19:26 +0000
-
-mtpolicyd (1.17) jessie; urgency=low
- * fix comment
- * exclude debian build from CPAN tarball
- * skip cucumber tests when cucumber is unavailable
- * add website and mailinglist to meta infos
-
- -- Markus Benning <ich@markusbenning.de> Fri, 20 Mar 2015 09:32:08 +0000
-
-mtpolicyd (1.16) jessie; urgency=low
- * Small fixes
- * fix min_count in SaAwlAction
- * check for pid folder in init script
- * Improved SPF support
- * Add IP address whitelisting in SPF plugin
- * always whitelist localhost addresses
- * add whitelist option for additional IPs
- * fix domain in DBL test
- * Merge branch 'master' of https://github.com/benningm/mtpolicyd
- * support for using spamassassins AWL as reputation source
- * Merge pull request #3 from xpunkt/patch-1
- update abstract
- * update abstract
- small error, no program errror
-
- -- Markus Benning <ich@markusbenning.de> Tue, 10 Mar 2015 09:24:44 +0000
-
-mtpolicyd (1.15) jessie; urgency=low
- * Documentation updates
- * added how to for Accounting/Quotas
- * add section about cron() in Cookbook::ExtendedPlugin
- * Added Quota plugin
- * new Plugin: Quota
- * make field for SQL configurable in SqlUserConfig
- * add tests for Quota to accounting test cases
- * Added support for cron tasks
- * added a crontab to call mtpolicyd periodically
- * add mtpolicyd --cron <tasks> to execute tasks
- * plugins can do cron jobs by implementing a cron()
- * added autowl expire to Plugin::Greylist based on cron()
- * Small fixes
- * initialize SQL connection before plugins
- * skip also emtpy or whitespace request attributes
- * Added Accounting Plugin
- * More SQL improvements
- * add unit tests t/plugin-role-sqlutils.t t/sqlconnection.t
- * add support for automatic table creation
- Greylisting Plugin
- * fix autowl expire
- * add unit test for greylisting plugin
- * Add some SQL infrastructure
- * added Mail::MtPolicyd::SqlConnection singleton for storing DB
- connnection
- * added Plugin::Role::SqlUtils for code shared by plugins
- * adjust existing plugins
- * adjust tests
- * Fix RBL test IP
- * use XBL test IP instead of a real client IP
- * Add cucumber test cases
- * added basic step files for cucumber test
- * add 2 basic server tests (minimal.conf and spamhaus-rbls.conf)
- * Dont fail in SPF when sender/client_address unavailable
- * fixed missing dependencies in debian package
-
- -- Markus Benning <ich@markusbenning.de> Wed, 7 Jan 2015 16:17:56 +0000
-
|
[-]
[+]
|
Deleted |
_service:download_files:Mail-MtPolicyd-1.23.tar.gz/debian/compat
^
|
@@ -1 +0,0 @@
-8
|
[-]
[+]
|
Deleted |
_service:download_files:Mail-MtPolicyd-1.23.tar.gz/debian/control
^
|
@@ -1,31 +0,0 @@
-Source: mtpolicyd
-Section: perl
-Priority: optional
-Maintainer: Markus Benning <ich@markusbenning.de>
-Build-Depends: debhelper (>= 8)
-Build-Depends-Indep: perl, libtest-mockobject-perl, libdbd-sqlite3-perl, libcache-memcached-perl, libdbi-perl, libmoose-perl, libmail-rbl-perl, libwww-perl, libconfig-general-perl, libtest-exception-perl, libnamespace-autoclean-perl, libmoosex-getopt-perl, libmoosex-role-parameterized-perl, libmoosex-singleton-perl, libgeo-ip-perl, libtie-ixhash-perl, libtime-piece-mysql-perl
-Standards-Version: 3.9.6
-Homepage: http://search.cpan.org/dist/Mail-MtPolicyd/
-
-Package: mtpolicyd
-Architecture: all
-Depends: ${misc:Depends}, ${perl:Depends}, adduser, libcache-memcached-perl, libdbi-perl, libmoose-perl, libmail-rbl-perl, libconfig-general-perl, libnamespace-autoclean-perl, libmoosex-getopt-perl, libmoosex-role-parameterized-perl, libmoosex-singleton-perl, libtie-ixhash-perl, libtime-piece-mysql-perl, libgeo-ip-perl, libnet-server-perl, libjson-perl, libnet-ldap-perl, libdbd-sqlite3-perl, libmail-spf-perl
-Description: modular policy daemon for postfix
- mtpolicyd is a modular policy daemon for postfix written in perl.
- It has support for virtual hosts, session caching, per-user
- configuration and is easily extensible thru plugins.
- .
- It already ships with a lot of plugins:
- .
- RBL - query DNS IP black/whitelists
- DBL - query DNS domain black/whitelists
- SqlList - use SQL query as black/whitelist
- CtIpRep - use Commtouch IP reputation
- GeoIP - use location of sending IP
- Fail2ban - block spammers with fail2ban/iptables
- Greylist - greylisting
- SPF - Sender Policy Framework
- Accounting - collect SMTP-level accounting information
- Quota - apply quota limits based on Accounting data
- and more... (see Documentation)
-
|
[-]
[+]
|
Deleted |
_service:download_files:Mail-MtPolicyd-1.23.tar.gz/debian/copyright
^
|
@@ -1,53 +0,0 @@
-Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
-Upstream-Name: mtpolicyd
-Upstream-Contact: Markus Benning <ich@markusbenning.de>
-Source: http://search.cpan.org/dist/Mail-MtPolicyd/
-
-Files: *
-Copyright: 2014, Markus Benning <ich@markusbenning.de>
-License: GPL-2
- 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 package; if not, write to the Free
- Software Foundation, Inc., 51 Franklin St, Fifth Floor,
- Boston, MA 02110-1301 USA
- .
- On Debian systems, the full text of the GNU General Public
- License version 2 can be found in the file
- `/usr/share/common-licenses/GPL-2'.
-
-Files: debian/*
-Copyright: 2014, Markus Benning <ich@markusbenning.de>
-License: GPL-2
- 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 package; if not, write to the Free
- Software Foundation, Inc., 51 Franklin St, Fifth Floor,
- Boston, MA 02110-1301 USA
- .
- On Debian systems, the full text of the GNU General Public
- License version 2 can be found in the file
- `/usr/share/common-licenses/GPL-2'.
-
|
[-]
[+]
|
Deleted |
_service:download_files:Mail-MtPolicyd-1.23.tar.gz/debian/dirs
^
|
@@ -1 +0,0 @@
-var/lib/mtpolicyd
|
[-]
[+]
|
Deleted |
_service:download_files:Mail-MtPolicyd-1.23.tar.gz/debian/install
^
|
@@ -1 +0,0 @@
-etc/mtpolicyd.conf /etc/mtpolicyd
|
[-]
[+]
|
Deleted |
_service:download_files:Mail-MtPolicyd-1.23.tar.gz/debian/mtpolicyd.cron.d
^
|
@@ -1,5 +0,0 @@
-# crontab for mtpolicyd default tasks
-0 1-23 * * * mtpolicyd /usr/bin/mtpolicyd --cron hourly
-0 0 2-31 * 1-6 mtpolicyd /usr/bin/mtpolicyd --cron hourly,daily
-0 0 2-31 * 0 mtpolicyd /usr/bin/mtpolicyd --cron hourly,daily,weekly
-0 0 1 * * mtpolicyd /usr/bin/mtpolicyd --cron hourly,daily,weekly,monthly
|
[-]
[+]
|
Deleted |
_service:download_files:Mail-MtPolicyd-1.23.tar.gz/debian/mtpolicyd.docs
^
|
@@ -1 +0,0 @@
-README
|
[-]
[+]
|
Deleted |
_service:download_files:Mail-MtPolicyd-1.23.tar.gz/debian/mtpolicyd.init
^
|
@@ -1,71 +0,0 @@
-#!/bin/sh
-
-### BEGIN INIT INFO
-# Provides: mtpolicyd
-# Required-Start: $network $local_fs $remote_fs $syslog $named $time
-# Required-Stop: $network $local_fs $remote_fs $syslog $named
-# Should-Start: memcached
-# Should-Stop: memcached
-# Default-Start: 2 3 4 5
-# Default-Stop: 0 1 6
-# X-Start-Before: postfix
-# X-Stop-After: postfix
-# Short-Description: mtpolicyd Postfix policy daemon
-# Description: mtpolicyd is a modular policyd for postfix
-### END INIT INFO
-
-PATH=/sbin:/bin:/usr/sbin:/usr/bin
-
-. /lib/lsb/init-functions
-
-DAEMON=/usr/bin/mtpolicyd
-PIDDIR=/var/run/mtpolicyd
-PIDFILE=$PIDDIR/mtpolicyd.pid
-RUNASUSER=mtpolicyd
-
-test -x $DAEMON || exit 5
-
-if [ -r /etc/default/mtpolicyd ]; then
- . /etc/default/mtpolicyd
-fi
-
-case $1 in
- start)
- test -e "$PIDDIR" || mkdir "$PIDDIR"
- chown "$RUNASUSER" "$PIDDIR"
- log_daemon_msg "Starting postfix policy server" "mtpolicyd"
- start-stop-daemon \
- --start --quiet \
- --oknodo --pidfile $PIDFILE --startas $DAEMON
- status=$?
- log_end_msg $status
- ;;
- stop)
- log_daemon_msg "Stopping postfix policy server" "mtpolicyd"
- start-stop-daemon \
- --stop --quiet \
- --oknodo --pidfile $PIDFILE
- log_end_msg $?
- rm -f $PIDFILE
- ;;
- restart|force-reload)
- $0 stop && sleep 2 && $0 start
- ;;
- try-restart)
- if $0 status >/dev/null; then
- $0 restart
- else
- exit 0
- fi
- ;;
- reload)
- exit 3
- ;;
- status)
- status_of_proc $DAEMON "mtpolicyd daemon"
- ;;
- *)
- echo "Usage: $0 {start|stop|restart|try-restart|force-reload|status}"
- exit 2
- ;;
-esac
|
[-]
[+]
|
Deleted |
_service:download_files:Mail-MtPolicyd-1.23.tar.gz/debian/postinst
^
|
@@ -1,21 +0,0 @@
-#!/bin/sh
-
-set -e
-
-. /usr/share/debconf/confmodule
-
-if [ "$1" = configure ]; then
- lastversion="$2";
-
- getent group mtpolicyd >/dev/null 2>&1 || addgroup --system mtpolicyd
- getent passwd mtpolicyd >/dev/null 2>&1 ||
- adduser --system --home /var/run/mtpolicyd --no-create-home \
- --disabled-password --ingroup mtpolicyd mtpolicyd
-fi
-
-test -d /var/lib/mtpolicyd && \
- chown mtpolicyd:mtpolicyd /var/lib/mtpolicyd
-
-#DEBHELPER#
-
-exit 0
|
[-]
[+]
|
Deleted |
_service:download_files:Mail-MtPolicyd-1.23.tar.gz/debian/postrm
^
|
@@ -1,7 +0,0 @@
-#!/bin/sh
-
-set -e
-
-#DEBHELPER#
-
-exit 0
|
[-]
[+]
|
Deleted |
_service:download_files:Mail-MtPolicyd-1.23.tar.gz/debian/rules
^
|
@@ -1,7 +0,0 @@
-#!/usr/bin/make -f
-
-%:
- dh $@
-
-override_dh_auto_test:
-
|
[-]
[+]
|
Deleted |
_service:download_files:Mail-MtPolicyd-1.23.tar.gz/debian/source
^
|
-(directory)
|
[-]
[+]
|
Deleted |
_service:download_files:Mail-MtPolicyd-1.23.tar.gz/debian/source/format
^
|
@@ -1 +0,0 @@
-3.0 (native)
|
[-]
[+]
|
Deleted |
_service:download_files:Mail-MtPolicyd-1.23.tar.gz/lib/Mail/MtPolicyd/LdapConnection.pm
^
|
@@ -1,107 +0,0 @@
-package Mail::MtPolicyd::LdapConnection;
-
-use strict;
-use MooseX::Singleton;
-
-# ABSTRACT: singleton class to hold the ldap server connection
-our $VERSION = '1.23'; # VERSION
-
-use Net::LDAP;
-
-has 'host' => ( is => 'ro', isa => 'Str', required => 1 );
-has 'port' => ( is => 'ro', isa => 'Int', default => 389 );
-
-has 'keepalive' => ( is => 'ro', isa => 'Bool', default => 1 );
-has 'timeout' => ( is => 'ro', isa => 'Int', default => 120 );
-
-has 'binddn' => ( is => 'ro', isa => 'Maybe[Str]' );
-has 'password' => ( is => 'ro', isa => 'Maybe[Str]' );
-
-has 'starttls' => ( is => 'ro', isa => 'Bool', default => 1 );
-
-has 'handle' => ( is => 'rw', isa => 'Net::LDAP', lazy => 1,
- default => sub {
- my $self = shift;
- return $self->_connect_ldap;
- },
- handles => {
- 'disconnect' => 'unbind',
- },
-);
-
-has 'connection_class' => ( is => 'ro', isa => 'Maybe[Str]' );
-
-sub _connect_ldap {
- my $self = shift;
- my $ldap_class = 'Net::LDAP';
-
- if( defined $self->connection_class ) {
- $ldap_class = $self->connection_class;
- eval "require $ldap_class;"; ## no critic
- }
-
- my $ldap = $ldap_class->new(
- $self->host,
- port => $self->port,
- keepalive => $self->keepalive,
- timeout => $self->timeout,
- onerror => 'die',
- ) or die ('cant connect ldap: '.$@);
-
- if( $self->starttls ) {
- eval{ $ldap->start_tls( verify => 'require' ); };
- if( $@ ) { die('starttls on ldap connection failed: '.$@); }
- }
-
- if( defined $self->binddn ) {
- $ldap->bind( $self->binddn, password => $self->password );
- } else {
- $ldap->bind; # anonymous bind
- }
-
- return $ldap;
-}
-
-sub reconnect {
- my $self = shift;
- $self->handle( $self->_connect_ldap );
-}
-
-sub is_initialized {
- my ( $class, @args ) = @_;
-
- if( $class->meta->existing_singleton ) {
- return( 1 );
- }
- return( 0 );
-}
-
-1;
-
-__END__
-
-=pod
-
-=encoding UTF-8
-
-=head1 NAME
-
-Mail::MtPolicyd::LdapConnection - singleton class to hold the ldap server connection
-
-=head1 VERSION
-
-version 1.23
-
-=head1 AUTHOR
-
-Markus Benning <ich@markusbenning.de>
-
-=head1 COPYRIGHT AND LICENSE
-
-This software is Copyright (c) 2014 by Markus Benning <ich@markusbenning.de>.
-
-This is free software, licensed under:
-
- The GNU General Public License, Version 2, June 1991
-
-=cut
|
[-]
[+]
|
Deleted |
_service:download_files:Mail-MtPolicyd-1.23.tar.gz/lib/Mail/MtPolicyd/SqlConnection.pm
^
|
@@ -1,81 +0,0 @@
-package Mail::MtPolicyd::SqlConnection;
-
-use strict;
-use MooseX::Singleton;
-
-# ABSTRACT: singleton class to hold the sql database connection
-our $VERSION = '1.23'; # VERSION
-
-use DBI;
-
-has 'dsn' => ( is => 'ro', isa => 'Str', required => 1 );
-has 'user' => ( is => 'ro', isa => 'Str', required => 1 );
-has 'password' => ( is => 'ro', isa => 'Str', required => 1 );
-
-has 'dbh' => ( is => 'rw', isa => 'DBI::db', lazy => 1,
- default => sub {
- my $self = shift;
- return $self->_create_dbh;
- },
- handles => [ 'disconnect' ],
-);
-
-sub _create_dbh {
- my $self = shift;
- my $dbh = DBI->connect(
- $self->dsn,
- $self->user,
- $self->password,
- {
- RaiseError => 1,
- PrintError => 0,
- AutoCommit => 1,
- mysql_auto_reconnect => 1,
- },
- );
- return $dbh;
-}
-
-sub reconnect {
- my $self = shift;
- $self->dbh( $self->_create_dbh );
-}
-
-sub is_initialized {
- my ( $class, @args ) = @_;
-
- if( $class->meta->existing_singleton ) {
- return( 1 );
- }
- return( 0 );
-}
-
-1;
-
-__END__
-
-=pod
-
-=encoding UTF-8
-
-=head1 NAME
-
-Mail::MtPolicyd::SqlConnection - singleton class to hold the sql database connection
-
-=head1 VERSION
-
-version 1.23
-
-=head1 AUTHOR
-
-Markus Benning <ich@markusbenning.de>
-
-=head1 COPYRIGHT AND LICENSE
-
-This software is Copyright (c) 2014 by Markus Benning <ich@markusbenning.de>.
-
-This is free software, licensed under:
-
- The GNU General Public License, Version 2, June 1991
-
-=cut
|
[-]
[+]
|
Deleted |
_service:download_files:Mail-MtPolicyd-1.23.tar.gz/t/sqlconnection.t
^
|
@@ -1,40 +0,0 @@
-#!perl
-
-use strict;
-use warnings;
-
-use Test::More tests => 7;
-use Test::Exception;
-
-use Mail::MtPolicyd::SqlConnection;
-
-ok( ! Mail::MtPolicyd::SqlConnection->is_initialized, 'must be uninitialized');
-
-dies_ok {
- Mail::MtPolicyd::SqlConnection->dbh;
-} 'accessing dbh must die if uninitialized';
-
-# build a fake database with an in-memory SQLite DB
-Mail::MtPolicyd::SqlConnection->initialize(
- dsn => 'dbi:SQLite::memory:',
- user => '',
- password => '',
-);
-isa_ok( Mail::MtPolicyd::SqlConnection->instance, 'Mail::MtPolicyd::SqlConnection');
-ok( Mail::MtPolicyd::SqlConnection->is_initialized, 'must be initialized');
-
-my $dbh = Mail::MtPolicyd::SqlConnection->dbh;
-isa_ok( $dbh, 'DBI::db');
-
-lives_ok {
- $dbh->do(
- 'CREATE TABLE `list` (
- `id` INTEGER PRIMARY KEY AUTOINCREMENT,
- `client_ip` varchar(255) DEFAULT NULL
- )'
- );
- $dbh->do("INSERT INTO `list` VALUES (NULL, '192.168.0.1');");
-} 'test some valid sql';
-
-throws_ok { $dbh->do('zumsel') } qr/syntax error/, 'must die on errors';
-
|
[-]
[+]
|
Changed |
_service:download_files:Mail-MtPolicyd-2.02.tar.gz/CHANGES
^
|
@@ -1,9 +1,212 @@
==================================================
-Changes from 2014-12-14 00:00:00 +0000 to present.
+Changes from 2015-08-11 00:00:00 +0000 to present.
==================================================
-----------------------------------------
-version 1.23 at 2015-12-14 15:04:38 +0000
+version 2.02 at 2016-08-10 18:42:45 +0000
+-----------------------------------------
+
+ Change: e5fac2e10f1bf2653abb6ecc9af05034bd67e4cd
+ Author: Markus Benning <ich@markusbenning.de>
+ Date : 2016-08-10 20:39:23 +0000
+
+ Add tests for session caching and fix related bugs
+
+ This add test cases for memcached and redis based session caching and
+ fixes a few related bugs.
+
+ fixes #15 #16 #17 #19
+
+ Change: 78e42d2bcc4ce829ede501cfc145e0dd637fb66b
+ Author: Markus Benning <ich@markusbenning.de>
+ Date : 2016-08-09 13:16:52 +0000
+
+ Fix Kwalitee issues
+
+-----------------------------------------
+version 2.01 at 2016-08-06 19:52:29 +0000
+-----------------------------------------
+
+ Change: 01ed4fe6ac040944511cf11e8749ba148c3addc0
+ Author: Markus Benning <ich@markusbenning.de>
+ Date : 2016-08-06 21:52:29 +0000
+
+ Dont include local/ in dist
+
+ Change: 86f3b7663e7b38b54cbafd6e145add717a76d8bf
+ Author: Markus Benning <ich@markusbenning.de>
+ Date : 2016-08-06 21:36:44 +0000
+
+ Add cpanfile.snapshot to .gitignore
+
+ Change: 7456978e190f05a348bb9212dfca416aa87d481d
+ Author: Markus Benning <ich@markusbenning.de>
+ Date : 2016-08-06 20:35:51 +0000
+
+ Revert using cpanfile.snapshot
+
+ Change: 53ac1ccf5ba3a46b30224722ab73be6e7283ead3
+ Author: Markus Benning <ich@markusbenning.de>
+ Date : 2016-08-06 20:32:49 +0000
+
+ Updated documentation/upgrade notes
+
+ Change: 850a74f28f841bde2846f34e67799abce79e59dc
+ Author: Markus Benning <ich@markusbenning.de>
+ Date : 2016-08-06 20:04:12 +0000
+
+ Add dependecy on Redis
+
+ Change: 8b38a6ffa961224f48efa84d450a52f6c010f870
+ Author: Markus Benning <ich@markusbenning.de>
+ Date : 2016-08-06 18:46:37 +0000
+
+ Added missing depedency on LDAP mock
+
+ Change: d5b999117839ac6f3ff741ef597089a85d5e726e
+ Author: Markus Benning <ich@markusbenning.de>
+ Date : 2016-08-06 18:31:26 +0000
+
+ Remove test for nonexisting SqlConnection class
+
+ Change: bb36632db9c116a73d938906a6304d224b3a4c6f
+ Author: Markus Benning <ich@markusbenning.de>
+ Date : 2016-08-06 18:17:38 +0000
+
+ Add temporary build files for .dockerignore
+
+ Change: 290d62f94930c25d63b87b4b51eadce0b4cd0f6b
+ Author: Markus Benning <ich@markusbenning.de>
+ Date : 2016-08-06 18:08:31 +0000
+
+ Add cpanfile.snapshot to fix carton deploy
+
+ Change: 4046ff5d961992a20aa454699b33a8f9ddecb8a2
+ Author: Markus Benning <ich@markusbenning.de>
+ Date : 2016-08-06 18:06:05 +0000
+
+ Fix docker-compose and use carton deployment
+
+ Change: bfa6bde5ae15335431d325b90eaeb206089aed2e
+ Author: Markus Benning <ich@markusbenning.de>
+ Date : 2016-08-06 17:51:37 +0000
+
+ Added docker and docker-compose configuration
+
+ Change: 7590d99214e528d9a8169591bca61aa6b075df87
+ Author: Markus Benning <ich@markusbenning.de>
+ Date : 2016-08-06 17:29:46 +0000
+
+ Remove debian packaging from CPAN dist
+
+ Change: 11b13df83cec618d8c80cdedc501a6c788e96873
+ Author: Markus Benning <ich@markusbenning.de>
+ Date : 2016-08-06 17:27:30 +0000
+
+ Remove dependecies from dist.ini
+
+ Change: 604be923459e392b0279f3ccde434c49a94510d0
+ Author: Markus Benning <ich@markusbenning.de>
+ Date : 2016-08-06 17:25:50 +0000
+
+ Adjust dist to cpanfile dependecies
+
+ Change: b9fa0982842e7e294998c192764a73085c9a7c7a
+ Author: Markus Benning <ich@markusbenning.de>
+ Date : 2016-08-06 17:14:14 +0000
+
+ Added support for redis connection and cache
+
+ Change: d4e6534b970ca73d9f19226e161e8531cb885eb1
+ Author: Markus Benning <ich@markusbenning.de>
+ Date : 2016-08-06 17:12:45 +0000
+
+ Fix tests and a some bugs
+
+ This adjusts the tests to the new ConnectionPool and SessionCache
+ infstracture.
+
+ Change: cbdb082b47d3d6d05dd0b3a08de38d4d5b42e559
+ Author: Markus Benning <ich@markusbenning.de>
+ Date : 2016-07-10 16:34:11 +0000
+
+ plugable session cache and connection pool
+
+ This adds a generic connection pool mechanism and the possiblitiy of
+ session caches other than memcached.
+
+ Change: f55e530bed65bc4db5019c2067cf03a4ee2ee92f
+ Author: Markus Benning <ich@markusbenning.de>
+ Date : 2016-07-04 12:31:37 +0000
+
+ Add some checks for uninitialized values
+
+ fixes #12
+
+ Change: ddc8472f653be44db0ee51bdc8da4948acdd81e6
+ Author: Markus Benning <ich@markusbenning.de>
+ Date : 2016-07-04 12:31:00 +0000
+
+ create sqlite database in postinst
+
+ Change: 850641710fe36402ae0e0f5a22a8e35b12669fdd
+ Author: Markus Benning <ich@markusbenning.de>
+ Date : 2016-03-04 15:11:19 +0000
+
+ Add softfail and update docs on SPF plugin
+
+ Two new options for softfail have been added to the SPF plugin:
+
+ * softfail_mode (default: passive)
+
+ * softfail_score (default: empty)
+
+ These could be used to apply a action or score whene the SPF check
+ returns a softfail status.
+
+ Also the documentation has been updated to clarify that on neutral
+ check result no action will be applied by the plugin.
+
+ Change: e30ad9c2357323722c7c63d5ade6f0f473102028
+ Author: Markus Benning <ich@markusbenning.de>
+ Date : 2016-03-02 09:08:35 +0000
+
+ Improvements for Condition module
+
+ This implements a generic method get() in the Request object to
+ retrieve request attributes or session variables.
+
+ It support the following syntax for retrieving variables:
+
+ To retrieve request attributes:
+
+ request:<variable>
+
+ r:<variable>
+
+ If no scope is given it defaults to 'request'
+
+ <variable>
+
+ To retrieve session variables:
+
+ session:<variable>
+
+ s:<variable>
+
+ It also changes the Condition plugin to accept this syntax in the
+ "key" configuration parameter.
+
+ Also an `invert` option has been added to the condition module.
+
+ Change: aa17f3402d1924bfbdb58b56f5f4c6a3fdf993ad
+ Author: Markus Benning <ich@markusbenning.de>
+ Date : 2015-12-14 16:23:47 +0000
+
+ create /var/run/mtpolicyd in debian package
+
+-----------------------------------------
+version 1.23 at 2015-12-14 15:00:05 +0000
-----------------------------------------
Change: bcecb4f1eb53867f5b602af9dc5071a129ecfb87
@@ -254,287 +457,6 @@
<vhost>: instance=<instance>, type=<type>, t=<time>ms,
plugin=<plugin>, result=<result>
------------------------------------------
-version 1.19 at 2015-08-03 20:06:43 +0000
------------------------------------------
-
- Change: 1a677872e968ee1aee8f28e4f61db05935cd10a0
- Author: Markus Benning <ich@markusbenning.de>
- Date : 2015-08-03 22:06:43 +0000
-
- escape control characters in logs
-
- The logging method in Mail::MtPolicyd now extends the Net::Server log
- method with a mechanism to escape control and special characters.
-
- Change: b267840dec8c16856528711ce56f68f98e3dfe85
- Author: Markus Benning <ich@markusbenning.de>
- Date : 2015-04-27 13:36:08 +0000
-
- update debian/ copyright and control file
-
- Change: 29fd63d02bb0d14acd6f364a512030f86155ff17
- Author: Markus Benning <ich@markusbenning.de>
- Date : 2015-04-22 23:02:33 +0000
-
- even more lintian fixes
-
- Change: 3583c91cbc288e3bb124485f92b8e035884a58d1
- Author: Markus Benning <ich@markusbenning.de>
- Date : 2015-04-22 22:39:20 +0000
-
- add DEBHELPER comments to maintainer scripts
-
- Change: 264f54b2b7a3ccd9de75bfbcebe2c851cffb721c
- Author: Markus Benning <ich@markusbenning.de>
- Date : 2015-04-22 22:33:59 +0000
-
- fix some spelling errors
-
------------------------------------------
-version 1.18 at 2015-04-22 20:19:26 +0000
------------------------------------------
-
- Change: ef92af0578b8ec737a2a830b2c1b0e4ba389fa16
- Author: Markus Benning <ich@markusbenning.de>
- Date : 2015-04-22 22:19:26 +0000
-
- add debian upload files to gitignore
-
- Change: 52da8e53452c3846935329430bc01f9c8ee3b262
- Author: Markus Benning <ich@markusbenning.de>
- Date : 2015-04-22 22:18:45 +0000
-
- fixed lintian packaging errors
-
- Change: 17d3394157e4c33b168c6c0f33429210020b0673
- Author: Markus Benning <ich@markusbenning.de>
- Date : 2015-04-22 22:00:29 +0000
-
- more lintian fixes
-
- Change: 7d613aa48fcc14fca241ddd616b5ee8e6baa475d
- Author: Markus Benning <ich@markusbenning.de>
- Date : 2015-04-22 21:54:16 +0000
-
- lintian package adjustments
-
- Change: 4f949a13a3f98e4fc43e26dc856da6cf4b69b836
- Author: Markus Benning <ich@markusbenning.de>
- Date : 2015-03-20 13:23:17 +0000
-
- more fixes for packaging
-
------------------------------------------
-version 1.17 at 2015-03-20 08:32:08 +0000
------------------------------------------
-
- Change: 5409bc1efe82a78b43bf8448c249f7b730c09a0b
- Author: Markus Benning <ich@markusbenning.de>
- Date : 2015-03-20 09:32:08 +0000
-
- fix comment
-
- Change: 815f2de7d9197aa6a2c2df0fc06c1cb9114babef
- Author: Markus Benning <ich@markusbenning.de>
- Date : 2015-03-20 09:31:27 +0000
-
- exclude debian build from CPAN tarball
-
- Change: 591c82aebb8972bfd22508f2f49b0042bd099fb5
- Author: Markus Benning <ich@markusbenning.de>
- Date : 2015-03-20 09:26:56 +0000
-
- skip cucumber tests when cucumber is unavailable
-
- Change: 37668e6b0bd7315836ed3861b2c78ea8a6927b0b
- Author: Markus Benning <ich@markusbenning.de>
- Date : 2015-03-20 09:26:37 +0000
-
- add website and mailinglist to meta infos
-
------------------------------------------
-version 1.16 at 2015-03-10 08:24:44 +0000
------------------------------------------
-
- Change: 49080c9d26533c6604e37f0437426fec1c2c9c0f
- Author: Markus Benning <ich@markusbenning.de>
- Date : 2015-03-10 09:24:44 +0000
-
- Small fixes
-
- * fix min_count in SaAwlAction
-
- * check for pid folder in init script
-
- Change: 7f466fd4ce94fa66bbbef52a319f8b631be01caa
- Author: Markus Benning <ich@markusbenning.de>
- Date : 2015-03-04 06:22:20 +0000
-
- Improved SPF support
-
- Change: d77c8e563b2dd86217fb88ffc34331492779f36a
- Author: Markus Benning <ich@markusbenning.de>
- Date : 2015-03-02 09:05:26 +0000
-
- Add IP address whitelisting in SPF plugin
-
- * always whitelist localhost addresses
-
- * add whitelist option for additional IPs
-
- Change: 0fedd6139f0f82100338cdced432b96ee5cac230
- Author: Markus Benning <ich@markusbenning.de>
- Date : 2015-03-02 09:02:30 +0000
-
- fix domain in DBL test
-
- Change: 4b91b28f1e8604e2428ed8454ed4f02f71090df4
- Author: Markus Benning <ich@markusbenning.de>
- Date : 2015-03-01 11:28:46 +0000
-
- Merge branch 'master' of https://github.com/benningm/mtpolicyd
-
- Change: 7b1d0a7cb6c469890d613a4525d1c936cc0f60a7
- Author: Markus Benning <ich@markusbenning.de>
- Date : 2015-03-01 11:26:17 +0000
-
- support for using spamassassins AWL as reputation source
-
- Change: de19d2c321c9935393c45c73c7ec9cf7c8ac54f4
- Author: Markus Benning <me@w3r3wolf.de>
- Date : 2015-01-20 13:32:35 +0000
-
- Merge pull request #3 from xpunkt/patch-1
-
- update abstract
-
- Change: b88813caffb751d2698bb5e68f88a3c3ebe2d307
- Author: Benny Pedersen <xpunkt@users.noreply.github.com>
- Date : 2015-01-20 09:29:12 +0000
-
- update abstract
-
- small error, no program errror
-
------------------------------------------
-version 1.15 at 2015-01-07 15:17:56 +0000
------------------------------------------
-
- Change: 2a46db07eb9f5a4a558355bdbadd9d6224c643dc
- Author: Markus Benning <ich@markusbenning.de>
- Date : 2015-01-07 16:17:56 +0000
-
- Documentation updates
-
- * added how to for Accounting/Quotas
-
- * add section about cron() in Cookbook::ExtendedPlugin
-
- Change: 635fc08b7b9ddc91a264966cf475be90a18345a4
- Author: Markus Benning <ich@markusbenning.de>
- Date : 2015-01-07 12:50:33 +0000
-
- Added Quota plugin
-
- * new Plugin: Quota
-
- * make field for SQL configurable in SqlUserConfig
-
- * add tests for Quota to accounting test cases
-
- Change: 08cf926d66643d371a36427dc01f49f7aa9f5461
- Author: Markus Benning <ich@markusbenning.de>
- Date : 2015-01-06 19:35:39 +0000
-
- Added support for cron tasks
-
- * added a crontab to call mtpolicyd periodically
-
- * add mtpolicyd --cron <tasks> to execute tasks
-
- * plugins can do cron jobs by implementing a cron()
-
- * added autowl expire to Plugin::Greylist based on cron()
-
- Change: 77ad175c055c2bc5dcb27ded0ae60cdcee13be6a
- Author: Markus Benning <ich@markusbenning.de>
- Date : 2014-12-23 13:31:59 +0000
-
- Small fixes
-
- * initialize SQL connection before plugins
-
- * skip also emtpy or whitespace request attributes
-
- Change: 059c1a4aae0001ba0b02044ce18e855f227cfaff
- Author: Markus Benning <ich@markusbenning.de>
- Date : 2014-12-23 12:46:47 +0000
-
- Added Accounting Plugin
-
- Change: 94380a398c18a79026f9abe8d849931e7387aed7
- Author: Markus Benning <ich@markusbenning.de>
- Date : 2014-12-22 14:03:24 +0000
-
- More SQL improvements
-
- * add unit tests t/plugin-role-sqlutils.t t/sqlconnection.t
-
- * add support for automatic table creation
-
- Greylisting Plugin
-
- * fix autowl expire
-
- * add unit test for greylisting plugin
-
- Change: cfa1805d549c5717b7abc3548e234ebd1505f792
- Author: Markus Benning <ich@markusbenning.de>
- Date : 2014-12-22 09:15:59 +0000
-
- Add some SQL infrastructure
-
- * added Mail::MtPolicyd::SqlConnection singleton for storing DB
-
- connnection
-
- * added Plugin::Role::SqlUtils for code shared by plugins
-
- * adjust existing plugins
-
- * adjust tests
-
- Change: 42a968ccd63f6cc1eb0c35bf64b3bb713a77095d
- Author: Markus Benning <ich@markusbenning.de>
- Date : 2014-12-22 09:14:15 +0000
-
- Fix RBL test IP
-
- * use XBL test IP instead of a real client IP
-
- Change: cefd767f93b66d259638e2d2d1c69801d27f8748
- Author: Markus Benning <ich@markusbenning.de>
- Date : 2014-12-19 16:23:21 +0000
-
- Add cucumber test cases
-
- * added basic step files for cucumber test
-
- * add 2 basic server tests (minimal.conf and spamhaus-rbls.conf)
-
- Change: 86eff808ab85a144d70f4442ac1199e940f53d86
- Author: Markus Benning <ich@markusbenning.de>
- Date : 2014-12-19 15:30:43 +0000
-
- Dont fail in SPF when sender/client_address unavailable
-
- Change: 8ebd94873931b78b9f86ce8909ebb22fe0a727cf
- Author: Markus Benning <ich@markusbenning.de>
- Date : 2014-12-18 13:15:05 +0000
-
- fixed missing dependencies in debian package
-
================================================
-Plus 4 releases after 2014-12-14 00:00:00 +0000.
+Plus 9 releases after 2015-08-11 00:00:00 +0000.
================================================
|
[-]
[+]
|
Added |
_service:download_files:Mail-MtPolicyd-2.02.tar.gz/Dockerfile
^
|
@@ -0,0 +1,20 @@
+FROM perl:5.24.0
+MAINTAINER Markus Benning <ich@markusbenning.de>
+
+COPY ./cpanfile /mtpolicyd/cpanfile
+WORKDIR /mtpolicyd
+
+RUN cpanm --notest Carton \
+ && carton install \
+ && rm -rf ~/.cpanm
+
+RUN addgroup --system mtpolicyd \
+ && adduser --system --home /mtpolicyd --no-create-home \
+ --disabled-password --ingroup mtpolicyd mtpolicyd
+
+COPY . /mtpolicyd
+COPY ./etc/docker.conf /etc/mtpolicyd/mtpolicyd.conf
+
+EXPOSE 12345
+
+CMD [ "carton", "exec", "perl", "-Mlib=./lib", "bin/mtpolicyd", "-f", "-l", "2", "-c", "/etc/mtpolicyd/mtpolicyd.conf" ]
|
[-]
[+]
|
Changed |
_service:download_files:Mail-MtPolicyd-2.02.tar.gz/MANIFEST
^
|
@@ -1,5 +1,6 @@
# This file was automatically generated by Dist::Zilla::Plugin::Manifest v5.020.
CHANGES
+Dockerfile
LICENSE
MANIFEST
META.json
@@ -8,20 +9,10 @@
README
bin/mtpolicyd
bin/policyd-client
-debian/changelog
-debian/compat
-debian/control
-debian/copyright
-debian/dirs
-debian/install
-debian/mtpolicyd.cron.d
-debian/mtpolicyd.docs
-debian/mtpolicyd.init
-debian/postinst
-debian/postrm
-debian/rules
-debian/source/format
+cpanfile
dist.ini
+docker-compose.yml
+etc/docker.conf
etc/mtpolicyd.conf
etc/mtpolicyd.crontab
lib/Mail/MtPolicyd.pm
@@ -30,12 +21,17 @@
lib/Mail/MtPolicyd/Client/App.pm
lib/Mail/MtPolicyd/Client/Request.pm
lib/Mail/MtPolicyd/Client/Response.pm
+lib/Mail/MtPolicyd/Connection.pm
+lib/Mail/MtPolicyd/Connection/Ldap.pm
+lib/Mail/MtPolicyd/Connection/Memcached.pm
+lib/Mail/MtPolicyd/Connection/Redis.pm
+lib/Mail/MtPolicyd/Connection/Sql.pm
+lib/Mail/MtPolicyd/ConnectionPool.pm
lib/Mail/MtPolicyd/Cookbook.pod
lib/Mail/MtPolicyd/Cookbook/BasicPlugin.pod
lib/Mail/MtPolicyd/Cookbook/ExtendedPlugin.pod
lib/Mail/MtPolicyd/Cookbook/HowtoAccountingQuota.pod
lib/Mail/MtPolicyd/Cookbook/Installation.pod
-lib/Mail/MtPolicyd/LdapConnection.pm
lib/Mail/MtPolicyd/Plugin.pm
lib/Mail/MtPolicyd/Plugin/Accounting.pm
lib/Mail/MtPolicyd/Plugin/Action.pm
@@ -76,7 +72,12 @@
lib/Mail/MtPolicyd/Profiler/Timer.pm
lib/Mail/MtPolicyd/Request.pm
lib/Mail/MtPolicyd/Result.pm
-lib/Mail/MtPolicyd/SqlConnection.pm
+lib/Mail/MtPolicyd/Role/Connection.pm
+lib/Mail/MtPolicyd/SessionCache.pm
+lib/Mail/MtPolicyd/SessionCache/Base.pm
+lib/Mail/MtPolicyd/SessionCache/Memcached.pm
+lib/Mail/MtPolicyd/SessionCache/None.pm
+lib/Mail/MtPolicyd/SessionCache/Redis.pm
lib/Mail/MtPolicyd/VirtualHost.pm
rpm/mtpolicyd.init-redhat
rpm/mtpolicyd.spec
@@ -114,7 +115,7 @@
t/server-minimal.feature
t/server-spamhaus-rbls.feature
t/server-vhost-by-policy-context.feature
-t/sqlconnection.t
+t/session-cache.t
t/step_definitions/00test-net-server_steps.pl
t/step_definitions/client_steps.pl
t/step_definitions/mtpolicyd_run_steps.pl
|
[-]
[+]
|
Changed |
_service:download_files:Mail-MtPolicyd-2.02.tar.gz/META.json
^
|
@@ -21,6 +21,25 @@
},
"develop" : {
"requires" : {
+ "Dist::Zilla::Plugin::ChangelogFromGit" : "0",
+ "Dist::Zilla::Plugin::ChangelogFromGit::Debian" : "0",
+ "Dist::Zilla::Plugin::FileFinder::ByName" : "0",
+ "Dist::Zilla::Plugin::Git::NextVersion" : "0",
+ "Dist::Zilla::Plugin::MetaJSON" : "0",
+ "Dist::Zilla::Plugin::MetaProvides::Package" : "0",
+ "Dist::Zilla::Plugin::MetaResources" : "0",
+ "Dist::Zilla::Plugin::OurPkgVersion" : "0",
+ "Dist::Zilla::Plugin::PodSyntaxTests" : "0",
+ "Dist::Zilla::Plugin::PodWeaver" : "0",
+ "Dist::Zilla::Plugin::Prereqs" : "0",
+ "Dist::Zilla::Plugin::Prereqs::FromCPANfile" : "0",
+ "Dist::Zilla::Plugin::PruneFiles" : "0",
+ "Dist::Zilla::Plugin::Template::Tiny" : "0",
+ "Dist::Zilla::Plugin::Test::Perl::Critic" : "0",
+ "Dist::Zilla::Plugin::TravisYML" : "0",
+ "Dist::Zilla::PluginBundle::Basic" : "0",
+ "Dist::Zilla::PluginBundle::Git" : "0",
+ "ExtUtils::MakeMaker" : "0",
"Test::Pod" : "1.41"
}
},
@@ -54,15 +73,15 @@
"Net::SMTP::Verify" : "0",
"Net::Server::PreFork" : "0",
"NetAddr::IP" : "0",
+ "Redis" : "0",
+ "Storable" : "0",
"Tie::IxHash" : "0",
"Time::HiRes" : "0",
"Time::Piece" : "0",
"Time::Seconds" : "0",
- "base" : "0",
"namespace::autoclean" : "0",
"perl" : "v5.8.5",
- "strict" : "0",
- "warnings" : "0"
+ "strict" : "0"
}
},
"test" : {
@@ -72,18 +91,260 @@
"File::ReadBackwards" : "0",
"File::Temp" : "0",
"IO::File" : "0",
- "POSIX" : "0",
+ "String::Random" : "0",
"Template" : "0",
"Test::BDD::Cucumber::Harness::TestBuilder" : "0",
"Test::BDD::Cucumber::Loader" : "0",
+ "Test::Deep" : "0",
"Test::Exception" : "0",
"Test::Memcached" : "0",
"Test::Mock::Net::Server::Mail" : "0",
"Test::MockObject" : "0",
- "Test::More" : "0"
+ "Test::More" : "0",
+ "Test::Net::LDAP::Mock" : "0",
+ "Test::Pod" : "0",
+ "Test::RedisDB" : "0"
}
}
},
+ "provides" : {
+ "Mail::MtPolicyd" : {
+ "file" : "lib/Mail/MtPolicyd.pm",
+ "version" : "2.02"
+ },
+ "Mail::MtPolicyd::AddressList" : {
+ "file" : "lib/Mail/MtPolicyd/AddressList.pm",
+ "version" : "2.02"
+ },
+ "Mail::MtPolicyd::Client" : {
+ "file" : "lib/Mail/MtPolicyd/Client.pm",
+ "version" : "2.02"
+ },
+ "Mail::MtPolicyd::Client::App" : {
+ "file" : "lib/Mail/MtPolicyd/Client/App.pm",
+ "version" : "2.02"
+ },
+ "Mail::MtPolicyd::Client::Request" : {
+ "file" : "lib/Mail/MtPolicyd/Client/Request.pm",
+ "version" : "2.02"
+ },
+ "Mail::MtPolicyd::Client::Response" : {
+ "file" : "lib/Mail/MtPolicyd/Client/Response.pm",
+ "version" : "2.02"
+ },
+ "Mail::MtPolicyd::Connection" : {
+ "file" : "lib/Mail/MtPolicyd/Connection.pm",
+ "version" : "2.02"
+ },
+ "Mail::MtPolicyd::Connection::Ldap" : {
+ "file" : "lib/Mail/MtPolicyd/Connection/Ldap.pm",
+ "version" : "2.02"
+ },
+ "Mail::MtPolicyd::Connection::Memcached" : {
+ "file" : "lib/Mail/MtPolicyd/Connection/Memcached.pm",
+ "version" : "2.02"
+ },
+ "Mail::MtPolicyd::Connection::Redis" : {
+ "file" : "lib/Mail/MtPolicyd/Connection/Redis.pm",
+ "version" : "2.02"
+ },
+ "Mail::MtPolicyd::Connection::Sql" : {
+ "file" : "lib/Mail/MtPolicyd/Connection/Sql.pm",
+ "version" : "2.02"
+ },
+ "Mail::MtPolicyd::ConnectionPool" : {
+ "file" : "lib/Mail/MtPolicyd/ConnectionPool.pm",
+ "version" : "2.02"
+ },
+ "Mail::MtPolicyd::Plugin" : {
+ "file" : "lib/Mail/MtPolicyd/Plugin.pm",
+ "version" : "2.02"
+ },
+ "Mail::MtPolicyd::Plugin::Accounting" : {
+ "file" : "lib/Mail/MtPolicyd/Plugin/Accounting.pm",
+ "version" : "2.02"
+ },
+ "Mail::MtPolicyd::Plugin::Action" : {
+ "file" : "lib/Mail/MtPolicyd/Plugin/Action.pm",
+ "version" : "2.02"
+ },
+ "Mail::MtPolicyd::Plugin::AddScoreHeader" : {
+ "file" : "lib/Mail/MtPolicyd/Plugin/AddScoreHeader.pm",
+ "version" : "2.02"
+ },
+ "Mail::MtPolicyd::Plugin::ClearFields" : {
+ "file" : "lib/Mail/MtPolicyd/Plugin/ClearFields.pm",
+ "version" : "2.02"
+ },
+ "Mail::MtPolicyd::Plugin::Condition" : {
+ "file" : "lib/Mail/MtPolicyd/Plugin/Condition.pm",
+ "version" : "2.02"
+ },
+ "Mail::MtPolicyd::Plugin::CtIpRep" : {
+ "file" : "lib/Mail/MtPolicyd/Plugin/CtIpRep.pm",
+ "version" : "2.02"
+ },
+ "Mail::MtPolicyd::Plugin::DBL" : {
+ "file" : "lib/Mail/MtPolicyd/Plugin/DBL.pm",
+ "version" : "2.02"
+ },
+ "Mail::MtPolicyd::Plugin::Eval" : {
+ "file" : "lib/Mail/MtPolicyd/Plugin/Eval.pm",
+ "version" : "2.02"
+ },
+ "Mail::MtPolicyd::Plugin::Fail2Ban" : {
+ "file" : "lib/Mail/MtPolicyd/Plugin/Fail2Ban.pm",
+ "version" : "2.02"
+ },
+ "Mail::MtPolicyd::Plugin::GeoIPAction" : {
+ "file" : "lib/Mail/MtPolicyd/Plugin/GeoIPAction.pm",
+ "version" : "2.02"
+ },
+ "Mail::MtPolicyd::Plugin::GeoIPLookup" : {
+ "file" : "lib/Mail/MtPolicyd/Plugin/GeoIPLookup.pm",
+ "version" : "2.02"
+ },
+ "Mail::MtPolicyd::Plugin::Greylist" : {
+ "file" : "lib/Mail/MtPolicyd/Plugin/Greylist.pm",
+ "version" : "2.02"
+ },
+ "Mail::MtPolicyd::Plugin::Honeypot" : {
+ "file" : "lib/Mail/MtPolicyd/Plugin/Honeypot.pm",
+ "version" : "2.02"
+ },
+ "Mail::MtPolicyd::Plugin::LdapUserConfig" : {
+ "file" : "lib/Mail/MtPolicyd/Plugin/LdapUserConfig.pm",
+ "version" : "2.02"
+ },
+ "Mail::MtPolicyd::Plugin::PostfixMap" : {
+ "file" : "lib/Mail/MtPolicyd/Plugin/PostfixMap.pm",
+ "version" : "2.02"
+ },
+ "Mail::MtPolicyd::Plugin::Proxy" : {
+ "file" : "lib/Mail/MtPolicyd/Plugin/Proxy.pm",
+ "version" : "2.02"
+ },
+ "Mail::MtPolicyd::Plugin::Quota" : {
+ "file" : "lib/Mail/MtPolicyd/Plugin/Quota.pm",
+ "version" : "2.02"
+ },
+ "Mail::MtPolicyd::Plugin::RBL" : {
+ "file" : "lib/Mail/MtPolicyd/Plugin/RBL.pm",
+ "version" : "2.02"
+ },
+ "Mail::MtPolicyd::Plugin::RBLAction" : {
+ "file" : "lib/Mail/MtPolicyd/Plugin/RBLAction.pm",
+ "version" : "2.02"
+ },
+ "Mail::MtPolicyd::Plugin::Result" : {
+ "file" : "lib/Mail/MtPolicyd/Plugin/Result.pm",
+ "version" : "2.02"
+ },
+ "Mail::MtPolicyd::Plugin::Role::ConfigurableFields" : {
+ "file" : "lib/Mail/MtPolicyd/Plugin/Role/ConfigurableFields.pm",
+ "version" : "2.02"
+ },
+ "Mail::MtPolicyd::Plugin::Role::PluginChain" : {
+ "file" : "lib/Mail/MtPolicyd/Plugin/Role/PluginChain.pm",
+ "version" : "2.02"
+ },
+ "Mail::MtPolicyd::Plugin::Role::Scoring" : {
+ "file" : "lib/Mail/MtPolicyd/Plugin/Role/Scoring.pm",
+ "version" : "2.02"
+ },
+ "Mail::MtPolicyd::Plugin::Role::SqlUtils" : {
+ "file" : "lib/Mail/MtPolicyd/Plugin/Role/SqlUtils.pm",
+ "version" : "2.02"
+ },
+ "Mail::MtPolicyd::Plugin::Role::UserConfig" : {
+ "file" : "lib/Mail/MtPolicyd/Plugin/Role/UserConfig.pm",
+ "version" : "2.02"
+ },
+ "Mail::MtPolicyd::Plugin::SMTPVerify" : {
+ "file" : "lib/Mail/MtPolicyd/Plugin/SMTPVerify.pm",
+ "version" : "2.02"
+ },
+ "Mail::MtPolicyd::Plugin::SPF" : {
+ "file" : "lib/Mail/MtPolicyd/Plugin/SPF.pm",
+ "version" : "2.02"
+ },
+ "Mail::MtPolicyd::Plugin::SaAwlAction" : {
+ "file" : "lib/Mail/MtPolicyd/Plugin/SaAwlAction.pm",
+ "version" : "2.02"
+ },
+ "Mail::MtPolicyd::Plugin::SaAwlLookup" : {
+ "file" : "lib/Mail/MtPolicyd/Plugin/SaAwlLookup.pm",
+ "version" : "2.02"
+ },
+ "Mail::MtPolicyd::Plugin::ScoreAction" : {
+ "file" : "lib/Mail/MtPolicyd/Plugin/ScoreAction.pm",
+ "version" : "2.02"
+ },
+ "Mail::MtPolicyd::Plugin::SetField" : {
+ "file" : "lib/Mail/MtPolicyd/Plugin/SetField.pm",
+ "version" : "2.02"
+ },
+ "Mail::MtPolicyd::Plugin::SqlList" : {
+ "file" : "lib/Mail/MtPolicyd/Plugin/SqlList.pm",
+ "version" : "2.02"
+ },
+ "Mail::MtPolicyd::Plugin::SqlUserConfig" : {
+ "file" : "lib/Mail/MtPolicyd/Plugin/SqlUserConfig.pm",
+ "version" : "2.02"
+ },
+ "Mail::MtPolicyd::Plugin::Stress" : {
+ "file" : "lib/Mail/MtPolicyd/Plugin/Stress.pm",
+ "version" : "2.02"
+ },
+ "Mail::MtPolicyd::PluginChain" : {
+ "file" : "lib/Mail/MtPolicyd/PluginChain.pm",
+ "version" : "2.02"
+ },
+ "Mail::MtPolicyd::Profiler" : {
+ "file" : "lib/Mail/MtPolicyd/Profiler.pm",
+ "version" : "2.02"
+ },
+ "Mail::MtPolicyd::Profiler::Timer" : {
+ "file" : "lib/Mail/MtPolicyd/Profiler/Timer.pm",
+ "version" : "2.02"
+ },
+ "Mail::MtPolicyd::Request" : {
+ "file" : "lib/Mail/MtPolicyd/Request.pm",
+ "version" : "2.02"
+ },
+ "Mail::MtPolicyd::Result" : {
+ "file" : "lib/Mail/MtPolicyd/Result.pm",
+ "version" : "2.02"
+ },
+ "Mail::MtPolicyd::Role::Connection" : {
+ "file" : "lib/Mail/MtPolicyd/Role/Connection.pm",
+ "version" : "2.02"
+ },
+ "Mail::MtPolicyd::SessionCache" : {
+ "file" : "lib/Mail/MtPolicyd/SessionCache.pm",
+ "version" : "2.02"
+ },
+ "Mail::MtPolicyd::SessionCache::Base" : {
+ "file" : "lib/Mail/MtPolicyd/SessionCache/Base.pm",
+ "version" : "2.02"
+ },
+ "Mail::MtPolicyd::SessionCache::Memcached" : {
+ "file" : "lib/Mail/MtPolicyd/SessionCache/Memcached.pm",
+ "version" : "2.02"
+ },
+ "Mail::MtPolicyd::SessionCache::None" : {
+ "file" : "lib/Mail/MtPolicyd/SessionCache/None.pm",
+ "version" : "2.02"
+ },
+ "Mail::MtPolicyd::SessionCache::Redis" : {
+ "file" : "lib/Mail/MtPolicyd/SessionCache/Redis.pm",
+ "version" : "2.02"
+ },
+ "Mail::MtPolicyd::VirtualHost" : {
+ "file" : "lib/Mail/MtPolicyd/VirtualHost.pm",
+ "version" : "2.02"
+ }
+ },
"release_status" : "stable",
"resources" : {
"bugtracker" : {
@@ -98,6 +359,6 @@
},
"x_MailingList" : "https://mtpolicyd.org/mailing-list.html"
},
- "version" : "1.23"
+ "version" : "2.02"
}
|
[-]
[+]
|
Changed |
_service:download_files:Mail-MtPolicyd-2.02.tar.gz/META.yml
^
|
@@ -8,15 +8,19 @@
File::ReadBackwards: '0'
File::Temp: '0'
IO::File: '0'
- POSIX: '0'
+ String::Random: '0'
Template: '0'
Test::BDD::Cucumber::Harness::TestBuilder: '0'
Test::BDD::Cucumber::Loader: '0'
+ Test::Deep: '0'
Test::Exception: '0'
Test::Memcached: '0'
Test::Mock::Net::Server::Mail: '0'
Test::MockObject: '0'
Test::More: '0'
+ Test::Net::LDAP::Mock: '0'
+ Test::Pod: '0'
+ Test::RedisDB: '0'
configure_requires:
ExtUtils::MakeMaker: '0'
dynamic_config: 0
@@ -26,6 +30,184 @@
url: http://module-build.sourceforge.net/META-spec-v1.4.html
version: '1.4'
name: Mail-MtPolicyd
+provides:
+ Mail::MtPolicyd:
+ file: lib/Mail/MtPolicyd.pm
+ version: '2.02'
+ Mail::MtPolicyd::AddressList:
+ file: lib/Mail/MtPolicyd/AddressList.pm
+ version: '2.02'
+ Mail::MtPolicyd::Client:
+ file: lib/Mail/MtPolicyd/Client.pm
+ version: '2.02'
+ Mail::MtPolicyd::Client::App:
+ file: lib/Mail/MtPolicyd/Client/App.pm
+ version: '2.02'
+ Mail::MtPolicyd::Client::Request:
+ file: lib/Mail/MtPolicyd/Client/Request.pm
+ version: '2.02'
+ Mail::MtPolicyd::Client::Response:
+ file: lib/Mail/MtPolicyd/Client/Response.pm
+ version: '2.02'
+ Mail::MtPolicyd::Connection:
+ file: lib/Mail/MtPolicyd/Connection.pm
+ version: '2.02'
+ Mail::MtPolicyd::Connection::Ldap:
+ file: lib/Mail/MtPolicyd/Connection/Ldap.pm
+ version: '2.02'
+ Mail::MtPolicyd::Connection::Memcached:
+ file: lib/Mail/MtPolicyd/Connection/Memcached.pm
+ version: '2.02'
+ Mail::MtPolicyd::Connection::Redis:
+ file: lib/Mail/MtPolicyd/Connection/Redis.pm
+ version: '2.02'
+ Mail::MtPolicyd::Connection::Sql:
+ file: lib/Mail/MtPolicyd/Connection/Sql.pm
+ version: '2.02'
+ Mail::MtPolicyd::ConnectionPool:
+ file: lib/Mail/MtPolicyd/ConnectionPool.pm
+ version: '2.02'
+ Mail::MtPolicyd::Plugin:
+ file: lib/Mail/MtPolicyd/Plugin.pm
+ version: '2.02'
+ Mail::MtPolicyd::Plugin::Accounting:
+ file: lib/Mail/MtPolicyd/Plugin/Accounting.pm
+ version: '2.02'
+ Mail::MtPolicyd::Plugin::Action:
+ file: lib/Mail/MtPolicyd/Plugin/Action.pm
+ version: '2.02'
+ Mail::MtPolicyd::Plugin::AddScoreHeader:
+ file: lib/Mail/MtPolicyd/Plugin/AddScoreHeader.pm
+ version: '2.02'
+ Mail::MtPolicyd::Plugin::ClearFields:
+ file: lib/Mail/MtPolicyd/Plugin/ClearFields.pm
+ version: '2.02'
+ Mail::MtPolicyd::Plugin::Condition:
+ file: lib/Mail/MtPolicyd/Plugin/Condition.pm
+ version: '2.02'
+ Mail::MtPolicyd::Plugin::CtIpRep:
+ file: lib/Mail/MtPolicyd/Plugin/CtIpRep.pm
+ version: '2.02'
+ Mail::MtPolicyd::Plugin::DBL:
+ file: lib/Mail/MtPolicyd/Plugin/DBL.pm
+ version: '2.02'
+ Mail::MtPolicyd::Plugin::Eval:
+ file: lib/Mail/MtPolicyd/Plugin/Eval.pm
+ version: '2.02'
+ Mail::MtPolicyd::Plugin::Fail2Ban:
+ file: lib/Mail/MtPolicyd/Plugin/Fail2Ban.pm
+ version: '2.02'
+ Mail::MtPolicyd::Plugin::GeoIPAction:
+ file: lib/Mail/MtPolicyd/Plugin/GeoIPAction.pm
+ version: '2.02'
+ Mail::MtPolicyd::Plugin::GeoIPLookup:
+ file: lib/Mail/MtPolicyd/Plugin/GeoIPLookup.pm
+ version: '2.02'
+ Mail::MtPolicyd::Plugin::Greylist:
+ file: lib/Mail/MtPolicyd/Plugin/Greylist.pm
+ version: '2.02'
+ Mail::MtPolicyd::Plugin::Honeypot:
+ file: lib/Mail/MtPolicyd/Plugin/Honeypot.pm
+ version: '2.02'
+ Mail::MtPolicyd::Plugin::LdapUserConfig:
+ file: lib/Mail/MtPolicyd/Plugin/LdapUserConfig.pm
+ version: '2.02'
+ Mail::MtPolicyd::Plugin::PostfixMap:
+ file: lib/Mail/MtPolicyd/Plugin/PostfixMap.pm
+ version: '2.02'
+ Mail::MtPolicyd::Plugin::Proxy:
+ file: lib/Mail/MtPolicyd/Plugin/Proxy.pm
+ version: '2.02'
+ Mail::MtPolicyd::Plugin::Quota:
+ file: lib/Mail/MtPolicyd/Plugin/Quota.pm
+ version: '2.02'
+ Mail::MtPolicyd::Plugin::RBL:
+ file: lib/Mail/MtPolicyd/Plugin/RBL.pm
+ version: '2.02'
+ Mail::MtPolicyd::Plugin::RBLAction:
+ file: lib/Mail/MtPolicyd/Plugin/RBLAction.pm
+ version: '2.02'
+ Mail::MtPolicyd::Plugin::Result:
+ file: lib/Mail/MtPolicyd/Plugin/Result.pm
+ version: '2.02'
+ Mail::MtPolicyd::Plugin::Role::ConfigurableFields:
+ file: lib/Mail/MtPolicyd/Plugin/Role/ConfigurableFields.pm
+ version: '2.02'
+ Mail::MtPolicyd::Plugin::Role::PluginChain:
+ file: lib/Mail/MtPolicyd/Plugin/Role/PluginChain.pm
+ version: '2.02'
+ Mail::MtPolicyd::Plugin::Role::Scoring:
+ file: lib/Mail/MtPolicyd/Plugin/Role/Scoring.pm
+ version: '2.02'
+ Mail::MtPolicyd::Plugin::Role::SqlUtils:
+ file: lib/Mail/MtPolicyd/Plugin/Role/SqlUtils.pm
+ version: '2.02'
+ Mail::MtPolicyd::Plugin::Role::UserConfig:
+ file: lib/Mail/MtPolicyd/Plugin/Role/UserConfig.pm
+ version: '2.02'
+ Mail::MtPolicyd::Plugin::SMTPVerify:
+ file: lib/Mail/MtPolicyd/Plugin/SMTPVerify.pm
+ version: '2.02'
+ Mail::MtPolicyd::Plugin::SPF:
+ file: lib/Mail/MtPolicyd/Plugin/SPF.pm
+ version: '2.02'
+ Mail::MtPolicyd::Plugin::SaAwlAction:
+ file: lib/Mail/MtPolicyd/Plugin/SaAwlAction.pm
+ version: '2.02'
+ Mail::MtPolicyd::Plugin::SaAwlLookup:
+ file: lib/Mail/MtPolicyd/Plugin/SaAwlLookup.pm
+ version: '2.02'
+ Mail::MtPolicyd::Plugin::ScoreAction:
+ file: lib/Mail/MtPolicyd/Plugin/ScoreAction.pm
+ version: '2.02'
+ Mail::MtPolicyd::Plugin::SetField:
+ file: lib/Mail/MtPolicyd/Plugin/SetField.pm
+ version: '2.02'
+ Mail::MtPolicyd::Plugin::SqlList:
+ file: lib/Mail/MtPolicyd/Plugin/SqlList.pm
+ version: '2.02'
+ Mail::MtPolicyd::Plugin::SqlUserConfig:
+ file: lib/Mail/MtPolicyd/Plugin/SqlUserConfig.pm
+ version: '2.02'
+ Mail::MtPolicyd::Plugin::Stress:
+ file: lib/Mail/MtPolicyd/Plugin/Stress.pm
+ version: '2.02'
+ Mail::MtPolicyd::PluginChain:
+ file: lib/Mail/MtPolicyd/PluginChain.pm
+ version: '2.02'
+ Mail::MtPolicyd::Profiler:
+ file: lib/Mail/MtPolicyd/Profiler.pm
+ version: '2.02'
+ Mail::MtPolicyd::Profiler::Timer:
+ file: lib/Mail/MtPolicyd/Profiler/Timer.pm
+ version: '2.02'
+ Mail::MtPolicyd::Request:
+ file: lib/Mail/MtPolicyd/Request.pm
+ version: '2.02'
+ Mail::MtPolicyd::Result:
+ file: lib/Mail/MtPolicyd/Result.pm
+ version: '2.02'
+ Mail::MtPolicyd::Role::Connection:
+ file: lib/Mail/MtPolicyd/Role/Connection.pm
+ version: '2.02'
+ Mail::MtPolicyd::SessionCache:
+ file: lib/Mail/MtPolicyd/SessionCache.pm
+ version: '2.02'
+ Mail::MtPolicyd::SessionCache::Base:
+ file: lib/Mail/MtPolicyd/SessionCache/Base.pm
+ version: '2.02'
+ Mail::MtPolicyd::SessionCache::Memcached:
+ file: lib/Mail/MtPolicyd/SessionCache/Memcached.pm
+ version: '2.02'
+ Mail::MtPolicyd::SessionCache::None:
+ file: lib/Mail/MtPolicyd/SessionCache/None.pm
+ version: '2.02'
+ Mail::MtPolicyd::SessionCache::Redis:
+ file: lib/Mail/MtPolicyd/SessionCache/Redis.pm
+ version: '2.02'
+ Mail::MtPolicyd::VirtualHost:
+ file: lib/Mail/MtPolicyd/VirtualHost.pm
+ version: '2.02'
requires:
BerkeleyDB: '0'
BerkeleyDB::Hash: '0'
@@ -55,18 +237,18 @@
Net::SMTP::Verify: '0'
Net::Server::PreFork: '0'
NetAddr::IP: '0'
+ Redis: '0'
+ Storable: '0'
Tie::IxHash: '0'
Time::HiRes: '0'
Time::Piece: '0'
Time::Seconds: '0'
- base: '0'
namespace::autoclean: '0'
perl: v5.8.5
strict: '0'
- warnings: '0'
resources:
MailingList: https://mtpolicyd.org/mailing-list.html
bugtracker: http://rt.cpan.org/NoAuth/Bugs.html?Dist=Mail-MtPolicyd
homepage: https://mtpolicyd.org/
repository: https://github.com/benningm/mtpolicyd
-version: '1.23'
+version: '2.02'
|
[-]
[+]
|
Changed |
_service:download_files:Mail-MtPolicyd-2.02.tar.gz/Makefile.PL
^
|
@@ -51,14 +51,14 @@
"Net::SMTP::Verify" => 0,
"Net::Server::PreFork" => 0,
"NetAddr::IP" => 0,
+ "Redis" => 0,
+ "Storable" => 0,
"Tie::IxHash" => 0,
"Time::HiRes" => 0,
"Time::Piece" => 0,
"Time::Seconds" => 0,
- "base" => 0,
"namespace::autoclean" => 0,
- "strict" => 0,
- "warnings" => 0
+ "strict" => 0
},
"TEST_REQUIRES" => {
"DBD::SQLite" => 0,
@@ -66,17 +66,21 @@
"File::ReadBackwards" => 0,
"File::Temp" => 0,
"IO::File" => 0,
- "POSIX" => 0,
+ "String::Random" => 0,
"Template" => 0,
"Test::BDD::Cucumber::Harness::TestBuilder" => 0,
"Test::BDD::Cucumber::Loader" => 0,
+ "Test::Deep" => 0,
"Test::Exception" => 0,
"Test::Memcached" => 0,
"Test::Mock::Net::Server::Mail" => 0,
"Test::MockObject" => 0,
- "Test::More" => 0
+ "Test::More" => 0,
+ "Test::Net::LDAP::Mock" => 0,
+ "Test::Pod" => 0,
+ "Test::RedisDB" => 0
},
- "VERSION" => "1.23",
+ "VERSION" => "2.02",
"test" => {
"TESTS" => "t/*.t"
}
@@ -117,23 +121,27 @@
"Net::SMTP::Verify" => 0,
"Net::Server::PreFork" => 0,
"NetAddr::IP" => 0,
- "POSIX" => 0,
+ "Redis" => 0,
+ "Storable" => 0,
+ "String::Random" => 0,
"Template" => 0,
"Test::BDD::Cucumber::Harness::TestBuilder" => 0,
"Test::BDD::Cucumber::Loader" => 0,
+ "Test::Deep" => 0,
"Test::Exception" => 0,
"Test::Memcached" => 0,
"Test::Mock::Net::Server::Mail" => 0,
"Test::MockObject" => 0,
"Test::More" => 0,
+ "Test::Net::LDAP::Mock" => 0,
+ "Test::Pod" => 0,
+ "Test::RedisDB" => 0,
"Tie::IxHash" => 0,
"Time::HiRes" => 0,
"Time::Piece" => 0,
"Time::Seconds" => 0,
- "base" => 0,
"namespace::autoclean" => 0,
- "strict" => 0,
- "warnings" => 0
+ "strict" => 0
);
|
[-]
[+]
|
Changed |
_service:download_files:Mail-MtPolicyd-2.02.tar.gz/README
^
|
@@ -1,7 +1,7 @@
This archive contains the distribution Mail-MtPolicyd,
-version 1.23:
+version 2.02:
a modular policy daemon for postfix
|
[-]
[+]
|
Changed |
_service:download_files:Mail-MtPolicyd-2.02.tar.gz/bin/mtpolicyd
^
|
@@ -3,7 +3,7 @@
use strict;
use warnings;
-our $VERSION = '1.23'; # VERSION
+our $VERSION = '2.02'; # VERSION
# ABSTRACT: the mtpolicyd executable
# PODNAME: mtpolicyd
@@ -23,7 +23,7 @@
=head1 VERSION
-version 1.23
+version 2.02
=head1 DESCRIPTION
@@ -143,39 +143,6 @@
location of the pid file
-=item ldap_host (default: empty)
-
-Hostname or address of an LDAP server if you want to use LDAP plugins.
-
-=item ldap_port (default: 389)
-
-Port or the LDAP server.
-
-=item ldap_keepalive (default: 1)
-
-Activate keepalive for the LDAP connection.
-
-Set to 0 to disable.
-
-=item ldap_timeout (default: 120)
-
-Timeout for LDAP connection.
-
-=item ldap_binddn (default: empty)
-
-The binddn user if the LDAP server requires authentication.
-
-If the binddn is empty no bind will be performed and the
-connection will be used anonymously.
-
-=item ldap_password
-
-Password of the binddn user.
-
-=item ldap_starttls (default: 1)
-
-Use of TLS encryption for LDAP.
-
=item log_level
Verbosity of logging: 0=>'err', 1=>'warning', 2=>'notice', 3=>'info', 4=>'debug'
@@ -256,55 +223,54 @@
Maximum total time for one request.
-=item db_dsn
-
-Connection string for the database in perl-DBI format. See L<DBI>.
-
- db_dsn="dbi:mysql:mail"
-
-=item db_user
-
-Name of database user.
+=back
-=item db_password
+=head1 CONFIGURE CONNECTIONS
-Password of database user.
+mtpolicyd has a global per process connection pool.
-=item memcached_servers
+Connections could be registered within the connection pool using a <Connection>
+block within the configuration. You must at least specify the name of the connection
+and the module for the connection type.
-A comma separated list of memcached servers used for session tracking.
+ <Connection [name of connection]>
+ module = "[connection type]"
+ # ... addditional parameters
+ </Connection>
- memcached_servers="127.0.0.1:11211"
+Connection modules may require additional parameters.
-=item memcached_namespace (default: mt-)
+Currently supported connection modules:
-Use a namespace for storing sessions in memcached
+=over
-=item memcached_expire (default: 300 seconds)
+=item Sql
-Expire time for memcached entries.
+Perl DBI based connections for SQL databases.
-=item session_lock_wait (default: 50 usec)
+L<Mail::MtPolicyd::Connection::Sql>
-Time to wait before retry to acquire lock on a session object.
+=item Memcached
-Will be increased with every try. (50,100,150,...)
+Connection to a memcached server/cluster.
-=item session_lock_max_retry (default: 50 times)
+L<Mail::MtPolicyd::Connection::Memcached>
-Number of maximum retries for acquiring a session lock.
+=item Ldap
-=item session_lock_timeout (default: 10 seconds)
+Connection to an LDAP directory server.
-After this timeout the lock will destroy itself.
+L<Mail::MtPolicyd::Connection::Ldap>
=back
=head1 SESSION MANAGEMENT
-mtpolicyd uses a session managemend based on memcached.
+mtpolicyd implements session managemend to cache data across
+different checks for requests with the same instance id.
-mtpolicy will generate a session for each mail passed to it and store it within memcached.
+mtpolicy is able to generate a session for each mail passed to it and store it within the
+session cache.
The attached session information will be available to all following plugins across
child processes, virtual hosts and ports.
@@ -312,6 +278,32 @@
for the same mail. Postfix will send a query for each recipient and for each configured
check_policy_service call.
+To enable the SessionCache specify a <SessionCache> block within your configuration:
+
+ <SessionCache>
+ module = "Memcached"
+ expire = "300"
+ lock_wait=50
+ lock_max_retry=50
+ lock_timeout=10
+ </SessionCache>
+
+The example requires that a connection of type "Memcached" and the name
+"memcached" is configured within the connection pool.
+For details read L<Mail::MtPolicyd::SessionCache::Memcached>.
+
+As of version 2.00 it is possible to implement different session caches.
+
+Currently there are 2 session cache modules:
+
+=over
+
+=item L<Mail::MtPolicyd::SessionCache::Memcached>
+
+=item L<Mail::MtPolicyd::SessionCache::Redis>
+
+=back
+
=head1 PROCESSING OF REQUEST
The policy daemon will process all plugins in the order they appear in the configuration file.
@@ -349,16 +341,89 @@
spam_score=5
</Plugin>
-=head1 DATABASE CONFIGURATION
+=head1 UPGRADING
+
+=head2 FROM 1.x to 2.x
+
+With mtpolicyd 2.x configuration of connections and session cache has been changed.
-If you configure a database this database connection will be available to plugins.
-For example the SqlList plugin can be used to implement a black or white list based on
-an SQL query. Or the SqlUserConfig plugin could be used to query a database for additional
-configuration options.
+=head3 Database Connections
+
+In mtpolicyd 2.00 the connections defined globaly in the configuration file
+have been replaced by a dynamic connection pool.
+
+The global options db_* ldap_* and memcached_* have been removed.
+
+Instead connections are registred within a connection pool.
+
+You can define them using <Connection> blocks:
+
+ <Connection myconn>
+ module = "<adapter>"
+ # parameter = "value"
+ # ...
+ </Connection>
+
+In mtpolicyd 1.x:
db_dsn=DBI:mysql:mtpolicyd
- db_user=user
- db_password=password
+ db_user=mtpolicyd
+ db_password=secret
+
+In mtpolicyd 2.x:
+
+ <Connection db>
+ dsn = "DBI:mysql:mtpolicyd"
+ user = "mtpolicyd"
+ password = "secret"
+ </Connection>
+
+All SQL modules will by default use the connection registred as "db".
+
+See modules in Mail::MtPolicyd::Connection::* for available connection adapters.
+
+=head3 Session Cache
+
+Starting with mtpolicyd 2.x it is possible to use other session caches then memcached.
+
+The global session_* parameters have been removed.
+
+Instead the session cache is defined by a <SessionCache> block:
+
+ <SessionCache>
+ module = "<module>"
+ # parameter = "value"
+ # ...
+ </SessionCache>
+
+A memcached session cache in mtpolicyd v1.x:
+
+ memcached_servers="127.0.0.1:11211"
+
+ session_lock_wait=50
+ session_lock_max_retry=50
+ session_lock_timeout=10
+
+In mtpolicyd 2.x:
+
+ <Connection memcached>
+ servers = "127.0.0.1:11211"
+ </Connection>
+
+ <SessionCache>
+ module = "Memcached"
+ # defaults to connection "memcached"
+ # memcached = "memcached"
+ lock_wait = "50"
+ lock_max_retry = "50"
+ lock_timeout = "10"
+ </SessionCache>
+
+If no <SessionCache> is defined it will default to the
+dummy session cache module "None".
+
+See modules in Mail::MtPolicyd::SessionCache::* for available session
+cache modules.
=head1 AUTHOR
|
[-]
[+]
|
Changed |
_service:download_files:Mail-MtPolicyd-2.02.tar.gz/bin/policyd-client
^
|
@@ -3,7 +3,7 @@
use strict;
use warnings;
-our $VERSION = '1.23'; # VERSION
+our $VERSION = '2.02'; # VERSION
# ABSTRACT: commandline client to query a policyd server
# PODNAME: policyd-client
@@ -25,7 +25,7 @@
=head1 VERSION
-version 1.23
+version 2.02
=head1 DESCRIPTION
|
[-]
[+]
|
Added |
_service:download_files:Mail-MtPolicyd-2.02.tar.gz/cpanfile
^
|
@@ -0,0 +1,84 @@
+#!perl
+
+requires 'perl', '5.8.5';
+
+requires 'BerkeleyDB';
+requires 'BerkeleyDB::Hash';
+requires 'Cache::Memcached';
+requires 'Redis';
+requires 'Config::General';
+requires 'DBI';
+requires 'Data::Dumper';
+requires 'Geo::IP';
+requires 'Getopt::Long';
+requires 'HTTP::Request::Common';
+requires 'IO::Handle';
+requires 'IO::Socket::INET';
+requires 'IO::Socket::UNIX';
+requires 'JSON';
+requires 'LWP::UserAgent';
+requires 'Mail::RBL';
+requires 'Mail::SPF';
+requires 'Moose';
+requires 'Moose::Role';
+requires 'Moose::Util::TypeConstraints';
+requires 'MooseX::Getopt';
+requires 'MooseX::Role::Parameterized';
+requires 'MooseX::Singleton';
+requires 'Net::DNS::Resolver';
+requires 'Net::LDAP';
+requires 'Net::LDAP::Util';
+requires 'Net::SMTP::Verify';
+requires 'Net::Server::PreFork';
+requires 'NetAddr::IP';
+requires 'Tie::IxHash';
+requires 'Time::HiRes';
+requires 'Time::Piece';
+requires 'Time::Seconds';
+requires 'namespace::autoclean';
+requires 'strict';
+requires 'Storable';
+
+on 'test' => sub {
+ requires 'DBD::SQLite';
+ requires 'File::Find';
+ requires 'File::ReadBackwards';
+ requires 'File::Temp';
+ requires 'IO::File';
+ requires 'Template';
+ requires 'Test::BDD::Cucumber::Harness::TestBuilder';
+ requires 'Test::BDD::Cucumber::Loader';
+ requires 'Test::Exception';
+ requires 'Test::Memcached';
+ requires 'Test::RedisDB';
+ requires 'Test::Mock::Net::Server::Mail';
+ requires 'Test::Net::LDAP::Mock';
+ requires 'Test::MockObject';
+ requires 'Test::More';
+ requires 'Test::Pod';
+ requires 'String::Random';
+ requires 'Test::Deep';
+};
+
+on 'develop' => sub {
+ requires 'ExtUtils::MakeMaker';
+ requires 'Dist::Zilla::Plugin::MetaProvides::Package';
+ requires 'Dist::Zilla::Plugin::Prereqs::FromCPANfile';
+ requires 'Dist::Zilla::Plugin::ChangelogFromGit';
+ requires 'Dist::Zilla::Plugin::ChangelogFromGit::Debian';
+ requires 'Dist::Zilla::Plugin::FileFinder::ByName';
+ requires 'Dist::Zilla::Plugin::Git::NextVersion';
+ requires 'Dist::Zilla::Plugin::MetaJSON';
+ requires 'Dist::Zilla::Plugin::MetaResources';
+ requires 'Dist::Zilla::Plugin::OurPkgVersion';
+ requires 'Dist::Zilla::Plugin::PodSyntaxTests';
+ requires 'Dist::Zilla::Plugin::PodWeaver';
+ requires 'Dist::Zilla::Plugin::Prereqs';
+ requires 'Dist::Zilla::Plugin::PruneFiles';
+ requires 'Dist::Zilla::Plugin::Template::Tiny';
+ requires 'Dist::Zilla::Plugin::Test::Perl::Critic';
+ requires 'Dist::Zilla::Plugin::TravisYML';
+ requires 'Dist::Zilla::PluginBundle::Basic';
+ requires 'Dist::Zilla::PluginBundle::Git';
+};
+
|
[-]
[+]
|
Changed |
_service:download_files:Mail-MtPolicyd-2.02.tar.gz/dist.ini
^
|
@@ -7,12 +7,6 @@
[Git::NextVersion]
first_version = 1.11
-[Prereqs]
-perl = v5.8.5
-
-[Prereqs / TestRequires]
-DBD::SQLite = 0 ; used database type in tests
-
[MetaJSON]
[MetaResources]
bugtracker.web = http://rt.cpan.org/NoAuth/Bugs.html?Dist=Mail-MtPolicyd
@@ -22,10 +16,11 @@
repository.type = git
homepage = https://mtpolicyd.org/
x_MailingList = https://mtpolicyd.org/mailing-list.html
+[MetaProvides::Package]
[@Basic]
[PodSyntaxTests]
-[AutoPrereqs]
+[Prereqs::FromCPANfile]
[OurPkgVersion]
[Test::Perl::Critic]
[PodWeaver]
@@ -48,16 +43,9 @@
finder = rpm
prune = 1
-[ChangelogFromGit::Debian]
-max_age = 365
-file_name = debian/changelog
-wrap_column = 72
-dist_name = jessie
-package_name = mtpolicyd
-maintainer_name = Markus Benning
-maintainer_email = ich@markusbenning.de
-
[PruneFiles]
match = ^mtpolicyd_
match = ^README.pod$
+match = ^local/
+match = ^cpanfile\.snapshot$
|
[-]
[+]
|
Added |
_service:download_files:Mail-MtPolicyd-2.02.tar.gz/docker-compose.yml
^
|
@@ -0,0 +1,13 @@
+version: '2'
+services:
+ mtpolicyd:
+ build: .
+ # image: benningm/mtpolicyd:latest
+ ports:
+ - "12345:12345"
+ # volumes:
+ # - .:/mtpolicyd
+ links:
+ - memcached
+ memcached:
+ image: memcached
|
[-]
[+]
|
Added |
_service:download_files:Mail-MtPolicyd-2.02.tar.gz/etc/docker.conf
^
|
@@ -0,0 +1,224 @@
+# -*- apache -*-
+#
+# Configuration for the mailteam policy daemon
+
+user=mtpolicyd
+group=mtpolicyd
+#pid_file="/var/run/mtpolicyd/mtpolicyd.pid"
+
+#chroot=/var/run/mtpolicyd
+
+# 0=>'err', 1=>'warning', 2=>'notice', 3=>'info', 4=>'debug' (default: 2)
+log_level=2
+
+host=127.0.0.1
+port="127.0.0.1:12345"
+
+min_servers=4
+min_spare_servers=4
+max_spare_servers=12
+max_servers=50
+max_requests=1000
+
+#keepalive_timeout=60
+keepalive_timeout=0
+# should be the same value as smtpd_policy_service_reuse_count_limit (postfix >2.12)
+max_keepalive=0
+#max_keepalive=100
+
+# timeout for processing of one request in seconds
+request_timeout=20
+
+#<Connection ldap>
+# module = "Ldap"
+# host = "localhost"
+#</Connection>
+
+<Connection memcached>
+ module = "Memcached"
+ servers = "memcached:11211"
+ # namespace = "mt-"
+</Connection>
+
+<Connection db>
+ module = "Sql"
+ dsn = "dbi:SQLite:dbname=/tmp/mtpolicyd.sqlite"
+</Connection>
+
+<SessionCache>
+ module = "Memcached"
+ #memcached = "memcached"
+ # expire session cache entries
+ expire = "300"
+ # wait timeout will be increased each time 50,100,150,... (usec)
+ lock_wait=50
+ # abort after n retries
+ lock_max_retry=50
+ # session lock times out after (sec)
+ lock_timeout=10
+</SessionCache>
+
+<VirtualHost 12345>
+ name="reputation"
+
+ # we only check for a ticket here
+ # avoid running thru all checks for early retries
+ <Plugin greylist>
+ module = "Greylist"
+ score = -5
+ mode = "passive"
+ create_ticket = 0
+ query_autowl = 0
+ </Plugin>
+
+ <Plugin spf>
+ module = "SPF"
+ pass_mode = "passive"
+ pass_score = -10
+ fail_mode = "reject" # stop
+ #fail_score = 5
+ </Plugin>
+
+ # you may want to use some unused recipient addresses as honeypot
+ # make sure they are really unused
+ #<Plugin honeypot>
+ # module = "Honeypot"
+ # recipients_re = "^(chung|ogc|wore|aio|duy)@(yourdomain1|yourdomain2)\.de$"
+ #</Plugin>
+
+ <Plugin dnswl.org>
+ module = "RBL"
+ mode = "accept" # will stop here
+ domain="list.dnswl.org"
+ </Plugin>
+
+ <Plugin geoip>
+ module = "GeoIPLookup"
+ # apt-get install geoip-database
+ database = "/usr/share/GeoIP/GeoIP.dat"
+ </Plugin>
+ <Plugin geoip-good>
+ module = "GeoIPAction"
+ result_from = "geoip"
+ country_codes = "DE,AT,CH,FR,IT"
+ mode = passive
+ score = -1
+ </Plugin>
+ <Plugin geoip-bad>
+ module = "GeoIPAction"
+ result_from = "geoip"
+ country_codes = "RU,UA,CN,IN"
+ mode = passive
+ score = 5
+ </Plugin>
+
+ <Plugin spamhaus-rbl>
+ module = "RBL"
+ mode = "passive"
+ domain="zen.spamhaus.org"
+ </Plugin>
+ <Plugin spamhaus-rbl-sbl>
+ module = "RBLAction"
+ result_from = "spamhaus-rbl"
+ mode = "passive"
+ re_match = "^127\.0\.0\.[23]$"
+ score = 5
+ </Plugin>
+ <Plugin spamhaus-rbl-xbl>
+ module = "RBLAction"
+ result_from = "spamhaus-rbl"
+ mode = "passive"
+ re_match = "^127\.0\.0\.[4-7]$"
+ score = 5
+ </Plugin>
+ <Plugin spamhaus-rbl-pbl>
+ module = "RBLAction"
+ result_from = "spamhaus-rbl"
+ mode = "passive"
+ re_match = "^127\.0\.0\.1[01]$"
+ score = 3
+ </Plugin>
+ <Plugin spamhaus-dbl>
+ module = "DBL"
+ domain="dbl.spamhaus.org"
+
+ helo_name_mode=passive
+ helo_name_score=1
+ sender_mode=passive
+ sender_score=5
+ reverse_client_name_mode=passive
+ reverse_client_name_score=2.5
+ </Plugin>
+ <Plugin sorbs.net>
+ module = "RBL"
+ mode = "passive"
+ domain="dnsbl.sorbs.net"
+ score = 5
+ </Plugin>
+ <Plugin manitu.net>
+ module = "RBL"
+ mode = "passive"
+ domain="ix.dnsbl.manitu.net"
+ score = 5
+ </Plugin>
+ <Plugin spamcop>
+ module = "RBL"
+ mode = "passive"
+ domain="bl.spamcop.net"
+ score = 5
+ </Plugin>
+
+ <Plugin abuse.ch>
+ module = "RBL"
+ mode = "passive"
+ domain="drone.abuse.ch"
+ score = 3
+ </Plugin>
+ <Plugin wpbl.info>
+ module = "RBL"
+ mode = "passive"
+ domain="db.wpbl.info"
+ score = 3
+ </Plugin>
+ <Plugin barracudacentral.org>
+ module = "RBL"
+ mode = "passive"
+ domain="bb.barracudacentral.org"
+ score = 3
+ </Plugin>
+
+# # block ip address with iptables filter
+# <Plugin ScoreBan>
+# module = "ScoreAction"
+# threshold = 15
+# <Plugin ban-ip>
+# module = "Fail2Ban"
+# socket = "/var/run/fail2ban/fail2ban.sock"
+# jail = "postfix"
+# </Plugin>
+# </Plugin>
+ # score >= 15 will be rejected
+ <Plugin ScoreReject>
+ module = "ScoreAction"
+ threshold = 15
+ action = "reject sender ip %IP% is blocked (score=%SCORE%%SCORE_DETAIL%)"
+ </Plugin>
+ # score >= 5 gets greylisting applied
+ <Plugin ScoreGreylist>
+ module = "ScoreAction"
+ threshold = 5
+ <Plugin greylist>
+ module = "Greylist"
+ score = -5
+ mode = "passive"
+ # activating the autowl will require a SQL database
+ use_autowl = 1
+ </Plugin>
+ </Plugin>
+ # add an header to everything left
+ <Plugin ScoreTag>
+ module = "AddScoreHeader"
+ spam_score=5
+ </Plugin>
+</VirtualHost>
+
|
[-]
[+]
|
Changed |
_service:download_files:Mail-MtPolicyd-2.02.tar.gz/etc/mtpolicyd.conf
^
|
@@ -4,7 +4,7 @@
user=mtpolicyd
group=mtpolicyd
-pid_file="/var/run/mtpolicyd/mtpolicyd.pid"
+#pid_file="/var/run/mtpolicyd/mtpolicyd.pid"
#chroot=/var/run/mtpolicyd
@@ -29,22 +29,34 @@
# timeout for processing of one request in seconds
request_timeout=20
-# database connection as perl-DBI DSN (man DBI)
-db_dsn=dbi:SQLite:dbname=/var/lib/mtpolicyd/mtpolicyd.sqlite
-db_user=
-db_password=
-
-# memcached connection for session caching
-memcached_servers="127.0.0.1:11211"
-# memcached_namespace=mt-
-# memcached_expire=300
-
-# wait timeout will be increased each time 50,100,150,... (usec)
-session_lock_wait=50
-# abort after n retries
-session_lock_max_retry=50
-# session lock times out after (sec)
-session_lock_timeout=10
+#<Connection ldap>
+# module = "Ldap"
+# host = "localhost"
+#</Connection>
+
+<Connection memcached>
+ module = "Memcached"
+ servers = "127.0.0.1:11211"
+ # namespace = "mt-"
+</Connection>
+
+<Connection db>
+ module = "Sql"
+ dsn = "dbi:SQLite:dbname=/var/lib/mtpolicyd/mtpolicyd.sqlite"
+</Connection>
+
+<SessionCache>
+ module = "Memcached"
+ #memcached = "memcached"
+ # expire session cache entries
+ expire = "300"
+ # wait timeout will be increased each time 50,100,150,... (usec)
+ lock_wait=50
+ # abort after n retries
+ lock_max_retry=50
+ # session lock times out after (sec)
+ lock_timeout=10
+</SessionCache>
<VirtualHost 12345>
name="reputation"
@@ -61,7 +73,7 @@
<Plugin spf>
module = "SPF"
- pass_more = "passive"
+ pass_mode = "passive"
pass_score = -10
fail_mode = "reject" # stop
#fail_score = 5
@@ -200,7 +212,7 @@
score = -5
mode = "passive"
# activating the autowl will require a SQL database
- use_autowl = 0
+ use_autowl = 1
</Plugin>
</Plugin>
# add an header to everything left
|
[-]
[+]
|
Changed |
_service:download_files:Mail-MtPolicyd-2.02.tar.gz/lib/Mail/MtPolicyd.pm
^
|
@@ -1,19 +1,19 @@
package Mail::MtPolicyd;
use strict;
+use warnings;
use base qw(Net::Server::PreFork);
-our $VERSION = '1.23'; # VERSION
+our $VERSION = '2.02'; # VERSION
# ABSTRACT: a modular policy daemon for postfix
use Data::Dumper;
use Mail::MtPolicyd::Profiler;
use Mail::MtPolicyd::Request;
use Mail::MtPolicyd::VirtualHost;
-use Mail::MtPolicyd::SqlConnection;
-use Mail::MtPolicyd::LdapConnection;
+use Mail::MtPolicyd::ConnectionPool;
+use Mail::MtPolicyd::SessionCache;
use DBI;
-use Cache::Memcached;
use Time::HiRes qw( usleep tv_interval gettimeofday );
use Getopt::Long;
use Tie::IxHash;
@@ -136,27 +136,6 @@
$self->{'vhost_by_policy_context'} = 0;
- $self->{'db_dsn'} = undef;
- $self->{'db_user'} = '';
- $self->{'db_password'} = '';
-
- $self->{'ldap_host'} = undef,
- $self->{'ldap_port'} = 389,
- $self->{'ldap_keepalive'} = 1,
- $self->{'ldap_timeout'} = 120,
- $self->{'ldap_binddn'} = undef,
- $self->{'ldap_password'} = undef,
- $self->{'ldap_starttls'} = 1,
-
- $self->{'memcached_servers'} = [ '127.0.0.1:11211' ];
- $self->{'memcached_namespace'} = 'mt-';
- $self->{'memcached_expire'} = 5 * 60;
-
- # will be incremented in linear steps 50, 100, 150...
- $self->{'session_lock_wait'} = 50; # usec
- $self->{'session_lock_max_retry'} = 50; # times
- $self->{'session_lock_timeout'} = 10; # sec
-
$self->{'program_name'} = $0;
# APPLY values from configuration file
@@ -180,35 +159,16 @@
$self->_apply_values_from_config($self, $config,
'request_timeout', 'keepalive_timeout', 'max_keepalive',
- 'vhost_by_policy_context', 'db_dsn', 'db_user', 'db_password',
- 'memcached_namespace', 'memcached_expire',
- 'session_lock_wait', 'session_lock_max_retry', 'session_lock_timeout',
+ 'vhost_by_policy_context',
'program_name',
- 'ldap_host', 'ldap_port', 'ldap_keepalive', 'ldap_timeout', 'ldap_binddn',
- 'ldap_password', 'ldap_starttls',
);
- $self->_apply_array_from_config($self, $config, 'memcached_servers');
-
- # Initialize DB connection before load vhosts
- if( defined $self->{'db_dsn'} && $self->{'db_dsn'} !~ /^\s*$/ ) {
- Mail::MtPolicyd::SqlConnection->initialize(
- dsn => $self->{'db_dsn'},
- user => $self->{'db_user'},
- password => $self->{'db_password'},
- );
- }
- if( defined $self->{'ldap_host'} && $self->{'ldap_host'} !~ /^\s*$/ ) {
- Mail::MtPolicyd::LdapConnection->initialize(
- host => $self->{'ldap_host'},
- port => $self->{'ldap_port'},
- keepalive => $self->{'ldap_keepalive'},
- timeout => $self->{'ldap_timeout'},
- binddn => $self->{'ldap_binddn'},
- password => $self->{'ldap_password'},
- starttls => $self->{'ldap_starttls'},
- );
+ # initialize connection pool
+ Mail::MtPolicyd::ConnectionPool->initialize;
+ if( defined $config->{'Connection'} ) {
+ Mail::MtPolicyd::ConnectionPool->load_config( $config->{'Connection'} );
}
+ $self->{'session_cache_config'} = $config->{'SessionCache'};
# LOAD VirtualHosts
if( ! defined $config->{'VirtualHost'} ) {
@@ -272,25 +232,17 @@
$self->_set_process_stat('virgin child');
- # close parent database connection
- if( Mail::MtPolicyd::SqlConnection->is_initialized ) {
- eval { Mail::MtPolicyd::SqlConnection->reconnect; };
- if($@) {
- $self->log(0, 'failed to enstablish sql connection: '.$@);
- }
- }
- if( Mail::MtPolicyd::LdapConnection->is_initialized ) {
- eval { Mail::MtPolicyd::LdapConnection->reconnect; };
- if($@) {
- $self->log(0, 'failed to enstablish ldap connection: '.$@);
- }
- }
+ # recreate connection in child process
+ Mail::MtPolicyd::ConnectionPool->reconnect;
- $self->{'memcached'} = Cache::Memcached->new( {
- 'servers' => $self->{'memcached_servers'},
- 'debug' => 0,
- 'namespace' => $self->{'memcached_namespace'},
- } );
+ # initialize session cache
+ $self->{'session_cache'} = Mail::MtPolicyd::SessionCache->new(
+ server => $self,
+ );
+ if( defined $self->{'session_cache_config'} &&
+ ref($self->{'session_cache_config'}) eq 'HASH') {
+ $self->{'session_cache'}->load_config( $self->{'session_cache_config'} );
+ }
return;
}
@@ -299,79 +251,10 @@
my $self = shift;
$self->_set_process_stat('finish');
- if( Mail::MtPolicyd::SqlConnection->is_initialized ) {
- eval { Mail::MtPolicyd::SqlConnection->instance->disconnect };
- }
- if( Mail::MtPolicyd::LdapConnection->is_initialized ) {
- eval { Mail::MtPolicyd::LdapConnection->instance->disconnect };
- }
-
- return;
-}
-
-sub memcached {
- my $self = shift;
- if( ! defined $self->{'memcached'} ) {
- die('no memcached connection available!');
- }
- return( $self->{'memcached'} );
-}
-
-sub acquire_session_lock {
- my ( $self, $instance ) = @_;
- my $lock = 'lock_'.$instance;
- my $wait = $self->{'session_lock_wait'};
- my $max_retry = $self->{'session_lock_max_retry'};
- my $lock_ttl = $self->{'session_lock_timeout'};
-
- for( my $try = 1 ; $try < $max_retry ; $try++ ) {
- if( $self->{'memcached'}->add($lock, 1, $lock_ttl) ) {
- return; # lock created
- }
- usleep( $wait * $try );
- }
-
- die('could not acquire lock for session '.$instance);
- return;
-}
-
-sub release_session_lock {
- my ( $self, $instance ) = @_;
- my $lock = 'lock_'.$instance;
-
- $self->{'memcached'}->delete($lock);
-
- return;
-}
-
-sub retrieve_session {
- my ($self, $instance ) = @_;
-
- if( ! defined $instance ) {
- return;
- }
-
- $self->acquire_session_lock( $instance );
-
- if( my $session = $self->{'memcached'}->get($instance) ) {
- return($session);
- }
-
- return( { '_instance' => $instance } );
-}
-
-sub store_session {
- my ($self, $session ) = @_;
- my $instance = $session->{'_instance'};
- my $expire = defined $self->{'memcached_expire'} ? $self->{'memcached_expire'} : 300;
-
- if( ! defined $session || ! defined $instance ) {
- return;
- }
-
- $self->{'memcached'}->set($instance, $session, $expire);
-
- $self->release_session_lock($instance);
+ Mail::MtPolicyd::ConnectionPool->shutdown;
+ if( defined $self->{'session_cache'} ) {
+ $self->{'session_cache'}->shutdown;
+ }
return;
}
@@ -416,14 +299,6 @@
return($vhost);
}
-sub get_dbh {
- my $self = shift;
- if( ! Mail::MtPolicyd::SqlConnection->is_initialized ) {
- die('no database connection available (no configured?)');
- }
- return( Mail::MtPolicyd::SqlConnection->instance->dbh );
-}
-
sub _is_loglevel {
my ( $self, $level ) = @_;
if( $self->{'server'}->{'log_level'} &&
@@ -471,7 +346,7 @@
my $instance = $r->attr('instance');
Mail::MtPolicyd::Profiler->tick('retrieve session');
- $s = $self->retrieve_session($instance);
+ $s = $self->{'session_cache'}->retrieve_session($instance);
if( $self->_is_loglevel(4) ) { $self->log(4, 'session: '.Dumper($s)); }
$r->session($s);
@@ -490,7 +365,7 @@
if ( $@ ) { $error = $@; }
if( defined $s ) {
- $self->store_session($s);
+ $self->{'session_cache'}->store_session($s);
}
if( defined $error ) { die( $error ); }
@@ -559,6 +434,14 @@
$0 = $self->{'program_name'}.' ('.$stat.')'
};
+sub memcached {
+ die('the global memcached connection does no longer exist in mtpolicyd >= 2.00');
+}
+
+sub get_dbh {
+ die('the global dbh handle is no longer available in mtpolicyd >= 2.00');
+}
+
1;
__END__
@@ -573,7 +456,7 @@
=head1 VERSION
-version 1.23
+version 2.02
=head1 DESCRIPTION
|
[-]
[+]
|
Changed |
_service:download_files:Mail-MtPolicyd-2.02.tar.gz/lib/Mail/MtPolicyd/AddressList.pm
^
|
@@ -3,7 +3,7 @@
use Moose;
use namespace::autoclean;
-our $VERSION = '1.23'; # VERSION
+our $VERSION = '2.02'; # VERSION
# ABSTRACT: a class for IP address lists
use NetAddr::IP;
@@ -90,7 +90,7 @@
=head1 VERSION
-version 1.23
+version 2.02
=head1 Attributes
|
[-]
[+]
|
Changed |
_service:download_files:Mail-MtPolicyd-2.02.tar.gz/lib/Mail/MtPolicyd/Client.pm
^
|
@@ -2,7 +2,7 @@
use Moose;
-our $VERSION = '1.23'; # VERSION
+our $VERSION = '2.02'; # VERSION
# ABSTRACT: a policyd client class
@@ -85,7 +85,7 @@
=head1 VERSION
-version 1.23
+version 2.02
=head1 DESCRIPTION
|
[-]
[+]
|
Changed |
_service:download_files:Mail-MtPolicyd-2.02.tar.gz/lib/Mail/MtPolicyd/Client/App.pm
^
|
@@ -2,7 +2,7 @@
use Moose;
-our $VERSION = '1.23'; # VERSION
+our $VERSION = '2.02'; # VERSION
# ABSTRACT: application interface class for Mail::MtPolicyd::Client
@@ -80,7 +80,7 @@
=head1 VERSION
-version 1.23
+version 2.02
=head1 SYNOPSIS
|
[-]
[+]
|
Changed |
_service:download_files:Mail-MtPolicyd-2.02.tar.gz/lib/Mail/MtPolicyd/Client/Request.pm
^
|
@@ -2,7 +2,7 @@
use Moose;
-our $VERSION = '1.23'; # VERSION
+our $VERSION = '2.02'; # VERSION
# ABSTRACT: a postfix policyd client request class
@@ -80,7 +80,7 @@
=head1 VERSION
-version 1.23
+version 2.02
=head1 DESCRIPTION
|
[-]
[+]
|
Changed |
_service:download_files:Mail-MtPolicyd-2.02.tar.gz/lib/Mail/MtPolicyd/Client/Response.pm
^
|
@@ -2,7 +2,7 @@
use Moose;
-our $VERSION = '1.23'; # VERSION
+our $VERSION = '2.02'; # VERSION
# ABSTRACT: a postfix policyd client response class
@@ -62,7 +62,7 @@
=head1 VERSION
-version 1.23
+version 2.02
=head1 DESCRIPTION
|
[-]
[+]
|
Added |
_service:download_files:Mail-MtPolicyd-2.02.tar.gz/lib/Mail/MtPolicyd/Connection
^
|
+(directory)
|
[-]
[+]
|
Added |
_service:download_files:Mail-MtPolicyd-2.02.tar.gz/lib/Mail/MtPolicyd/Connection.pm
^
|
@@ -0,0 +1,53 @@
+package Mail::MtPolicyd::Connection;
+
+use Moose;
+
+our $VERSION = '2.02'; # VERSION
+# ABSTRACT: base class for mtpolicyd connection modules
+
+has 'name' => ( is => 'ro', isa => 'Str', required => 1 );
+
+sub init {
+ my $self = shift;
+ return;
+}
+
+sub reconnect {
+ my $self = shift;
+ return;
+}
+
+sub shutdown {
+ my $self = shift;
+ return;
+}
+
+1;
+
+__END__
+
+=pod
+
+=encoding UTF-8
+
+=head1 NAME
+
+Mail::MtPolicyd::Connection - base class for mtpolicyd connection modules
+
+=head1 VERSION
+
+version 2.02
+
+=head1 AUTHOR
+
+Markus Benning <ich@markusbenning.de>
+
+=head1 COPYRIGHT AND LICENSE
+
+This software is Copyright (c) 2014 by Markus Benning <ich@markusbenning.de>.
+
+This is free software, licensed under:
+
+ The GNU General Public License, Version 2, June 1991
+
+=cut
|
[-]
[+]
|
Added |
_service:download_files:Mail-MtPolicyd-2.02.tar.gz/lib/Mail/MtPolicyd/Connection/Ldap.pm
^
|
@@ -0,0 +1,146 @@
+package Mail::MtPolicyd::Connection::Ldap;
+
+use Moose;
+
+extends 'Mail::MtPolicyd::Connection';
+
+# ABSTRACT: a LDAP connection plugin for mtpolicyd
+our $VERSION = '2.02'; # VERSION
+
+use Net::LDAP;
+
+
+has 'host' => ( is => 'ro', isa => 'Str', default => 'localhost' );
+has 'port' => ( is => 'ro', isa => 'Int', default => 389 );
+
+has 'keepalive' => ( is => 'ro', isa => 'Bool', default => 1 );
+has 'timeout' => ( is => 'ro', isa => 'Int', default => 120 );
+
+has 'binddn' => ( is => 'ro', isa => 'Maybe[Str]' );
+has 'password' => ( is => 'ro', isa => 'Maybe[Str]' );
+
+has 'starttls' => ( is => 'ro', isa => 'Bool', default => 1 );
+
+has 'handle' => ( is => 'rw', isa => 'Net::LDAP', lazy => 1,
+ default => sub {
+ my $self = shift;
+ return $self->_connect_ldap;
+ },
+ handles => {
+ 'disconnect' => 'unbind',
+ },
+);
+
+has 'connection_class' => ( is => 'ro', isa => 'Maybe[Str]' );
+
+sub _connect_ldap {
+ my $self = shift;
+ my $ldap_class = 'Net::LDAP';
+
+ if( defined $self->connection_class ) {
+ $ldap_class = $self->connection_class;
+ eval "require $ldap_class;"; ## no critic
+ }
+
+ my $ldap = $ldap_class->new(
+ $self->host,
+ port => $self->port,
+ keepalive => $self->keepalive,
+ timeout => $self->timeout,
+ onerror => 'die',
+ ) or die ('cant connect ldap: '.$@);
+
+ if( $self->starttls ) {
+ eval{ $ldap->start_tls( verify => 'require' ); };
+ if( $@ ) { die('starttls on ldap connection failed: '.$@); }
+ }
+
+ if( defined $self->binddn ) {
+ $ldap->bind( $self->binddn, password => $self->password );
+ } else {
+ $ldap->bind; # anonymous bind
+ }
+
+ return $ldap;
+}
+
+sub reconnect {
+ my $self = shift;
+ $self->handle( $self->_connect_ldap );
+ return;
+}
+
+sub shutdown {
+ my $self = shift;
+ $self->handle->unbind;
+ return;
+}
+
+1;
+
+__END__
+
+=pod
+
+=encoding UTF-8
+
+=head1 NAME
+
+Mail::MtPolicyd::Connection::Ldap - a LDAP connection plugin for mtpolicyd
+
+=head1 VERSION
+
+version 2.02
+
+=head1 SYNOPSIS
+
+ <Connection ldap>
+ module = "Ldap"
+ host = "localhost"
+ </Connection>
+
+=head1 PARAMETERS
+
+=over
+
+=item host (default: 'localhost')
+
+LDAP server to connect to.
+
+=item port (default: 389)
+
+LDAP servers port number to connect to.
+
+=item keepalive (default: 1)
+
+Enable connection keepalive for this connection.
+
+=item timeout (default: 120)
+
+Timeout in seconds for operations on this connection.
+
+=item binddn (default: undef)
+
+If set a bind with this binddn is done when connecting.
+
+=item password (default: undef)
+
+=item starttls (default: 1)
+
+Enable or disabled the use of starttls. (TLS/SSL encryption)
+
+=back
+
+=head1 AUTHOR
+
+Markus Benning <ich@markusbenning.de>
+
+=head1 COPYRIGHT AND LICENSE
+
+This software is Copyright (c) 2014 by Markus Benning <ich@markusbenning.de>.
+
+This is free software, licensed under:
+
+ The GNU General Public License, Version 2, June 1991
+
+=cut
|
[-]
[+]
|
Added |
_service:download_files:Mail-MtPolicyd-2.02.tar.gz/lib/Mail/MtPolicyd/Connection/Memcached.pm
^
|
@@ -0,0 +1,108 @@
+package Mail::MtPolicyd::Connection::Memcached;
+
+use Moose;
+
+our $VERSION = '2.02'; # VERSION
+# ABSTRACT: a memcached connection plugin for mtpolicyd
+
+extends 'Mail::MtPolicyd::Connection';
+
+
+use Cache::Memcached;
+
+has 'servers' => ( is => 'ro', isa => 'Str', default => '127.0.0.1:11211' );
+has '_servers' => (
+ is => 'ro', isa => 'ArrayRef[Str]', lazy => 1,
+ default => sub {
+ my $self = shift;
+ return [ split(/\s*,\s*/, $self->servers) ];
+ },
+);
+
+has 'debug' => ( is => 'ro', isa => 'Bool', default => 0 );
+has 'namespace' => ( is => 'ro', isa => 'Str', default => '');
+
+sub _create_handle {
+ my $self = shift;
+ return Cache::Memcached->new( {
+ 'servers' => $self->_servers,
+ 'debug' => $self->debug,
+ 'namespace' => $self->namespace,
+ } );
+}
+
+has 'handle' => (
+ is => 'rw', isa => 'Cache::Memcached', lazy => 1,
+ default => sub {
+ my $self = shift;
+ $self->_create_handle
+ },
+);
+
+sub reconnect {
+ my $self = shift;
+ $self->handle( $self->_create_handle );
+ return;
+}
+
+sub shutdown {
+ my $self = shift;
+ $self->handle->disconnect_all;
+ return;
+}
+
+1;
+
+__END__
+
+=pod
+
+=encoding UTF-8
+
+=head1 NAME
+
+Mail::MtPolicyd::Connection::Memcached - a memcached connection plugin for mtpolicyd
+
+=head1 VERSION
+
+version 2.02
+
+=head1 SYNOPSIS
+
+ <Connection memcached>
+ module = "Memcached"
+ servers = "127.0.0.1:11211"
+ # namespace = "mt-"
+ </Connection>
+
+=head1 PARAMETERS
+
+=over
+
+=item servers (default: 127.0.0.1:11211)
+
+Comma seperated list for memcached servers to connect.
+
+=item debug (default: 0)
+
+Enable to debug memcached connection.
+
+=item namespace (default: '')
+
+Set a prefix used for all keys of this connection.
+
+=back
+
+=head1 AUTHOR
+
+Markus Benning <ich@markusbenning.de>
+
+=head1 COPYRIGHT AND LICENSE
+
+This software is Copyright (c) 2014 by Markus Benning <ich@markusbenning.de>.
+
+This is free software, licensed under:
+
+ The GNU General Public License, Version 2, June 1991
+
+=cut
|
[-]
[+]
|
Added |
_service:download_files:Mail-MtPolicyd-2.02.tar.gz/lib/Mail/MtPolicyd/Connection/Redis.pm
^
|
@@ -0,0 +1,108 @@
+package Mail::MtPolicyd::Connection::Redis;
+
+use Moose;
+
+our $VERSION = '2.02'; # VERSION
+# ABSTRACT: a mtpolicy connection for redis databases
+
+extends 'Mail::MtPolicyd::Connection';
+
+use Redis;
+
+
+has 'server' => ( is => 'ro', isa => 'Str', default => '127.0.0.1:6379' );
+has 'debug' => ( is => 'ro', isa => 'Bool', default => 0 );
+has 'password' => ( is => 'ro', isa => 'Maybe[Str]' );
+has 'db' => ( is => 'ro', isa => 'Int', default => 0 );
+
+sub _create_handle {
+ my $self = shift;
+ my $redis = Redis->new(
+ 'server' => $self->server,
+ 'debug' => $self->debug,
+ defined $self->password ? ( 'password' => $self->password ) : (),
+ );
+ $redis->select( $self->db );
+ return $redis;
+}
+
+has 'handle' => (
+ is => 'rw', isa => 'Redis', lazy => 1,
+ default => sub {
+ my $self = shift;
+ return $self->_create_handle;
+ },
+);
+
+sub reconnect {
+ my $self = shift;
+ $self->handle( $self->_create_handle );
+ return;
+}
+
+sub shutdown {
+ my $self = shift;
+ $self->handle->wait_all_responses;
+ $self->handle->quit;
+ return;
+}
+
+1;
+
+__END__
+
+=pod
+
+=encoding UTF-8
+
+=head1 NAME
+
+Mail::MtPolicyd::Connection::Redis - a mtpolicy connection for redis databases
+
+=head1 VERSION
+
+version 2.02
+
+=head1 SYNOPSIS
+
+ <Connection redis>
+ server = "127.0.0.1:6379"
+ db = 0
+ # password = "secret"
+ </Connection>
+
+=head1 PARAMETERS
+
+=over
+
+=item server (default: 127.0.0.1:6379)
+
+The redis server to connect.
+
+=item debug (default: 0)
+
+Set to 1 to enable debugging of redis connection.
+
+=item password (default: undef)
+
+Set password if required for redis connection.
+
+=item db (default: 0)
+
+Select a redis database to use.
+
+=back
+
+=head1 AUTHOR
+
+Markus Benning <ich@markusbenning.de>
+
+=head1 COPYRIGHT AND LICENSE
+
+This software is Copyright (c) 2014 by Markus Benning <ich@markusbenning.de>.
+
+This is free software, licensed under:
+
+ The GNU General Public License, Version 2, June 1991
+
+=cut
|
[-]
[+]
|
Added |
_service:download_files:Mail-MtPolicyd-2.02.tar.gz/lib/Mail/MtPolicyd/Connection/Sql.pm
^
|
@@ -0,0 +1,110 @@
+package Mail::MtPolicyd::Connection::Sql;
+
+use Moose;
+
+extends 'Mail::MtPolicyd::Connection';
+
+# ABSTRACT: Connection pool sql connection object
+our $VERSION = '2.02'; # VERSION
+
+
+use DBI;
+
+has 'dsn' => ( is => 'ro', isa => 'Str', required => 1 );
+has 'user' => ( is => 'ro', isa => 'Str', default => '' );
+has 'password' => ( is => 'ro', isa => 'Str', default => '' );
+
+has 'handle' => ( is => 'rw', isa => 'DBI::db', lazy => 1,
+ default => sub {
+ my $self = shift;
+ return $self->_create_handle;
+ },
+ handles => [ 'disconnect' ],
+);
+
+sub _create_handle {
+ my $self = shift;
+ my $handle = DBI->connect(
+ $self->dsn,
+ $self->user,
+ $self->password,
+ {
+ RaiseError => 1,
+ PrintError => 0,
+ AutoCommit => 1,
+ mysql_auto_reconnect => 1,
+ },
+ );
+ return $handle;
+}
+
+sub reconnect {
+ my $self = shift;
+ $self->handle( $self->_create_handle );
+}
+
+1;
+
+__END__
+
+=pod
+
+=encoding UTF-8
+
+=head1 NAME
+
+Mail::MtPolicyd::Connection::Sql - Connection pool sql connection object
+
+=head1 VERSION
+
+version 2.02
+
+=head1 SYNOPSIS
+
+ <Connection db>
+ module = "Sql"
+ # see perldoc DBI for syntax of dsn connection string
+ dsn = "dbi:SQLite:dbname=/var/lib/mtpolicyd/mtpolicyd.sqlite"
+ # user = "mtpolicyd"
+ # user = "secret"
+ </Connection>
+
+=head1 PARAMETERS
+
+=over
+
+=item dsn (required)
+
+A perl DBI connection string.
+
+Examples:
+
+ dbi:SQLite:dbname=/var/lib/mtpolicyd/mtpolicyd.sqlite
+ dbi:SQLite::memory:
+ DBI:mysql:database=test;host=localhost
+
+see L<DBI>
+
+=item user (default: '')
+
+A username if required for connection.
+
+=item password (default: '')
+
+A password if required for user/connection.
+
+=back
+
+=head1 AUTHOR
+
+Markus Benning <ich@markusbenning.de>
+
+=head1 COPYRIGHT AND LICENSE
+
+This software is Copyright (c) 2014 by Markus Benning <ich@markusbenning.de>.
+
+This is free software, licensed under:
+
+ The GNU General Public License, Version 2, June 1991
+
+=cut
|
[-]
[+]
|
Added |
_service:download_files:Mail-MtPolicyd-2.02.tar.gz/lib/Mail/MtPolicyd/ConnectionPool.pm
^
|
@@ -0,0 +1,118 @@
+package Mail::MtPolicyd::ConnectionPool;
+
+use strict;
+use warnings;
+use MooseX::Singleton;
+
+our $VERSION = '2.02'; # VERSION
+# ABSTRACT: a singleton to hold all configure connections
+
+has 'pool' => (
+ is => 'ro',
+ isa => 'HashRef[Mail::MtPolicyd::Connection]',
+ lazy => 1,
+ default => sub { {} },
+ traits => [ 'Hash' ],
+ handles => {
+ 'get_connection' => 'get',
+ 'add_connection' => 'set',
+ }
+);
+
+sub get_handle {
+ my ( $self, $name ) = @_;
+ if( defined $self->pool->{$name} ) {
+ return $self->pool->{$name}->handle;
+ }
+ return;
+}
+
+has 'plugin_prefix' => ( is => 'ro', isa => 'Str',
+ default => 'Mail::MtPolicyd::Connection::');
+
+sub load_config {
+ my ( $self, $config ) = @_;
+ foreach my $name ( keys %$config ) {
+ $self->load_connection( $name, $config->{$name} );
+ }
+ return;
+}
+
+sub load_connection {
+ my ( $self, $name, $params ) = @_;
+ if( ! defined $params->{'module'} ) {
+ die('no module defined for connection '.$name.'!');
+ }
+ my $module = $params->{'module'};
+ my $class = $self->plugin_prefix.$module;
+ my $conn;
+
+ my $code = "require ".$class.";";
+ eval $code; ## no critic (ProhibitStringyEval)
+ if($@) {
+ die('could not load connection '.$name.': '.$@);
+ }
+
+ eval {
+ $conn = $class->new(
+ name => $name,
+ %$params,
+ );
+ $conn->init();
+ };
+ if($@) {
+ die('could not initialize connection '.$name.': '.$@);
+ }
+ $self->add_connection( $name => $conn );
+ return;
+}
+
+sub shutdown {
+ my $self = shift;
+
+ foreach my $conn ( values %{$self->pool} ) {
+ $conn->shutdown(@_); # cascade
+ }
+
+ return;
+}
+
+sub reconnect {
+ my $self = shift;
+
+ foreach my $conn ( values %{$self->pool} ) {
+ $conn->reconnect(@_); # cascade
+ }
+
+ return;
+}
+
+1;
+
+__END__
+
+=pod
+
+=encoding UTF-8
+
+=head1 NAME
+
+Mail::MtPolicyd::ConnectionPool - a singleton to hold all configure connections
+
+=head1 VERSION
+
+version 2.02
+
+=head1 AUTHOR
+
+Markus Benning <ich@markusbenning.de>
+
+=head1 COPYRIGHT AND LICENSE
+
+This software is Copyright (c) 2014 by Markus Benning <ich@markusbenning.de>.
+
+This is free software, licensed under:
+
+ The GNU General Public License, Version 2, June 1991
+
+=cut
|
[-]
[+]
|
Changed |
_service:download_files:Mail-MtPolicyd-2.02.tar.gz/lib/Mail/MtPolicyd/Cookbook.pod
^
|
@@ -13,7 +13,7 @@
=head1 VERSION
-version 1.23
+version 2.02
=head1 DESCRIPTION
|
[-]
[+]
|
Changed |
_service:download_files:Mail-MtPolicyd-2.02.tar.gz/lib/Mail/MtPolicyd/Cookbook/BasicPlugin.pod
^
|
@@ -13,7 +13,7 @@
=head1 VERSION
-version 1.23
+version 2.02
=head1 How to write your own mtpolicyd plugin
|
[-]
[+]
|
Changed |
_service:download_files:Mail-MtPolicyd-2.02.tar.gz/lib/Mail/MtPolicyd/Cookbook/ExtendedPlugin.pod
^
|
@@ -13,7 +13,7 @@
=head1 VERSION
-version 1.23
+version 2.02
=head1 Extending your mtpolicyd plugin
|
[-]
[+]
|
Changed |
_service:download_files:Mail-MtPolicyd-2.02.tar.gz/lib/Mail/MtPolicyd/Cookbook/HowtoAccountingQuota.pod
^
|
@@ -13,7 +13,7 @@
=head1 VERSION
-version 1.23
+version 2.02
=head1 SMTP level accounting and quotas with mtpolicyd
|
[-]
[+]
|
Changed |
_service:download_files:Mail-MtPolicyd-2.02.tar.gz/lib/Mail/MtPolicyd/Cookbook/Installation.pod
^
|
@@ -13,7 +13,7 @@
=head1 VERSION
-version 1.23
+version 2.02
=head1 GET STARTED WITH BASIC MTPOLICYD INSTALLATION
|
[-]
[+]
|
Changed |
_service:download_files:Mail-MtPolicyd-2.02.tar.gz/lib/Mail/MtPolicyd/Plugin.pm
^
|
@@ -3,7 +3,7 @@
use Moose;
use namespace::autoclean;
-our $VERSION = '1.23'; # VERSION
+our $VERSION = '2.02'; # VERSION
# ABSTRACT: a base class for plugins
@@ -53,7 +53,7 @@
=head1 VERSION
-version 1.23
+version 2.02
=head1 ATTRIBUTES
|
[-]
[+]
|
Changed |
_service:download_files:Mail-MtPolicyd-2.02.tar.gz/lib/Mail/MtPolicyd/Plugin/Accounting.pm
^
|
@@ -3,14 +3,13 @@
use Moose;
use namespace::autoclean;
-our $VERSION = '1.23'; # VERSION
+our $VERSION = '2.02'; # VERSION
# ABSTRACT: mtpolicyd plugin for accounting in sql tables
extends 'Mail::MtPolicyd::Plugin';
with 'Mail::MtPolicyd::Plugin::Role::UserConfig' => {
'uc_attributes' => [ 'enabled' ],
};
-with 'Mail::MtPolicyd::Plugin::Role::SqlUtils';
use Mail::MtPolicyd::Plugin::Result;
@@ -29,6 +28,12 @@
has 'time_pattern' => ( is => 'rw', isa => 'Str', default => '%Y-%m');
+with 'Mail::MtPolicyd::Role::Connection' => {
+ name => 'db',
+ type => 'Sql',
+};
+with 'Mail::MtPolicyd::Plugin::Role::SqlUtils';
+
sub get_timekey {
my $self = shift;
return Time::Piece->new->strftime( $self->time_pattern );
@@ -145,7 +150,7 @@
sub insert_accounting_row {
my ( $self, $field, $key, $metrics ) = @_;
- my $dbh = Mail::MtPolicyd::SqlConnection->instance->dbh;
+ my $dbh = $self->_db_handle;
my $table_name = $dbh->quote_identifier( $self->get_table_name($field) );
my $values = {
'key' => $key,
@@ -167,7 +172,7 @@
sub update_accounting_row {
my ( $self, $field, $key, $metrics ) = @_;
- my $dbh = Mail::MtPolicyd::SqlConnection->instance->dbh;
+ my $dbh = $self->_db_handle;
my $table_name = $dbh->quote_identifier( $self->get_table_name($field) );
my $where = {
'key' => $key,
@@ -207,7 +212,7 @@
=head1 VERSION
-version 1.23
+version 2.02
=head1 SYNOPSIS
|
[-]
[+]
|
Changed |
_service:download_files:Mail-MtPolicyd-2.02.tar.gz/lib/Mail/MtPolicyd/Plugin/Action.pm
^
|
@@ -3,7 +3,7 @@
use Moose;
use namespace::autoclean;
-our $VERSION = '1.23'; # VERSION
+our $VERSION = '2.02'; # VERSION
# ABSTRACT: mtpolicyd plugin which just returns an action
@@ -38,7 +38,7 @@
=head1 VERSION
-version 1.23
+version 2.02
=head1 DESCRIPTION
|
[-]
[+]
|
Changed |
_service:download_files:Mail-MtPolicyd-2.02.tar.gz/lib/Mail/MtPolicyd/Plugin/ClearFields.pm
^
|
@@ -3,7 +3,7 @@
use Moose;
use namespace::autoclean;
-our $VERSION = '1.23'; # VERSION
+our $VERSION = '2.02'; # VERSION
# ABSTRACT: mtpolicyd plugin to unset session variables
@@ -70,7 +70,7 @@
=head1 VERSION
-version 1.23
+version 2.02
=head1 DESCRIPTION
|
[-]
[+]
|
Changed |
_service:download_files:Mail-MtPolicyd-2.02.tar.gz/lib/Mail/MtPolicyd/Plugin/Condition.pm
^
|
@@ -3,7 +3,7 @@
use Moose;
use namespace::autoclean;
-our $VERSION = '1.23'; # VERSION
+our $VERSION = '2.02'; # VERSION
# ABSTRACT: mtpolicyd plugin for conditions based on session values
extends 'Mail::MtPolicyd::Plugin';
@@ -17,16 +17,18 @@
use Mail::MtPolicyd::Plugin::Result;
-has 'key' => ( is => 'ro', isa => 'Str', required => 1 );
+has 'key' => ( is => 'rw', isa => 'Str', required => 1 );
has 'score' => ( is => 'rw', isa => 'Maybe[Num]' );
has 'action' => ( is => 'rw', isa => 'Maybe[Str]' );
-has 'match' => ( is => 'ro', isa => 'Maybe[Str]' );
-has 're_match' => ( is => 'ro', isa => 'Maybe[Str]' );
+has 'match' => ( is => 'rw', isa => 'Maybe[Str]' );
+has 're_match' => ( is => 'rw', isa => 'Maybe[Str]' );
-has 'gt_match' => ( is => 'ro', isa => 'Maybe[Num]' );
-has 'lt_match' => ( is => 'ro', isa => 'Maybe[Num]' );
+has 'gt_match' => ( is => 'rw', isa => 'Maybe[Num]' );
+has 'lt_match' => ( is => 'rw', isa => 'Maybe[Num]' );
+
+has 'invert' => ( is => 'rw', isa => 'Bool', default => 0 );
sub _match {
my ( $self, $value ) = @_;
@@ -59,12 +61,17 @@
my $key = $self->key;
my $session = $r->session;
- my $value = $session->{$key};
+ my $value = $r->get( $key );
if( ! defined $value ) {
return;
}
- if( $self->_match($value) ) {
+ my $matched = $self->_match($value);
+ if( $self->invert ) {
+ $matched = ! $matched;
+ }
+
+ if( $matched ) {
$self->log($r, $key.' matched '.$value);
my $score = $self->get_uc($session, 'score');
if( defined $score ) {
@@ -102,7 +109,7 @@
=head1 VERSION
-version 1.23
+version 2.02
=head1 DESCRIPTION
@@ -114,7 +121,36 @@
=item key (required)
-The name of the variable within the session to check.
+The name of the variable to check.
+
+Syntax is
+
+ (<scope>:)?<variable-name>
+
+If no scope is give it defaults to request.
+
+Possible scopes are:
+
+=over
+
+=item session, s
+
+Session variables.
+
+=item request, r
+
+Request attribute variables.
+
+=back
+
+Examples:
+
+ session:user_policy
+ s:user_policy
+
+ request:queue_id
+ r:queue_id
+ queue_id
=back
@@ -139,6 +175,10 @@
Match if numerical greater than.
+=item invert (default: 0)
+
+If set to 1 the logic will be inverted.
+
=back
Finally an action must be specified.
|
[-]
[+]
|
Changed |
_service:download_files:Mail-MtPolicyd-2.02.tar.gz/lib/Mail/MtPolicyd/Plugin/CtIpRep.pm
^
|
@@ -3,7 +3,7 @@
use Moose;
use namespace::autoclean;
-our $VERSION = '1.23'; # VERSION
+our $VERSION = '2.02'; # VERSION
# ABSTRACT: mtpolicyd plugin for the Commtouch IP reputation service (ctipd)
@@ -146,7 +146,7 @@
=head1 VERSION
-version 1.23
+version 2.02
=head1 DESCRIPTION
|
[-]
[+]
|
Changed |
_service:download_files:Mail-MtPolicyd-2.02.tar.gz/lib/Mail/MtPolicyd/Plugin/DBL.pm
^
|
@@ -3,7 +3,7 @@
use Moose;
use namespace::autoclean;
-our $VERSION = '1.23'; # VERSION
+our $VERSION = '2.02'; # VERSION
# ABSTRACT: mtpolicyd plugin for checking helo,sender domain,rdns against an DBL
extends 'Mail::MtPolicyd::Plugin';
@@ -64,7 +64,8 @@
next;
}
- $self->log($r, 'domain '.$hostname.' is on '.$self->domain.' blacklist ('.$info.')');
+ $self->log($r, 'domain '.$hostname.' is on '.$self->domain.' blacklist'.
+ ( defined $info ? " ($info)" : '' ) );
my $score_attr = $check.'_score';
if( defined $self->$score_attr &&
@@ -143,7 +144,7 @@
=head1 VERSION
-version 1.23
+version 2.02
=head1 DESCRIPTION
|
[-]
[+]
|
Changed |
_service:download_files:Mail-MtPolicyd-2.02.tar.gz/lib/Mail/MtPolicyd/Plugin/Eval.pm
^
|
@@ -3,7 +3,7 @@
use Moose;
use namespace::autoclean;
-our $VERSION = '1.23'; # VERSION
+our $VERSION = '2.02'; # VERSION
# ABSTRACT: mtpolicyd plugin to capture the output of plugins
@@ -46,7 +46,7 @@
=head1 VERSION
-version 1.23
+version 2.02
=head1 DESCRIPTION
|
[-]
[+]
|
Changed |
_service:download_files:Mail-MtPolicyd-2.02.tar.gz/lib/Mail/MtPolicyd/Plugin/Fail2Ban.pm
^
|
@@ -3,7 +3,7 @@
use Moose;
use namespace::autoclean;
-our $VERSION = '1.23'; # VERSION
+our $VERSION = '2.02'; # VERSION
# ABSTRACT: mtpolicyd plugin to block an address with fail2ban
@@ -89,7 +89,7 @@
=head1 VERSION
-version 1.23
+version 2.02
=head1 DESCRIPTION
|
[-]
[+]
|
Changed |
_service:download_files:Mail-MtPolicyd-2.02.tar.gz/lib/Mail/MtPolicyd/Plugin/GeoIPAction.pm
^
|
@@ -3,7 +3,7 @@
use Moose;
use namespace::autoclean;
-our $VERSION = '1.23'; # VERSION
+our $VERSION = '2.02'; # VERSION
# ABSTRACT: mtpolicyd plugin for checking geo information of an ip
@@ -59,6 +59,9 @@
return;
}
my ( $country_code ) = @{$session->{$result_key}};
+ if( ! defined $country_code ) {
+ return;
+ }
if( ! $self->is_in_country_codes( $country_code ) ) {
$self->log( $r, 'country_code '.$country_code.' of IP not in country_code list'.$self->name);
@@ -107,7 +110,7 @@
=head1 VERSION
-version 1.23
+version 2.02
=head1 DESCRIPTION
|
[-]
[+]
|
Changed |
_service:download_files:Mail-MtPolicyd-2.02.tar.gz/lib/Mail/MtPolicyd/Plugin/GeoIPLookup.pm
^
|
@@ -3,7 +3,7 @@
use Moose;
use namespace::autoclean;
-our $VERSION = '1.23'; # VERSION
+our $VERSION = '2.02'; # VERSION
# ABSTRACT: mtpolicyd plugin for checking geo information of an client_address
extends 'Mail::MtPolicyd::Plugin';
@@ -54,7 +54,7 @@
=head1 VERSION
-version 1.23
+version 2.02
=head1 DESCRIPTION
|
[-]
[+]
|
Changed |
_service:download_files:Mail-MtPolicyd-2.02.tar.gz/lib/Mail/MtPolicyd/Plugin/Greylist.pm
^
|
@@ -3,7 +3,7 @@
use Moose;
use namespace::autoclean;
-our $VERSION = '1.23'; # VERSION
+our $VERSION = '2.02'; # VERSION
# ABSTRACT: This plugin implements a greylisting mechanism with an auto whitelist.
extends 'Mail::MtPolicyd::Plugin';
@@ -11,7 +11,6 @@
with 'Mail::MtPolicyd::Plugin::Role::UserConfig' => {
'uc_attributes' => [ 'enabled' ],
};
-with 'Mail::MtPolicyd::Plugin::Role::SqlUtils';
use Mail::MtPolicyd::Plugin::Result;
use Time::Piece;
@@ -38,6 +37,17 @@
has 'query_autowl' => ( is => 'rw', isa => 'Bool', default => 1 );
has 'create_ticket' => ( is => 'rw', isa => 'Bool', default => 1 );
+with 'Mail::MtPolicyd::Role::Connection' => {
+ name => 'db',
+ type => 'Sql',
+};
+with 'Mail::MtPolicyd::Role::Connection' => {
+ name => 'memcached',
+ type => 'Memcached',
+};
+
+with 'Mail::MtPolicyd::Plugin::Role::SqlUtils';
+
sub run {
my ( $self, $r ) = @_;
my $ip = $r->attr('client_address');
@@ -220,7 +230,7 @@
sub get_ticket {
my ( $self, $r, $sender, $ip, $rcpt ) = @_;
my $key = join(",", $sender, $ip, $rcpt );
- if( my $ticket = $r->server->memcached->get( $key ) ) {
+ if( my $ticket = $self->_memcached_handle->get( $key ) ) {
return( $ticket );
}
return;
@@ -237,7 +247,7 @@
sub remove_ticket {
my ( $self, $r, $sender, $ip, $rcpt ) = @_;
my $key = join(",", $sender, $ip, $rcpt );
- $r->server->memcached->delete( $key );
+ $self->_memcached_handle->delete( $key );
return;
}
@@ -245,7 +255,7 @@
my ( $self, $r, $sender, $ip, $rcpt ) = @_;
my $ticket = time + $self->min_retry_wait;
my $key = join(",", $sender, $ip, $rcpt );
- $r->server->memcached->set( $key, $ticket, $self->max_retry_wait );
+ $self->_memcached_handle->set( $key, $ticket, $self->max_retry_wait );
return;
}
@@ -309,7 +319,7 @@
=head1 VERSION
-version 1.23
+version 2.02
=head1 DESCRIPTION
|
[-]
[+]
|
Changed |
_service:download_files:Mail-MtPolicyd-2.02.tar.gz/lib/Mail/MtPolicyd/Plugin/Honeypot.pm
^
|
@@ -3,7 +3,7 @@
use Moose;
use namespace::autoclean;
-our $VERSION = '1.23'; # VERSION
+our $VERSION = '2.02'; # VERSION
# ABSTRACT: mtpolicyd plugin for creating an honeypot
extends 'Mail::MtPolicyd::Plugin';
@@ -146,7 +146,7 @@
=head1 VERSION
-version 1.23
+version 2.02
=head1 DESCRIPTION
|
[-]
[+]
|
Changed |
_service:download_files:Mail-MtPolicyd-2.02.tar.gz/lib/Mail/MtPolicyd/Plugin/LdapUserConfig.pm
^
|
@@ -3,25 +3,16 @@
use Moose;
use namespace::autoclean;
-our $VERSION = '1.23'; # VERSION
+our $VERSION = '2.02'; # VERSION
# ABSTRACT: mtpolicyd plugin for retrieving per user configuration from LDAP
extends 'Mail::MtPolicyd::Plugin';
-use Mail::MtPolicyd::LdapConnection;
use Mail::MtPolicyd::Plugin::Result;
use Net::LDAP::Util qw( escape_filter_value );
-sub init {
- my $self = shift;
- if( ! Mail::MtPolicyd::LdapConnection->is_initialized ) {
- die('no ldap connection initialized, but required for plugin '.$self->name);
- }
- return;
-};
-
has 'basedn' => ( is => 'rw', isa => 'Str', default => '' );
has 'filter' => ( is => 'rw', isa => 'Str', required => 1 );
@@ -47,9 +38,17 @@
},
);
+has 'connection' => ( is => 'ro', isa => 'Str', default => 'ldap' );
+has 'connection_type' => ( is => 'ro', isa => 'Str', default => 'Ldap' );
+
+with 'Mail::MtPolicyd::Role::Connection' => {
+ name => 'ldap',
+ type => 'Ldap',
+};
+
sub retrieve_ldap_entry {
my ( $self, $r ) = @_;
- my $ldap = Mail::MtPolicyd::LdapConnection->handle;
+ my $ldap = $self->_ldap_handle;
my $value = $self->get_filter_value( $r );
if( ! defined $value ) {
@@ -118,7 +117,7 @@
=head1 VERSION
-version 1.23
+version 2.02
=head1 SYNOPSIS
|
[-]
[+]
|
Changed |
_service:download_files:Mail-MtPolicyd-2.02.tar.gz/lib/Mail/MtPolicyd/Plugin/PostfixMap.pm
^
|
@@ -3,7 +3,7 @@
use Moose;
use namespace::autoclean;
-our $VERSION = '1.23'; # VERSION
+our $VERSION = '2.02'; # VERSION
# ABSTRACT: mtpolicyd plugin for accessing a postfix access map
extends 'Mail::MtPolicyd::Plugin';
@@ -157,7 +157,7 @@
=head1 VERSION
-version 1.23
+version 2.02
=head1 SYNOPSIS
|
[-]
[+]
|
Changed |
_service:download_files:Mail-MtPolicyd-2.02.tar.gz/lib/Mail/MtPolicyd/Plugin/Proxy.pm
^
|
@@ -3,7 +3,7 @@
use Moose;
use namespace::autoclean;
-our $VERSION = '1.23'; # VERSION
+our $VERSION = '2.02'; # VERSION
# ABSTRACT: mtpolicyd plugin to forward request to another policy daemon
@@ -64,7 +64,7 @@
=head1 VERSION
-version 1.23
+version 2.02
=head1 DESCRIPTION
|
[-]
[+]
|
Changed |
_service:download_files:Mail-MtPolicyd-2.02.tar.gz/lib/Mail/MtPolicyd/Plugin/Quota.pm
^
|
@@ -3,7 +3,7 @@
use Moose;
use namespace::autoclean;
-our $VERSION = '1.23'; # VERSION
+our $VERSION = '2.02'; # VERSION
# ABSTRACT: mtpolicyd plugin for accounting in sql tables
extends 'Mail::MtPolicyd::Plugin';
@@ -12,7 +12,6 @@
'enabled', 'field', 'threshold', 'action', 'metric'
],
};
-with 'Mail::MtPolicyd::Plugin::Role::SqlUtils';
with 'Mail::MtPolicyd::Plugin::Role::PluginChain';
use Mail::MtPolicyd::Plugin::Result;
@@ -27,6 +26,12 @@
has 'threshold' => ( is => 'rw', isa => 'Int', required => 1);
has 'action' => ( is => 'rw', isa => 'Str', default => 'defer smtp traffic quota has been exceeded');
+with 'Mail::MtPolicyd::Role::Connection' => {
+ name => 'db',
+ type => 'Sql',
+};
+with 'Mail::MtPolicyd::Plugin::Role::SqlUtils';
+
sub get_timekey {
my $self = shift;
return Time::Piece->new->strftime( $self->time_pattern );
@@ -79,7 +84,7 @@
sub get_accounting_count {
my ( $self, $r, $field, $metric, $key ) = @_;
- my $dbh = Mail::MtPolicyd::SqlConnection->instance->dbh;
+ my $dbh = $self->_db_handle;
my $where = {
'key' => $key,
'time' => $self->get_timekey,
@@ -115,7 +120,7 @@
=head1 VERSION
-version 1.23
+version 2.02
=head1 DESCRIPTION
|
[-]
[+]
|
Changed |
_service:download_files:Mail-MtPolicyd-2.02.tar.gz/lib/Mail/MtPolicyd/Plugin/RBL.pm
^
|
@@ -3,7 +3,7 @@
use Moose;
use namespace::autoclean;
-our $VERSION = '1.23'; # VERSION
+our $VERSION = '2.02'; # VERSION
# ABSTRACT: mtpolicyd plugin for checking the client-address against an RBL
@@ -101,7 +101,7 @@
=head1 VERSION
-version 1.23
+version 2.02
=head1 DESCRIPTION
|
[-]
[+]
|
Changed |
_service:download_files:Mail-MtPolicyd-2.02.tar.gz/lib/Mail/MtPolicyd/Plugin/RBLAction.pm
^
|
@@ -3,7 +3,7 @@
use Moose;
use namespace::autoclean;
-our $VERSION = '1.23'; # VERSION
+our $VERSION = '2.02'; # VERSION
# ABSTRACT: mtpolicyd plugin for checking the client-address against an RBL
@@ -104,7 +104,7 @@
=head1 VERSION
-version 1.23
+version 2.02
=head1 DESCRIPTION
|
[-]
[+]
|
Changed |
_service:download_files:Mail-MtPolicyd-2.02.tar.gz/lib/Mail/MtPolicyd/Plugin/Result.pm
^
|
@@ -3,7 +3,7 @@
use Moose;
use namespace::autoclean;
-our $VERSION = '1.23'; # VERSION
+our $VERSION = '2.02'; # VERSION
# ABSTRACT: result returned by a plugin
has 'action' => ( is => 'rw', isa => 'Maybe[Str]' );
@@ -54,7 +54,7 @@
=head1 VERSION
-version 1.23
+version 2.02
=head1 AUTHOR
|
[-]
[+]
|
Changed |
_service:download_files:Mail-MtPolicyd-2.02.tar.gz/lib/Mail/MtPolicyd/Plugin/Role/ConfigurableFields.pm
^
|
@@ -5,7 +5,7 @@
use Moose::Util::TypeConstraints;
-our $VERSION = '1.23'; # VERSION
+our $VERSION = '2.02'; # VERSION
# ABSTRACT: role for plugins using configurable fields
parameter fields => (
@@ -76,7 +76,7 @@
=head1 VERSION
-version 1.23
+version 2.02
=head1 AUTHOR
|
[-]
[+]
|
Changed |
_service:download_files:Mail-MtPolicyd-2.02.tar.gz/lib/Mail/MtPolicyd/Plugin/Role/PluginChain.pm
^
|
@@ -2,7 +2,7 @@
use Moose::Role;
-our $VERSION = '1.23'; # VERSION
+our $VERSION = '2.02'; # VERSION
# ABSTRACT: role for plugins to support a nested plugin chain
use Mail::MtPolicyd::PluginChain;
@@ -47,7 +47,7 @@
=head1 VERSION
-version 1.23
+version 2.02
=head1 AUTHOR
|
[-]
[+]
|
Changed |
_service:download_files:Mail-MtPolicyd-2.02.tar.gz/lib/Mail/MtPolicyd/Plugin/Role/Scoring.pm
^
|
@@ -2,7 +2,7 @@
use Moose::Role;
-our $VERSION = '1.23'; # VERSION
+our $VERSION = '2.02'; # VERSION
# ABSTRACT: role for plugins using scoring
has 'score_field' => (
@@ -68,7 +68,7 @@
=head1 VERSION
-version 1.23
+version 2.02
=head1 AUTHOR
|
[-]
[+]
|
Changed |
_service:download_files:Mail-MtPolicyd-2.02.tar.gz/lib/Mail/MtPolicyd/Plugin/Role/SqlUtils.pm
^
|
@@ -3,22 +3,14 @@
use strict;
use Moose::Role;
-use Mail::MtPolicyd::SqlConnection;
-
# ABSTRACT: role with support function for plugins using sql
-our $VERSION = '1.23'; # VERSION
+our $VERSION = '2.02'; # VERSION
-before 'init' => sub {
- my $self = shift;
- if( ! Mail::MtPolicyd::SqlConnection->is_initialized ) {
- die('no sql database initialized, but required for plugin '.$self->name);
- }
- return;
-};
+requires '_db_handle';
sub sql_table_exists {
my ( $self, $name ) = @_;
- my $dbh = Mail::MtPolicyd::SqlConnection->instance->dbh;
+ my $dbh = $self->_db_handle;
my $sql = 'SELECT * FROM '.$dbh->quote_identifier($name).' WHERE 1=0;';
eval { $dbh->do($sql); };
if( $@ ) {
@@ -29,7 +21,7 @@
sub create_sql_table {
my ( $self, $name, $definitions ) = @_;
- my $dbh = Mail::MtPolicyd::SqlConnection->instance->dbh;
+ my $dbh = $self->_db_handle;
my $table_name = $dbh->quote_identifier($name);
my $sql;
my $driver = $dbh->{Driver}->{Name};
@@ -61,7 +53,7 @@
sub execute_sql {
my ( $self, $sql, @params ) = @_;
- my $dbh = Mail::MtPolicyd::SqlConnection->instance->dbh;
+ my $dbh = $self->_db_handle;
my $sth = $dbh->prepare( $sql );
$sth->execute( @params );
return $sth;
@@ -81,7 +73,7 @@
=head1 VERSION
-version 1.23
+version 2.02
=head1 AUTHOR
|
[-]
[+]
|
Changed |
_service:download_files:Mail-MtPolicyd-2.02.tar.gz/lib/Mail/MtPolicyd/Plugin/Role/UserConfig.pm
^
|
@@ -3,7 +3,7 @@
use strict; # make critic happy
use MooseX::Role::Parameterized;
-our $VERSION = '1.23'; # VERSION
+our $VERSION = '2.02'; # VERSION
# ABSTRACT: role for plugins using per user/request configuration
parameter uc_attributes => (
@@ -53,7 +53,7 @@
=head1 VERSION
-version 1.23
+version 2.02
=head1 AUTHOR
|
[-]
[+]
|
Changed |
_service:download_files:Mail-MtPolicyd-2.02.tar.gz/lib/Mail/MtPolicyd/Plugin/SMTPVerify.pm
^
|
@@ -3,7 +3,7 @@
use Moose;
use namespace::autoclean;
-our $VERSION = '1.23'; # VERSION
+our $VERSION = '2.02'; # VERSION
# ABSTRACT: mtpolicyd plugin for remote SMTP address checks
extends 'Mail::MtPolicyd::Plugin';
@@ -214,7 +214,7 @@
=head1 VERSION
-version 1.23
+version 2.02
=head1 DESCRIPTION
|
[-]
[+]
|
Changed |
_service:download_files:Mail-MtPolicyd-2.02.tar.gz/lib/Mail/MtPolicyd/Plugin/SPF.pm
^
|
@@ -3,7 +3,7 @@
use Moose;
use namespace::autoclean;
-our $VERSION = '1.23'; # VERSION
+our $VERSION = '2.02'; # VERSION
# ABSTRACT: mtpolicyd plugin to apply SPF checks
@@ -11,7 +11,7 @@
with 'Mail::MtPolicyd::Plugin::Role::Scoring';
with 'Mail::MtPolicyd::Plugin::Role::UserConfig' => {
- 'uc_attributes' => [ 'enabled', 'fail_mode', 'pass_mode' ],
+ 'uc_attributes' => [ 'enabled', 'fail_mode', 'softfail_mode', 'pass_mode' ],
};
use Mail::MtPolicyd::Plugin::Result;
@@ -25,6 +25,9 @@
has 'pass_score' => ( is => 'rw', isa => 'Maybe[Num]' );
has 'pass_mode' => ( is => 'rw', isa => 'Str', default => 'passive' );
+has 'softfail_score' => ( is => 'rw', isa => 'Maybe[Num]' );
+has 'softfail_mode' => ( is => 'rw', isa => 'Str', default => 'passive' );
+
has 'fail_score' => ( is => 'rw', isa => 'Maybe[Num]' );
has 'fail_mode' => ( is => 'rw', isa => 'Str', default => 'reject' );
@@ -138,10 +141,11 @@
}
sub _check_spf_result {
- my ( $self, $r, $result, $no_pass_action ) = @_;
- my $scope = $result->request->scope;
+ my ( $self, $r, $result, $no_pass_action ) = @_;
+ my $scope = $result->request->scope;
my $session = $r->session;
my $fail_mode = $self->get_uc($session, 'fail_mode');
+ my $softfail_mode = $self->get_uc($session, 'softfail_mode');
my $pass_mode = $self->get_uc($session, 'pass_mode');
if( $result->code eq 'neutral') {
@@ -159,6 +163,20 @@
);
}
return;
+ } elsif( $result->code eq 'softfail') {
+ $self->log( $r, 'SPF '.$scope.' check returned softfail '.$result->local_explanation);
+ if( defined $self->softfail_score && ! $r->is_already_done($self->name.'-score') ) {
+ $self->add_score( $r, $self->name => $self->softfail_score );
+ }
+ if( $softfail_mode eq 'reject') {
+ return Mail::MtPolicyd::Plugin::Result->new(
+ action => $self->_get_reject_action($result),
+ abort => 1,
+ );
+ } elsif( $softfail_mode eq 'accept' || $softfail_mode eq 'dunno') {
+ return Mail::MtPolicyd::Plugin::Result->new_dunno;
+ }
+ return;
} elsif( $result->code eq 'pass' ) {
$self->log( $r, 'SPF '.$scope.' check passed');
if( $no_pass_action ) { return; }
@@ -210,7 +228,7 @@
=head1 VERSION
-version 1.23
+version 2.02
=head1 DESCRIPTION
@@ -218,6 +236,20 @@
Checks are implemented using the Mail::SPF perl module.
+Actions based on the SPF result can be applied for:
+
+=over
+
+=item pass (pass_mode, default: passive)
+
+=item softfail (softfail_mode, default: passive)
+
+=item fail (fail_mode, default: reject)
+
+=back
+
+For status 'neutral' no action or score is applied.
+
=head1 PARAMETERS
=over
@@ -246,6 +278,30 @@
Score to apply when the sender has been successfully checked against SPF.
+=item (uc_)softfail_mode (default: passive)
+
+How to behave if the SPF checks returned a softfail status.
+
+=over
+
+=item passive
+
+Just apply score. Do not return an action.
+
+=item accept, dunno
+
+Will return an 'dunno' action.
+
+=item reject
+
+Return an reject action.
+
+=back
+
+=item softfail_score (default: empty)
+
+Score to apply when the SPF check returns an softfail status.
+
=item (uc_)fail_mode (default: reject)
=over
@@ -314,6 +370,10 @@
#fail_score = 10
</Plugin>
+=head1 SEE ALSO
+
+L<Mail::SPF>, OpenSPF L<www.openspf.org/>, RFC 7209 L<https://tools.ietf.org/html/rfc7208>
+
=head1 AUTHOR
Markus Benning <ich@markusbenning.de>
|
[-]
[+]
|
Changed |
_service:download_files:Mail-MtPolicyd-2.02.tar.gz/lib/Mail/MtPolicyd/Plugin/SaAwlAction.pm
^
|
@@ -3,7 +3,7 @@
use Moose;
use namespace::autoclean;
-our $VERSION = '1.23'; # VERSION
+our $VERSION = '2.02'; # VERSION
# ABSTRACT: mtpolicyd plugin for checking spamassassin AWL reputation
@@ -121,7 +121,7 @@
=head1 VERSION
-version 1.23
+version 2.02
=head1 DESCRIPTION
|
[-]
[+]
|
Changed |
_service:download_files:Mail-MtPolicyd-2.02.tar.gz/lib/Mail/MtPolicyd/Plugin/SaAwlLookup.pm
^
|
@@ -3,7 +3,7 @@
use Moose;
use namespace::autoclean;
-our $VERSION = '1.23'; # VERSION
+our $VERSION = '2.02'; # VERSION
# ABSTRACT: mtpolicyd plugin for querying a spamassassin AWL database for reputation
extends 'Mail::MtPolicyd::Plugin';
@@ -117,7 +117,7 @@
=head1 VERSION
-version 1.23
+version 2.02
=head1 DESCRIPTION
|
[-]
[+]
|
Changed |
_service:download_files:Mail-MtPolicyd-2.02.tar.gz/lib/Mail/MtPolicyd/Plugin/ScoreAction.pm
^
|
@@ -3,7 +3,7 @@
use Moose;
use namespace::autoclean;
-our $VERSION = '1.23'; # VERSION
+our $VERSION = '2.02'; # VERSION
# ABSTRACT: mtpolicyd plugin for running an action based on the score
extends 'Mail::MtPolicyd::Plugin';
@@ -80,7 +80,7 @@
=head1 VERSION
-version 1.23
+version 2.02
=head1 DESCRIPTION
|
[-]
[+]
|
Changed |
_service:download_files:Mail-MtPolicyd-2.02.tar.gz/lib/Mail/MtPolicyd/Plugin/SetField.pm
^
|
@@ -3,7 +3,7 @@
use Moose;
use namespace::autoclean;
-our $VERSION = '1.23'; # VERSION
+our $VERSION = '2.02'; # VERSION
# ABSTRACT: mtpolicyd plugin which just sets and key=value in the session
@@ -36,7 +36,7 @@
=head1 VERSION
-version 1.23
+version 2.02
=head1 DESCRIPTION
|
[-]
[+]
|
Changed |
_service:download_files:Mail-MtPolicyd-2.02.tar.gz/lib/Mail/MtPolicyd/Plugin/SqlList.pm
^
|
@@ -3,7 +3,7 @@
use Moose;
use namespace::autoclean;
-our $VERSION = '1.23'; # VERSION
+our $VERSION = '2.02'; # VERSION
# ABSTRACT: mtpolicyd plugin for accessing a SQL white/black/access list
extends 'Mail::MtPolicyd::Plugin';
@@ -11,7 +11,6 @@
with 'Mail::MtPolicyd::Plugin::Role::UserConfig' => {
'uc_attributes' => [ 'enabled' ],
};
-with 'Mail::MtPolicyd::Plugin::Role::SqlUtils';
use Mail::MtPolicyd::Plugin::Result;
@@ -27,6 +26,12 @@
has 'match_action' => ( is => 'rw', isa => 'Maybe[Str]' );
has 'not_match_action' => ( is => 'rw', isa => 'Maybe[Str]' );
+with 'Mail::MtPolicyd::Role::Connection' => {
+ name => 'db',
+ type => 'Sql',
+};
+with 'Mail::MtPolicyd::Plugin::Role::SqlUtils';
+
sub _query_db {
my ( $self, $ip ) = @_;
return $self->execute_sql($self->sql_query, $ip)->fetchrow_array;
@@ -91,7 +96,7 @@
=head1 VERSION
-version 1.23
+version 2.02
=head1 SYNOPSIS
|
[-]
[+]
|
Changed |
_service:download_files:Mail-MtPolicyd-2.02.tar.gz/lib/Mail/MtPolicyd/Plugin/SqlUserConfig.pm
^
|
@@ -3,11 +3,10 @@
use Moose;
use namespace::autoclean;
-our $VERSION = '1.23'; # VERSION
+our $VERSION = '2.02'; # VERSION
# ABSTRACT: mtpolicyd plugin for retrieving the user config of a user
extends 'Mail::MtPolicyd::Plugin';
-with 'Mail::MtPolicyd::Plugin::Role::SqlUtils';
use Mail::MtPolicyd::Plugin::Result;
@@ -27,6 +26,12 @@
has 'field' => ( is => 'rw', isa => 'Str', default => 'recipient' );
+with 'Mail::MtPolicyd::Role::Connection' => {
+ name => 'db',
+ type => 'Sql',
+};
+with 'Mail::MtPolicyd::Plugin::Role::SqlUtils';
+
sub _get_config {
my ( $self, $r ) = @_;
my $key = $r->attr( $self->field );
@@ -76,7 +81,7 @@
=head1 VERSION
-version 1.23
+version 2.02
=head1 DESCRIPTION
|
[-]
[+]
|
Changed |
_service:download_files:Mail-MtPolicyd-2.02.tar.gz/lib/Mail/MtPolicyd/Plugin/Stress.pm
^
|
@@ -3,7 +3,7 @@
use Moose;
use namespace::autoclean;
-our $VERSION = '1.23'; # VERSION
+our $VERSION = '2.02'; # VERSION
# ABSTRACT: mtpolicyd plugin for postfix stress mode
extends 'Mail::MtPolicyd::Plugin';
@@ -58,7 +58,7 @@
=head1 VERSION
-version 1.23
+version 2.02
=head1 DESCRIPTION
|
[-]
[+]
|
Changed |
_service:download_files:Mail-MtPolicyd-2.02.tar.gz/lib/Mail/MtPolicyd/PluginChain.pm
^
|
@@ -3,7 +3,7 @@
use Moose;
use namespace::autoclean;
-our $VERSION = '1.23'; # VERSION
+our $VERSION = '2.02'; # VERSION
# ABSTRACT: class for a VirtualHost instance
use Mail::MtPolicyd::Profiler;
@@ -140,7 +140,7 @@
=head1 VERSION
-version 1.23
+version 2.02
=head1 AUTHOR
|
[-]
[+]
|
Changed |
_service:download_files:Mail-MtPolicyd-2.02.tar.gz/lib/Mail/MtPolicyd/Profiler.pm
^
|
@@ -1,13 +1,15 @@
package Mail::MtPolicyd::Profiler;
use strict;
+use warnings;
+
use MooseX::Singleton;
use namespace::autoclean;
use Mail::MtPolicyd::Profiler::Timer;
use JSON;
-our $VERSION = '1.23'; # VERSION
+our $VERSION = '2.02'; # VERSION
# ABSTRACT: a application level profiler for mtpolicyd
has 'root' => ( is => 'rw', isa => 'Mail::MtPolicyd::Profiler::Timer',
@@ -76,7 +78,7 @@
=head1 VERSION
-version 1.23
+version 2.02
=head1 AUTHOR
|
[-]
[+]
|
Changed |
_service:download_files:Mail-MtPolicyd-2.02.tar.gz/lib/Mail/MtPolicyd/Profiler/Timer.pm
^
|
@@ -3,7 +3,7 @@
use Moose;
use namespace::autoclean;
-our $VERSION = '1.23'; # VERSION
+our $VERSION = '2.02'; # VERSION
# ABSTRACT: a profiler for the mtpolicyd
use Time::HiRes 'gettimeofday', 'tv_interval';
@@ -86,7 +86,7 @@
=head1 VERSION
-version 1.23
+version 2.02
=head1 AUTHOR
|
[-]
[+]
|
Changed |
_service:download_files:Mail-MtPolicyd-2.02.tar.gz/lib/Mail/MtPolicyd/Request.pm
^
|
@@ -5,7 +5,7 @@
use Mail::MtPolicyd::Plugin::Result;
-our $VERSION = '1.23'; # VERSION
+our $VERSION = '2.02'; # VERSION
# ABSTRACT: the request object
@@ -49,6 +49,34 @@
}
+sub get {
+ my ( $self, $value ) = @_;
+ my ($scope, $name);
+
+ if( ! defined $value || $value eq '' ) { return; }
+
+ my @params = split(':', $value, 2);
+ if( scalar(@params) == 2 ) {
+ ( $scope, $name ) = @params;
+ } elsif( scalar(@params) == 1) {
+ ( $scope, $name ) = ( 'request', @params );
+ }
+
+ if( $scope eq 'session' || $scope eq 's' ) {
+ if( ! defined $self->session ) {
+ return;
+ }
+ return $self->session->{$name};
+ } elsif( $scope eq 'request' || $scope eq 'r' ) {
+ return $self->attr( $name );
+ }
+
+ die("unknown scope $scope while retrieving variable for $value");
+
+ return;
+}
+
+
sub new_from_fh {
my ( $class, $fh ) = ( shift, shift );
my $attr = {};
@@ -142,7 +170,7 @@
=head1 VERSION
-version 1.23
+version 2.02
=head1 ATTRIBUTES
@@ -178,6 +206,39 @@
Returns an string to dump the content of a request.
+=head2 get($variable_name)
+
+Retrieve value of a session or request variable.
+
+The format for the variable name is
+
+ (<scope>:)?<variable>
+
+If no scope is given it default to the request scope.
+
+Valid scopes are:
+
+=over
+
+=item session, s
+
+Session variables.
+
+=item request, r
+
+Request attributes.
+
+=back
+
+For example:
+
+ $r->get('request:sender'); # retrieve sender from request
+ $r->get('r:sender'); # short format
+ $r->get('sender'); # scope defaults to request
+
+ $r->get('session:user_policy'); # retrieve session variable user_policy
+ $r->get('s:user_policy'); # the same
+
=head2 new_from_fh($fh)
An object constructor for creating an request object with the content read
|
[-]
[+]
|
Changed |
_service:download_files:Mail-MtPolicyd-2.02.tar.gz/lib/Mail/MtPolicyd/Result.pm
^
|
@@ -3,7 +3,7 @@
use Moose;
use namespace::autoclean;
-our $VERSION = '1.23'; # VERSION
+our $VERSION = '2.02'; # VERSION
# ABSTRACT: class to hold the results of a request returned by plugins
has 'plugin_results' => (
@@ -57,7 +57,7 @@
=head1 VERSION
-version 1.23
+version 2.02
=head1 AUTHOR
|
[-]
[+]
|
Added |
_service:download_files:Mail-MtPolicyd-2.02.tar.gz/lib/Mail/MtPolicyd/Role
^
|
+(directory)
|
[-]
[+]
|
Added |
_service:download_files:Mail-MtPolicyd-2.02.tar.gz/lib/Mail/MtPolicyd/Role/Connection.pm
^
|
@@ -0,0 +1,99 @@
+package Mail::MtPolicyd::Role::Connection;
+
+use strict;
+use MooseX::Role::Parameterized;
+
+use Mail::MtPolicyd::ConnectionPool;
+
+# ABSTRACT: role to consume connections from connection pool
+our $VERSION = '2.02'; # VERSION
+
+parameter name => (
+ isa => 'Str',
+ default => 'db',
+);
+
+parameter type => (
+ isa => 'Str',
+ default => 'Sql',
+);
+
+parameter initialize_early => (
+ isa => 'Bool',
+ default => 1,
+);
+
+role {
+ my $p = shift;
+ my $name = $p->name;
+ my $conn_attr = '_'.$p->name;
+ my $handle_attr = $conn_attr.'_handle';
+ my $conn_class = 'Mail::MtPolicyd::Connection::'.$p->type;
+
+ if( $p->initialize_early ) {
+ before 'init' => sub {
+ my $self = shift;
+ $self->$conn_attr;
+ return;
+ };
+ }
+
+ has $name => (
+ is => 'ro',
+ isa => 'Str',
+ default => $name,
+ );
+
+ has $conn_attr => (
+ is => 'ro',
+ isa => $conn_class,
+ lazy => 1,
+ default => sub {
+ my $self = shift;
+ my $conn = Mail::MtPolicyd::ConnectionPool->get_connection($self->$name);
+ if( ! defined $conn ) {
+ die("no connection $name configured!");
+ }
+ return $conn;
+ },
+ );
+
+ has $handle_attr => (
+ is => 'ro',
+ lazy => 1,
+ default => sub {
+ my $self = shift;
+ return $self->$conn_attr->handle;
+ },
+ );
+};
+
+1;
+
+__END__
+
+=pod
+
+=encoding UTF-8
+
+=head1 NAME
+
+Mail::MtPolicyd::Role::Connection - role to consume connections from connection pool
+
+=head1 VERSION
+
+version 2.02
+
+=head1 AUTHOR
+
+Markus Benning <ich@markusbenning.de>
+
+=head1 COPYRIGHT AND LICENSE
+
+This software is Copyright (c) 2014 by Markus Benning <ich@markusbenning.de>.
+
+This is free software, licensed under:
+
+ The GNU General Public License, Version 2, June 1991
+
+=cut
|
[-]
[+]
|
Added |
_service:download_files:Mail-MtPolicyd-2.02.tar.gz/lib/Mail/MtPolicyd/SessionCache
^
|
+(directory)
|
[-]
[+]
|
Added |
_service:download_files:Mail-MtPolicyd-2.02.tar.gz/lib/Mail/MtPolicyd/SessionCache.pm
^
|
@@ -0,0 +1,84 @@
+package Mail::MtPolicyd::SessionCache;
+
+use Moose;
+
+our $VERSION = '2.02'; # VERSION
+# ABSTRACT: class for handling session cache
+
+use Mail::MtPolicyd::SessionCache::None;
+
+has 'server' => (
+ is => 'ro', isa => 'Net::Server', required => 1,
+ handles => {
+ 'log' => 'log',
+ }
+);
+
+has 'cache' => (
+ is => 'rw', isa => 'Mail::MtPolicyd::SessionCache::Base',
+ lazy => 1,
+ default => sub { Mail::MtPolicyd::SessionCache::None->new },
+ handles => [
+ 'retrieve_session', 'store_session', 'shutdown',
+ ],
+);
+
+sub load_config {
+ my ( $self, $config ) = @_;
+ if( ! defined $config->{'module'} ) {
+ die('no module defined for SessionCache!');
+ }
+ my $module = $config->{'module'};
+ my $class = 'Mail::MtPolicyd::SessionCache::'.$module;
+ my $cache;
+
+ $self->log(1, 'loading SessionCache '.$module);
+ my $code = "require ".$class.";";
+ eval $code; ## no critic (ProhibitStringyEval)
+ if($@) {
+ die('could not load SessionCache '.$module.': '.$@);
+ }
+
+ $self->log(1, 'initializing SessionCache '.$module);
+ eval {
+ $cache = $class->new(
+ %$config,
+ );
+ $cache->init();
+ };
+ if($@) {
+ die('could not initialize SessionCache: '.$@);
+ }
+ $self->cache( $cache );
+ return;
+}
+
+1;
+
+__END__
+
+=pod
+
+=encoding UTF-8
+
+=head1 NAME
+
+Mail::MtPolicyd::SessionCache - class for handling session cache
+
+=head1 VERSION
+
+version 2.02
+
+=head1 AUTHOR
+
+Markus Benning <ich@markusbenning.de>
+
+=head1 COPYRIGHT AND LICENSE
+
+This software is Copyright (c) 2014 by Markus Benning <ich@markusbenning.de>.
+
+This is free software, licensed under:
+
+ The GNU General Public License, Version 2, June 1991
+
+=cut
|
[-]
[+]
|
Added |
_service:download_files:Mail-MtPolicyd-2.02.tar.gz/lib/Mail/MtPolicyd/SessionCache/Base.pm
^
|
@@ -0,0 +1,56 @@
+package Mail::MtPolicyd::SessionCache::Base;
+
+use Moose;
+
+our $VERSION = '2.02'; # VERSION
+# ABSTRACT: base class for session cache adapters
+
+sub retrieve_session {
+ my ($self, $instance ) = @_;
+ return {};
+}
+
+sub store_session {
+ my ($self, $session ) = @_;
+ return;
+}
+
+sub init {
+ my ( $self ) = @_;
+ return;
+}
+
+sub shutdown {
+ my ( $self ) = @_;
+ return;
+}
+
+1;
+
+__END__
+
+=pod
+
+=encoding UTF-8
+
+=head1 NAME
+
+Mail::MtPolicyd::SessionCache::Base - base class for session cache adapters
+
+=head1 VERSION
+
+version 2.02
+
+=head1 AUTHOR
+
+Markus Benning <ich@markusbenning.de>
+
+=head1 COPYRIGHT AND LICENSE
+
+This software is Copyright (c) 2014 by Markus Benning <ich@markusbenning.de>.
+
+This is free software, licensed under:
+
+ The GNU General Public License, Version 2, June 1991
+
+=cut
|
[-]
[+]
|
Added |
_service:download_files:Mail-MtPolicyd-2.02.tar.gz/lib/Mail/MtPolicyd/SessionCache/Memcached.pm
^
|
@@ -0,0 +1,157 @@
+package Mail::MtPolicyd::SessionCache::Memcached;
+
+use Moose;
+
+our $VERSION = '2.02'; # VERSION
+# ABSTRACT: session cache adapter for memcached
+
+extends 'Mail::MtPolicyd::SessionCache::Base';
+
+with 'Mail::MtPolicyd::Role::Connection' => {
+ name => 'memcached',
+ type => 'Memcached',
+};
+
+use Time::HiRes qw(usleep);
+
+
+has 'expire' => ( is => 'ro', isa => 'Int', default => 5 * 60 );
+
+has 'lock_wait' => ( is => 'rw', isa => 'Int', default => 50 );
+has 'lock_max_retry' => ( is => 'rw', isa => 'Int', default => 50 );
+has 'lock_timeout' => ( is => 'rw', isa => 'Int', default => 10 );
+
+sub _acquire_session_lock {
+ my ( $self, $instance ) = @_;
+ my $lock = 'lock_'.$instance;
+
+ for( my $try = 1 ; $try < $self->lock_max_retry ; $try++ ) {
+ if( $self->_memcached_handle->add($lock, 1, $self->lock_timeout) ) {
+ return; # lock created
+ }
+ usleep( $self->lock_wait * $try );
+ }
+
+ die('could not acquire lock for session '.$instance);
+ return;
+}
+
+sub _release_session_lock {
+ my ( $self, $instance ) = @_;
+ my $lock = 'lock_'.$instance;
+
+ $self->_memcached_handle->delete($lock);
+
+ return;
+}
+
+sub retrieve_session {
+ my ($self, $instance ) = @_;
+
+ if( ! defined $instance ) {
+ return;
+ }
+
+ $self->_acquire_session_lock( $instance );
+
+ if( my $session = $self->_memcached_handle->get($instance) ) {
+ return($session);
+ }
+
+ return( { '_instance' => $instance } );
+}
+
+sub store_session {
+ my ($self, $session ) = @_;
+ my $instance = $session->{'_instance'};
+
+ if( ! defined $session || ! defined $instance ) {
+ return;
+ }
+
+ $self->_memcached_handle->set($instance, $session, $self->expire);
+
+ $self->_release_session_lock($instance);
+
+ return;
+}
+
+1;
+
+__END__
+
+=pod
+
+=encoding UTF-8
+
+=head1 NAME
+
+Mail::MtPolicyd::SessionCache::Memcached - session cache adapter for memcached
+
+=head1 VERSION
+
+version 2.02
+
+=head1 SYNOPSIS
+
+ <SessionCache>
+ module = "Memcached"
+ #memcached = "memcached"
+ # expire session cache entries
+ expire = "300"
+ # wait timeout will be increased each time 50,100,150,... (usec)
+ lock_wait=50
+ # abort after n retries
+ lock_max_retry=50
+ # session lock times out after (sec)
+ lock_timeout=10
+ </SessionCache>
+
+=head1 PARAMETERS
+
+=over
+
+=item memcached (default: memcached)
+
+Name of the database connection to use.
+
+You have to define this connection first.
+
+see L<Mail::MtPolicyd::Connection::Memcached>
+
+=item expire (default: 5*60)
+
+Timeout in seconds for sessions.
+
+=item lock_wait (default: 50)
+
+Timeout for retry when session is locked in milliseconds.
+
+The retry will be done in multiples of this timeout.
+
+When set to 50 retry will be done in 50, 100, 150ms...
+
+=item lock_max_retry (default: 50)
+
+Maximum number of retries before giving up to obtain lock on a
+session.
+
+=item lock_timeout (default: 10)
+
+Timeout of session locks in seconds.
+
+=back
+
+=head1 AUTHOR
+
+Markus Benning <ich@markusbenning.de>
+
+=head1 COPYRIGHT AND LICENSE
+
+This software is Copyright (c) 2014 by Markus Benning <ich@markusbenning.de>.
+
+This is free software, licensed under:
+
+ The GNU General Public License, Version 2, June 1991
+
+=cut
|
[-]
[+]
|
Added |
_service:download_files:Mail-MtPolicyd-2.02.tar.gz/lib/Mail/MtPolicyd/SessionCache/None.pm
^
|
@@ -0,0 +1,38 @@
+package Mail::MtPolicyd::SessionCache::None;
+
+use Moose;
+
+our $VERSION = '2.02'; # VERSION
+# ABSTRACT: dummy session caching adapter
+
+extends 'Mail::MtPolicyd::SessionCache::Base';
+
+1;
+
+__END__
+
+=pod
+
+=encoding UTF-8
+
+=head1 NAME
+
+Mail::MtPolicyd::SessionCache::None - dummy session caching adapter
+
+=head1 VERSION
+
+version 2.02
+
+=head1 AUTHOR
+
+Markus Benning <ich@markusbenning.de>
+
+=head1 COPYRIGHT AND LICENSE
+
+This software is Copyright (c) 2014 by Markus Benning <ich@markusbenning.de>.
+
+This is free software, licensed under:
+
+ The GNU General Public License, Version 2, June 1991
+
+=cut
|
[-]
[+]
|
Added |
_service:download_files:Mail-MtPolicyd-2.02.tar.gz/lib/Mail/MtPolicyd/SessionCache/Redis.pm
^
|
@@ -0,0 +1,164 @@
+package Mail::MtPolicyd::SessionCache::Redis;
+
+use Moose;
+
+our $VERSION = '2.02'; # VERSION
+# ABSTRACT: a session cache adapter for redis
+
+use Time::HiRes qw(usleep);
+use Storable;
+
+extends 'Mail::MtPolicyd::SessionCache::Base';
+
+with 'Mail::MtPolicyd::Role::Connection' => {
+ name => 'redis',
+ type => 'Redis',
+};
+
+
+has 'expire' => ( is => 'ro', isa => 'Int', default => 5 * 60 );
+
+has 'lock_wait' => ( is => 'rw', isa => 'Int', default => 50 );
+has 'lock_max_retry' => ( is => 'rw', isa => 'Int', default => 50 );
+has 'lock_timeout' => ( is => 'rw', isa => 'Int', default => 10 );
+
+sub _acquire_session_lock {
+ my ( $self, $instance ) = @_;
+ my $lock = 'lock_'.$instance;
+
+ for( my $try = 1 ; $try < $self->lock_max_retry ; $try++ ) {
+ if( $self->_redis_handle->set($lock, 1, 'EX', $self->lock_timeout, 'NX' ) ) {
+ return; # lock created
+ }
+ usleep( $self->lock_wait * $try );
+ }
+
+ die('could not acquire lock for session '.$instance);
+ return;
+}
+
+sub _release_session_lock {
+ my ( $self, $instance ) = @_;
+ my $lock = 'lock_'.$instance;
+
+ $self->_redis_handle->del($lock);
+
+ return;
+}
+
+sub retrieve_session {
+ my ($self, $instance ) = @_;
+
+ if( ! defined $instance ) {
+ return;
+ }
+
+ $self->_acquire_session_lock( $instance );
+
+ if( my $blob = $self->_redis_handle->get($instance) ) {
+ my $session;
+ eval { $session = Storable::thaw( $blob ) };
+ if( $@ ) {
+ die("could not restore session $instance: $@");
+ }
+ return($session);
+ }
+
+ return( { '_instance' => $instance } );
+}
+
+sub store_session {
+ my ($self, $session ) = @_;
+ my $instance = $session->{'_instance'};
+
+ if( ! defined $session || ! defined $instance ) {
+ return;
+ }
+
+ my $data = Storable::freeze( $session );
+ $self->_redis_handle->set($instance, $data, 'EX', $self->expire);
+
+ $self->_release_session_lock($instance);
+
+ return;
+}
+
+1;
+
+__END__
+
+=pod
+
+=encoding UTF-8
+
+=head1 NAME
+
+Mail::MtPolicyd::SessionCache::Redis - a session cache adapter for redis
+
+=head1 VERSION
+
+version 2.02
+
+=head1 SYNOPSIS
+
+ <SessionCache>
+ module = "Redis"
+ #redis = "redis"
+ # expire session cache entries
+ expire = "300"
+ # wait timeout will be increased each time 50,100,150,... (usec)
+ lock_wait=50
+ # abort after n retries
+ lock_max_retry=50
+ # session lock times out after (sec)
+ lock_timeout=10
+ </SessionCache>
+
+=head1 PARAMETERS
+
+=over
+
+=item redis (default: redis)
+
+Name of the database connection to use.
+
+You have to define this connection first.
+
+see L<Mail::MtPolicyd::Connection::Redis>
+
+=item expire (default: 5*60)
+
+Timeout in seconds for sessions.
+
+=item lock_wait (default: 50)
+
+Timeout for retry when session is locked in milliseconds.
+
+The retry will be done in multiples of this timeout.
+
+When set to 50 retry will be done in 50, 100, 150ms...
+
+=item lock_max_retry (default: 50)
+
+Maximum number of retries before giving up to obtain lock on a
+session.
+
+=item lock_timeout (default: 10)
+
+Timeout of session locks in seconds.
+
+=back
+
+=head1 AUTHOR
+
+Markus Benning <ich@markusbenning.de>
+
+=head1 COPYRIGHT AND LICENSE
+
+This software is Copyright (c) 2014 by Markus Benning <ich@markusbenning.de>.
+
+This is free software, licensed under:
+
+ The GNU General Public License, Version 2, June 1991
+
+=cut
|
[-]
[+]
|
Changed |
_service:download_files:Mail-MtPolicyd-2.02.tar.gz/lib/Mail/MtPolicyd/VirtualHost.pm
^
|
@@ -3,7 +3,7 @@
use Moose;
use namespace::autoclean;
-our $VERSION = '1.23'; # VERSION
+our $VERSION = '2.02'; # VERSION
# ABSTRACT: class for a VirtualHost instance
use Mail::MtPolicyd::PluginChain;
@@ -57,7 +57,7 @@
=head1 VERSION
-version 1.23
+version 2.02
=head1 AUTHOR
|
[-]
[+]
|
Changed |
_service:download_files:Mail-MtPolicyd-2.02.tar.gz/rpm/mtpolicyd.spec
^
|
@@ -1,7 +1,7 @@
%define module_name Mail-MtPolicyd
Name: mtpolicyd
-Version: 1.23
+Version: 2.02
Release: %(date +%Y%m%d)%{dist}
Summary: a modular policy daemon for postfix
@@ -98,6 +98,6 @@
%{_mandir}/man3/*
%changelog
-* Fri Mar 20 2015 Markus Benning <ich@markusbenning.de> 1.23
+* Fri Mar 20 2015 Markus Benning <ich@markusbenning.de> 2.02
- generate spec file from upstream release
|
[-]
[+]
|
Changed |
_service:download_files:Mail-MtPolicyd-2.02.tar.gz/t-data/minimal.conf
^
|
@@ -9,22 +9,16 @@
# timeout for processing of one request in seconds
request_timeout=20
-# database connection as perl-DBI DSN (man DBI)
-db_dsn=
-db_user=
-db_password=
+<Connection memcached>
+ module = "Memcached"
+ # memcached connection for session caching
+ servers="127.0.0.1:[% memcached_port %]"
+</Connection>
-# memcached connection for session caching
-memcached_servers="127.0.0.1:[% memcached_port %]"
-# memcached_namespace=mt-
-# memcached_expire=300
-
-# wait timeout will be increased each time 50,100,150,... (usec)
-session_lock_wait=50
-# abort after n retries
-session_lock_max_retry=50
-# session lock times out after (sec)
-session_lock_timeout=10
+<SessionCache>
+ module = "Memcached"
+ memcached = "memcached"
+</SessionCache>
<VirtualHost [% port %]>
name="minimal"
|
[-]
[+]
|
Changed |
_service:download_files:Mail-MtPolicyd-2.02.tar.gz/t/plugin-accounting-quota.t
^
|
@@ -8,7 +8,7 @@
use Test::MockObject;
use Mail::MtPolicyd::Request;
-use Mail::MtPolicyd::SqlConnection;
+use Mail::MtPolicyd::ConnectionPool;
use Mail::MtPolicyd::Plugin::Accounting;
use Mail::MtPolicyd::Plugin::Quota;
@@ -21,11 +21,12 @@
isa_ok($p, 'Mail::MtPolicyd::Plugin::Accounting');
# build a fake database with an in-memory SQLite DB
-Mail::MtPolicyd::SqlConnection->initialize(
- dsn => 'dbi:SQLite::memory:',
- user => '',
- password => '',
-);
+Mail::MtPolicyd::ConnectionPool->load_connection( 'db', {
+ module => 'Sql',
+ dsn => 'dbi:SQLite::memory:',
+ user => '',
+ password => '',
+} );
lives_ok {
$p->init();
@@ -58,7 +59,7 @@
sub cmp_table_numrows_ok {
my ( $table, $op, $rows, $desc ) = @_;
- my $dbh = Mail::MtPolicyd::SqlConnection->instance->dbh;
+ my $dbh = Mail::MtPolicyd::ConnectionPool->get_handle('db');
my $table_name = $dbh->quote_identifier( $table );
my $sql = "SELECT * FROM $table_name";
my $sth = $dbh->prepare( $sql );
@@ -69,7 +70,7 @@
sub cmp_table_value_ok {
my ( $table, $key, $field, $op, $count ) = @_;
- my $dbh = Mail::MtPolicyd::SqlConnection->instance->dbh;
+ my $dbh = Mail::MtPolicyd::ConnectionPool->get_handle('db');
my $table_name = $dbh->quote_identifier( $table );
my $field_name = $dbh->quote_identifier( $field );
|
[-]
[+]
|
Changed |
_service:download_files:Mail-MtPolicyd-2.02.tar.gz/t/plugin-condition.t
^
|
@@ -3,7 +3,7 @@
use strict;
use warnings;
-use Test::More tests => 14;
+use Test::More tests => 19;
use Test::Exception;
use Test::MockObject;
@@ -12,7 +12,7 @@
my $c = Mail::MtPolicyd::Plugin::Condition->new(
name => 'greylist',
- key => 'greylisting',
+ key => 's:greylisting',
match => 'on',
action => 'postgrey_users',
);
@@ -32,6 +32,7 @@
my $r = Mail::MtPolicyd::Request->new(
attributes => {
'instance' => 'abcd1234',
+ 'queue_id' => '4561B3D95D8B',
},
session => $session,
server => $server,
@@ -63,3 +64,19 @@
is( $result->action, 'zumsel', 'check result' );
is( $result->abort, 1, 'check result' );
+# use a request attribute
+$c = Mail::MtPolicyd::Plugin::Condition->new(
+ name => 'by_queueid',
+ key => 'r:queue_id',
+ match => '4561B3D95D8B',
+ action => 'reject',
+);
+lives_ok { ( $result ) = $c->run($r); } 'execute by_queueid request';
+isa_ok( $result, 'Mail::MtPolicyd::Plugin::Result', 'check must match' );
+is( $result->action, 'reject', 'check must return reject action' );
+
+# test invert option
+$c->invert(1);
+lives_ok { ( $result ) = $c->run($r); } 'execute by_queueid request';
+is( $result, undef, 'must not match when inverted' );
+
|
[-]
[+]
|
Changed |
_service:download_files:Mail-MtPolicyd-2.02.tar.gz/t/plugin-greylist.t
^
|
@@ -9,7 +9,7 @@
use Test::Memcached;
use Mail::MtPolicyd::Request;
-use Mail::MtPolicyd::SqlConnection;
+use Mail::MtPolicyd::ConnectionPool;
use Mail::MtPolicyd::Plugin::Greylist;
use Cache::Memcached;
@@ -22,14 +22,12 @@
plan tests => 79;
-my $memcached = Cache::Memcached->new(
- servers => [ '127.0.0.1:'.$mc_server->option('tcp_port') ],
- namespace => 'mt-test-',
- debug => 0,
-);
-
-
-isa_ok($memcached, 'Cache::Memcached');
+Mail::MtPolicyd::ConnectionPool->load_connection( 'memcached', {
+ module => 'Memcached',
+ servers => '127.0.0.1:'.$mc_server->option('tcp_port'),
+} );
+my $memcached = Mail::MtPolicyd::ConnectionPool->get_handle('memcached');
+isa_ok( $memcached, 'Cache::Memcached' );
my $p = Mail::MtPolicyd::Plugin::Greylist->new(
name => 'greylist-test',
@@ -38,11 +36,12 @@
isa_ok($p, 'Mail::MtPolicyd::Plugin::Greylist');
# build a fake database with an in-memory SQLite DB
-Mail::MtPolicyd::SqlConnection->initialize(
- dsn => 'dbi:SQLite::memory:',
- user => '',
- password => '',
-);
+Mail::MtPolicyd::ConnectionPool->load_connection( 'db', {
+ module => 'Sql',
+ dsn => 'dbi:SQLite::memory:',
+ user => '',
+ password => '',
+} );
lives_ok {
$p->init();
@@ -58,8 +57,6 @@
$server->mock( 'log',
sub { my ( $self, $level, $message ) = @_; print '# LOG('.$level.'): '.$message."\n" } );
-$server->mock( 'memcached', sub { return $memcached; } );
-
sub test_one_greylisting_circle {
my ( $sender, $client_address, $recipient, $r, $count ) = @_;
my $sender_domain = $p->_extract_sender_domain( $sender );
@@ -119,7 +116,7 @@
# now manipulate autowl to expire all records
lives_ok {
- Mail::MtPolicyd::SqlConnection->dbh->do(
+ Mail::MtPolicyd::ConnectionPool->get_handle('db')->do(
'UPDATE autowl SET last_seen=1;'
);
} 'manipulate autowl, expire';
|
[-]
[+]
|
Changed |
_service:download_files:Mail-MtPolicyd-2.02.tar.gz/t/plugin-ldapuserconfig.t
^
|
@@ -7,7 +7,7 @@
use Test::Exception;
use Test::MockObject;
-use Mail::MtPolicyd::LdapConnection;
+use Mail::MtPolicyd::ConnectionPool;
use Mail::MtPolicyd::Request;
use Mail::MtPolicyd::Plugin::LdapUserConfig;
@@ -28,15 +28,16 @@
};
# build a moch LdapConnection
-Mail::MtPolicyd::LdapConnection->initialize(
- host => 'dummy',
- port => 389,
- binddn => 'cn=readonly,dc=domain,dc=com',
- password => 'secret',
- starttls => 1,
- connection_class => 'Test::Net::LDAP::Mock',
-);
-my $ldap = Mail::MtPolicyd::LdapConnection->handle;
+Mail::MtPolicyd::ConnectionPool->load_connection('ldap', {
+ module => 'Ldap',
+ host => 'dummy',
+ port => 389,
+ binddn => 'cn=readonly,dc=domain,dc=com',
+ password => 'secret',
+ starttls => 1,
+ connection_class => 'Test::Net::LDAP::Mock',
+} );
+my $ldap = Mail::MtPolicyd::ConnectionPool->get_handle('ldap');
$ldap->add('uid=max,ou=users,dc=domain,dc=com', attrs => [
uid => 'max',
gn => 'Max',
|
[-]
[+]
|
Changed |
_service:download_files:Mail-MtPolicyd-2.02.tar.gz/t/plugin-role-sqlutils.t
^
|
@@ -6,7 +6,7 @@
use Test::More tests => 14;
use Test::Exception;
-use Mail::MtPolicyd::SqlConnection;
+use Mail::MtPolicyd::ConnectionPool;
package Mail::MtPolicyd::Plugin::TestSqlUtils;
@@ -14,6 +14,10 @@
use Moose;
extends 'Mail::MtPolicyd::Plugin';
+with 'Mail::MtPolicyd::Role::Connection' => {
+ name => 'db',
+ type => 'Sql',
+};
with 'Mail::MtPolicyd::Plugin::Role::SqlUtils';
package main;
@@ -25,14 +29,15 @@
);
isa_ok($sql, 'Mail::MtPolicyd::Plugin::TestSqlUtils');
-throws_ok { $sql->init(); } qr/no sql database initialized, but required for plugin sqlutils-test/, 'must die in init() when db unavailable';
+throws_ok { $sql->init(); } qr/no connection db configured!/, 'must die in init() when db unavailable';
# build a fake database with an in-memory SQLite DB
-Mail::MtPolicyd::SqlConnection->initialize(
- dsn => 'dbi:SQLite::memory:',
- user => '',
- password => '',
-);
+Mail::MtPolicyd::ConnectionPool->load_connection( 'db', {
+ module => 'Sql',
+ dsn => 'dbi:SQLite::memory:',
+ user => '',
+ password => '',
+} );
lives_ok { $sql->init(); } 'init() when db available';
|
[-]
[+]
|
Changed |
_service:download_files:Mail-MtPolicyd-2.02.tar.gz/t/plugin-sqllist.t
^
|
@@ -8,7 +8,7 @@
use Test::MockObject;
use Mail::MtPolicyd::Request;
-use Mail::MtPolicyd::SqlConnection;
+use Mail::MtPolicyd::ConnectionPool;
use Mail::MtPolicyd::Plugin::SqlList;
use DBI;
@@ -27,12 +27,13 @@
};
# build a fake database with an in-memory SQLite DB
-Mail::MtPolicyd::SqlConnection->initialize(
- dsn => 'dbi:SQLite::memory:',
- user => '',
- password => '',
-);
-my $dbh = Mail::MtPolicyd::SqlConnection->dbh;
+Mail::MtPolicyd::ConnectionPool->load_connection( 'db', {
+ module => 'Sql',
+ dsn => 'dbi:SQLite::memory:',
+ user => '',
+ password => '',
+} );
+my $dbh = Mail::MtPolicyd::ConnectionPool->get_handle('db');
$dbh->do(
'CREATE TABLE `list` (
`id` INTEGER PRIMARY KEY AUTOINCREMENT,
|
[-]
[+]
|
Changed |
_service:download_files:Mail-MtPolicyd-2.02.tar.gz/t/plugin-sqluserconfig.t
^
|
@@ -7,7 +7,7 @@
use Test::Exception;
use Test::MockObject;
-use Mail::MtPolicyd::SqlConnection;
+use Mail::MtPolicyd::ConnectionPool;
use Mail::MtPolicyd::Request;
use Mail::MtPolicyd::Plugin::SqlUserConfig;
@@ -25,12 +25,13 @@
};
# build a fake database with an in-memory SQLite DB
-Mail::MtPolicyd::SqlConnection->initialize(
- dsn => 'dbi:SQLite::memory:',
- user => '',
- password => '',
-);
-my $dbh = Mail::MtPolicyd::SqlConnection->dbh;
+Mail::MtPolicyd::ConnectionPool->load_connection( 'db', {
+ module => 'Sql',
+ dsn => 'dbi:SQLite::memory:',
+ user => '',
+ password => '',
+} );
+my $dbh = Mail::MtPolicyd::ConnectionPool->get_handle('db');
$dbh->do(
'CREATE TABLE `user_config` (
`id` INTEGER PRIMARY KEY AUTOINCREMENT,
|
[-]
[+]
|
Changed |
_service:download_files:Mail-MtPolicyd-2.02.tar.gz/t/request.t
^
|
@@ -3,12 +3,15 @@
use strict;
use warnings;
-use Test::More tests => 4;
+use Test::More tests => 9;
use Test::MockObject;
use Mail::MtPolicyd::Request;
-my $session = { '_instance' => 'abcd1234' };
+my $session = {
+ '_instance' => 'abcd1234',
+ 'user_policy' => 'kaffee-filter',
+};
my $server = Test::MockObject->new;
$server->set_isa('Net::Server');
@@ -40,3 +43,10 @@
can_ok($r, 'log', 'new_from_fh');
+# retrieve variables with different supported syntax
+cmp_ok( $r->get('request:queue_id'), 'eq', '8045F2AB23', 'must be able to retrieve request request:queue_id');
+cmp_ok( $r->get('r:queue_id'), 'eq', '8045F2AB23', 'must be able to retrieve request r:queue_id');
+cmp_ok( $r->get('queue_id'), 'eq', '8045F2AB23', 'must be able to retrieve request queue_id');
+cmp_ok( $r->get('session:user_policy'), 'eq', 'kaffee-filter', 'session variable session:user_policy');
+cmp_ok( $r->get('s:user_policy'), 'eq', 'kaffee-filter', 'session variable s:user_policy');
+
|
[-]
[+]
|
Changed |
_service:download_files:Mail-MtPolicyd-2.02.tar.gz/t/server-minimal.feature
^
|
@@ -8,3 +8,4 @@
client_address=84.204.103.98
"""
Then mtpolicyd must respond with a action like ^reject test
+ And the mtpolicyd server must be stopped successfull
|
[-]
[+]
|
Changed |
_service:download_files:Mail-MtPolicyd-2.02.tar.gz/t/server-spamhaus-rbls.feature
^
|
@@ -51,4 +51,5 @@
helo_name=mail.dbltest.com
"""
Then mtpolicyd must respond with a action like ^reject DBL helo_name
+ And the mtpolicyd server must be stopped successfull
|
[-]
[+]
|
Changed |
_service:download_files:Mail-MtPolicyd-2.02.tar.gz/t/server-vhost-by-policy-context.feature
^
|
@@ -9,6 +9,7 @@
policy_context=fred
"""
Then mtpolicyd must respond with a action like ^reject my name is fred
+ And the mtpolicyd server must be stopped successfull
Scenario: mtpolicyd must select the correct vhost (horst)
Given that a mtpolicyd is running with configuration t-data/vhost-by-policy-context.conf
@@ -17,6 +18,7 @@
policy_context=horst
"""
Then mtpolicyd must respond with a action like ^reject my name is horst
+ And the mtpolicyd server must be stopped successfull
Scenario: mtpolicyd must select the correct vhost (default is fred)
Given that a mtpolicyd is running with configuration t-data/vhost-by-policy-context.conf
@@ -25,3 +27,5 @@
client_address=127.0.0.1
"""
Then mtpolicyd must respond with a action like ^reject my name is fred
+ And the mtpolicyd server must be stopped successfull
+
|
[-]
[+]
|
Added |
_service:download_files:Mail-MtPolicyd-2.02.tar.gz/t/session-cache.t
^
|
@@ -0,0 +1,141 @@
+#!perl
+
+use strict;
+use warnings;
+
+use Test::More tests => 5;
+use Test::MockObject;
+use Mail::MtPolicyd::ConnectionPool;
+use Test::Memcached;
+use Test::RedisDB;
+use Test::Exception;
+use String::Random;
+use Test::Deep;
+
+use_ok('Mail::MtPolicyd::SessionCache');
+
+my $server = Test::MockObject->new;
+$server->set_isa('Net::Server');
+$server->mock( 'log',
+ sub { my ( $self, $level, $message ) = @_; print '# LOG('.$level.'): '.$message."\n" } );
+
+my $cache = Mail::MtPolicyd::SessionCache->new(
+ server => $server,
+);
+isa_ok( $cache, 'Mail::MtPolicyd::SessionCache', 'initialize session cache');
+
+sub cache_basics_ok {
+ my ( $cache ) = @_;
+ my $instance = 'abcd1234';
+
+ isa_ok( $cache->server, 'Net::Server');
+ isa_ok( $cache->cache, 'Mail::MtPolicyd::SessionCache::Base');
+
+ can_ok( $cache,
+ 'retrieve_session',
+ 'store_session',
+ 'shutdown',
+ 'load_config',
+ );
+
+ lives_ok {
+ $cache->store_session( {
+ _instance => $instance,
+ test => 'bla',
+ } );
+ } 'call store_session must succeed';
+
+ lives_ok {
+ $cache->retrieve_session( $instance );
+ } 'call retrieve_session must succeed';
+}
+
+sub cache_store_retrieve_ok {
+ my ( $cache ) = @_;
+ my $rand = String::Random->new;
+
+ foreach (1..10) {
+ my $instance = $rand->randpattern('ssssssss');
+ my $session;
+ my $session_retrieved;
+ lives_ok {
+ $session = $cache->retrieve_session( $instance );
+ } 'must be able to retrieve a session';
+ $session->{'data'} = $rand->randpattern('CCCCCCCCCC');
+ lives_ok {
+ $cache->store_session( $session );
+ } 'must be able to store the session';
+ lives_ok {
+ $session_retrieved = $cache->retrieve_session( $instance );
+ } 'must be able to retrieve the session again';
+ cmp_deeply( $session, $session_retrieved, 'stored and retrieved session must match');
+ }
+}
+
+sub cache_locking_ok {
+ my ( $cache ) = @_;
+ my $rand = String::Random->new;
+ my $instance = $rand->randpattern('ssssssss');
+ my $session;
+
+ lives_ok {
+ $session = $cache->retrieve_session( $instance );
+ } 'must be able to retrieve a session';
+ throws_ok {
+ $session = $cache->retrieve_session( $instance );
+ } qr/could not acquire lock for session/, 'session must be locked';
+}
+
+subtest 'test session cache None', sub {
+ cache_basics_ok( $cache );
+};
+
+subtest 'test session cache Memcached', sub {
+ diag('trying to start mock memcached...');
+ my $mc_server = Test::Memcached->new
+ or plan skip_all => 'could not start memcached (not installed?), skipping test...';
+ $mc_server->start;
+
+ Mail::MtPolicyd::ConnectionPool->load_connection( 'memcached', {
+ module => 'Memcached',
+ servers => '127.0.0.1:'.$mc_server->option('tcp_port'),
+ } );
+
+ lives_ok {
+ $cache->load_config( {
+ module => 'Memcached',
+ memcached => 'memcached',
+ } );
+ } 'load session cache memcached config';
+
+ cache_basics_ok( $cache );
+ cache_store_retrieve_ok( $cache );
+ cache_locking_ok( $cache );
+
+ $mc_server->stop;
+};
+
+subtest 'test session cache Redis', sub {
+ diag('trying to start mock redis...');
+ my $redis = Test::RedisDB->new
+ or plan skip_all => 'could not start redis (not installed?), skipping test...';
+
+ Mail::MtPolicyd::ConnectionPool->load_connection( 'redis', {
+ module => 'Redis',
+ servers => '127.0.0.1:'.$redis->port,
+ } );
+
+ lives_ok {
+ $cache->load_config( {
+ module => 'Redis',
+ redis => 'redis',
+ } );
+ } 'load session cache redis config';
+
+ cache_basics_ok( $cache );
+ cache_store_retrieve_ok( $cache );
+ cache_locking_ok( $cache );
+
+ $redis->stop;
+};
+
|
[-]
[+]
|
Changed |
_service:download_files:Mail-MtPolicyd-2.02.tar.gz/t/step_definitions/00test-net-server_steps.pl
^
|
@@ -6,6 +6,7 @@
package Test::Net::Server;
use Test::More;
+use Test::Exception;
use File::Temp;
use IO::File;
use POSIX;
@@ -156,22 +157,41 @@
$self->generate_config;
eval "require $class";
+ if( $@ ) {
+ fail('could not load server class: '.$@);
+ return;
+ }
- my $server = "$class"->new(
- config_file => $self->tmp_config_file,
- log_file => $self->log_file,
- pid_file => $self->pid_file,
- port => $self->port,
- user => getuid(),
- group => getgid(),
- log_level => $self->log_level,
- );
- if( fork == 0 ) {
- open my $log_fh, '>>', $self->log_file
- or die('could no open log_file: '.$@);
- *STDOUT = $log_fh;
- *STDERR = $log_fh;
- $server->run;
+ my $server;
+ lives_ok {
+ $server = "$class"->new(
+ config_file => $self->tmp_config_file,
+ log_file => $self->log_file,
+ pid_file => $self->pid_file,
+ port => $self->port,
+ user => getuid(),
+ group => getgid(),
+ log_level => $self->log_level,
+ background => undef,
+ setsid => undef,
+ );
+ } 'creation of server object';
+ my $pid = fork;
+ if( ! defined $pid ) {
+ fail('failed to fork');
+ return;
+ }
+ if( $pid == 0 ) {
+ diag('child process running with pid '.$$);
+ if( open my $log_fh, '>>', $self->log_file ) {
+ *STDOUT = $log_fh;
+ *STDERR = $log_fh;
+ } else {
+ fail('could no open log_file: '.$@);
+ exit 1;
+ }
+ eval { $server->run; };
+ exit 0;
}
pass('started server '.$self->class.' on port '.$self->port);
@@ -190,7 +210,7 @@
return;
}
-sub DESTROY {
+sub shutdown {
my $self = shift;
my $pid = $self->pid;
if( defined $pid ) {
|
[-]
[+]
|
Changed |
_service:download_files:Mail-MtPolicyd-2.02.tar.gz/t/step_definitions/mtpolicyd_run_steps.pl
^
|
@@ -5,18 +5,39 @@
use Test::More;
use Test::Memcached;
+use Test::Exception;
Given qr/that a mtpolicyd is running with configuration (\S+)/, sub {
- my $mc = Test::Memcached->new
- or die('could not start memcached. (is it installed?)');
- $mc->start;
- my $server = Test::Net::Server->new(
- class => 'Mail::MtPolicyd',
- config_file => $1,
- memcached_port => $mc->option( 'tcp_port' ),
- );
- $server->run;
+ my $mc;
+ lives_ok {
+ $mc = Test::Memcached->new;
+ } 'initialization of Test::Memcached object';
+ if( ! defined $mc ) {
+ fail('could not start memcached. (is it installed?)');
+ return;
+ }
+ isa_ok($mc, 'Test::Memcached');
+ lives_ok {
+ $mc->start;
+ } 'startup of memcached';
+ my $server;
+ lives_ok {
+ $server = Test::Net::Server->new(
+ class => 'Mail::MtPolicyd',
+ config_file => $1,
+ memcached_port => $mc->option( 'tcp_port' ),
+ );
+ } 'creation of server object muss succeed';
+ isa_ok($server, 'Test::Net::Server');
+ lives_ok {
+ $server->run;
+ } 'startup of mtpolicyd test server';
S->{'server'} = $server;
S->{'memcached'} = $mc;
-}
+};
+
+Then qr/the mtpolicyd server must be stopped successfull/, sub {
+ my $server = S->{'server'};
+ $server->shutdown;
+};
|