NAME
Mail::MtPolicyd::Plugin::SqlUserConfig - mtpolicyd plugin for retrieving the user config of a user
VERSION
version 2.05
DESCRIPTION
This plugin will retrieve a JSON string from an SQL database and will merge the data structure into the current session.
This could be used to retrieve configuration values for users from a database.
PARAMETERS
- sql_query (default: SELECT config FROM user_config WHERE address=?)
-
The SQL query to retrieve the JSON configuration string.
The content of the first row/column is used.
- field (default: recipient)
-
The request field used in the sql query to retrieve the user configuration.
EXAMPLE USER SPECIFIC GREYLISTING
Create the following table in the SQL database:
CREATE TABLE `user_config` (`id` int(11) NOT NULL AUTO_INCREMENT,`address` varchar(255) DEFAULT NULL,`config` TEXT NOT NULL,PRIMARY KEY (`id`),UNIQUE KEY `address` (`address`)) ENGINE=MyISAM DEFAULT CHARSET=latin1INSERT INTO TABLE `user_config` VALUES( NULL, '[email protected]', '{"greylisting":"on"}' );
In mtpolicyd.conf:
db_dsn="dbi:mysql:mail"db_user=maildb_password=password<Plugin user-config>module = "SqlUserConfig"sql_query = "SELECT config FROM user_config WHERE address=?"</Plugin><Plugin greylist>enabled = "off" # off by defaultuc_enabled = "greylisting" # override with value of key 'greylisting' is set in sessionmodule = "Greylist"score = -5mode = "passive"</Plugin>
AUTHOR
Markus Benning <[email protected]>
COPYRIGHT AND LICENSE
This software is Copyright (c) 2014 by Markus Benning <[email protected]>.
This is free software, licensed under:
The GNU General Public License, Version 2, June 1991