-
-
24 Aug 2020 14:36:28 UTC
- Distribution: Mail-MtPolicyd
- Module version: 2.05
- Source (raw)
- Browse (raw)
- Changes
- How to Contribute
- Repository
- Issues (0)
- Testers
- Kwalitee
Bus factor: 1- % Coverage
- License: gpl_2
- Perl: v5.8.5
- Activity
24 month- Tools
- Download (94.86KB)
- MetaCPAN Explorer
- Permissions
- Subscribe to distribution
- Permalinks
- This version
- Latest version
and 1 contributors-
Markus Benning
- Dependencies
- BerkeleyDB
- BerkeleyDB::Hash
- Cache::Memcached
- Config::General
- DBI
- Data::Dumper
- File::Slurp
- Geo::IP
- Getopt::Long
- HTTP::Request::Common
- IO::Handle
- IO::Socket::INET
- IO::Socket::UNIX
- JSON
- LWP::UserAgent
- Mail::RBL
- Mail::SPF
- Moose
- Moose::Role
- Moose::Util::TypeConstraints
- MooseX::Getopt
- MooseX::Role::Parameterized
- MooseX::Singleton
- Net::DNS::Resolver
- Net::LDAP
- Net::LDAP::Util
- Net::SMTP::Verify
- Net::Server::PreFork
- NetAddr::IP
- Redis
- Storable
- Tie::IxHash
- Time::HiRes
- Time::Piece
- Time::Seconds
- namespace::autoclean
- strict
- Reverse dependencies
- CPAN Testers List
- Dependency graph
NAME
Mail::MtPolicyd::Plugin::SqlList - mtpolicyd plugin for accessing a SQL white/black/access list
VERSION
version 2.05
SYNOPSIS
<Plugin whitelist> module="SqlList" sql_query="SELECT client_ip FROM whitelist WHERE client_ip=?" match_action=dunno </Plugin> <Plugin blacklist> module="SqlList" sql_query="SELECT client_ip FROM blacklist WHERE client_ip=?" match_action="reject you are blacklisted!" </Plugin>
DESCRIPTION
Plugin checks a field against a SQL table/query.
Depending on whether a supplied SQL query matched actions can be taken.
PARAMETERS
The module takes the following parameters:
- (uc_)enabled (default: "on")
-
Could be set to 'off' to deactivate check. Could be used to activate/deactivate check per user.
- sql_query (default: "SELECT client_ip FROM whitelist WHERE client_ip=INET_ATON(?)")
-
Prepared SQL statement to use for checking an IP address.
? will be replaced by the IP address.
The module will match if the statement returns one or more rows.
By default the plugin will do nothing. One of the following actions should be specified:
- match_action (default: empty)
-
If given this action will be returned to the MTA if the SQL query matched.
- not_match_action (default: empty)
-
If given this action will be returned to the MTA if the SQL query DID NOT matched.
- score (default: empty)
-
If given this score will be applied to the session.
- field (default: client_address)
-
The field the query parameter will be taken from.
EXAMPLE WITH A MYSQL TABLE
You may use the following table for storing IPv4 addresses in MySQL:
CREATE TABLE `whitelist` ( `id` int(11) NOT NULL AUTO_INCREMENT, `client_ip` INT UNSIGNED NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `client_ip` (`client_ip`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO whitelist VALUES(NULL, INET_ATON('127.0.0.1'));
And use it as a whitelist in mtpolicyd:
<VirtualHost 12345> name="reputation" <Plugin whitelist> module="SqlList" sql_query="SELECT client_ip FROM whitelist WHERE client_ip=INET_ATON(?)" match_action="dunno" </Plugin> <Plugin trigger-greylisting> ... </VirtualHost>
AUTHOR
Markus Benning <ich@markusbenning.de>
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
Module Install Instructions
To install Mail::MtPolicyd, copy and paste the appropriate command in to your terminal.
cpanm Mail::MtPolicyd
perl -MCPAN -e shell install Mail::MtPolicyd
For more information on module installation, please visit the detailed CPAN module installation guide.