DOKK / manpages / debian 12 / mtpolicyd / Mail::MtPolicyd::Plugin::SqlUserConfig.3pm.en
Mail::MtPolicyd::Plugin::SqlUserConfig(3pm) User Contributed Perl Documentation Mail::MtPolicyd::Plugin::SqlUserConfig(3pm)

Mail::MtPolicyd::Plugin::SqlUserConfig - mtpolicyd plugin for retrieving the user config of a user

version 2.05

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.

The SQL query to retrieve the JSON configuration string.

The content of the first row/column is used.

The request field used in the sql query to retrieve the user configuration.

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>

Markus Benning <ich@markusbenning.de>

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
2022-10-15 perl v5.34.0