table of contents
| Mail::MtPolicyd::Plugin::SqlUserConfig(3pm) | User Contributed Perl Documentation | Mail::MtPolicyd::Plugin::SqlUserConfig(3pm) |
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=latin1
INSERT INTO TABLE `user_config` VALUES( NULL, 'karlson@vomdach.de', '{"greylisting":"on"}' );
In mtpolicyd.conf:
db_dsn="dbi:mysql:mail"
db_user=mail
db_password=password
<Plugin user-config>
module = "SqlUserConfig"
sql_query = "SELECT config FROM user_config WHERE address=?"
</Plugin>
<Plugin greylist>
enabled = "off" # off by default
uc_enabled = "greylisting" # override with value of key 'greylisting' is set in session
module = "Greylist"
score = -5
mode = "passive"
</Plugin>
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
| 2024-05-26 | perl v5.38.2 |