Mail::...qlList(3pm)
π Mail::...qlList β the mtpolicyd SQL list plugin π
okay bestie, sit down, hydrate, because we're talking about Mail::MtPolicyd::Plugin::SqlList β the mtpolicyd plugin for accessing a SQL white/black/access list. it's giving gatekeeper. it's giving bouncer-at-the-club-but-in-SQL. no cap. π
it's a User Contributed Perl Documentation page, and honestly? iconic of her.
β¨ VERSION β¨
version 2.05 β she's been through some things and she's thriving π
πΈ SYNOPSIS πΈ
here's the vibe, verbatim, don't touch a single character:
<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>
see how one of them is nice (dunno) and one of them is mean (reject you are blacklisted!)? that's range. that's main character energy. π
π¦ DESCRIPTION π¦
so what does this plugin actually DO? it checks a field against a SQL table/query. that's it. that's the whole job. π₯
and depending on whether a supplied SQL query matched, actions can be taken. so like β matched? something happens. didn't match? something else happens. the drama is entirely configurable. π«Ά
π PARAMETERS π
the module takes the following parameters, and yes we're listing ALL of them, bestie, every single one, no skipping:
(uc_)enabled(default:"on") β could be set to'off'to deactivate the check. could be used to activate/deactivate the check per user. it's giving β¨ selective attention β¨.sql_query(default:"SELECT client_ip FROM whitelist WHERE client_ip=INET_ATON(?)") β the prepared SQL statement to use for checking an IP address.- the
?will be replaced by the IP address. literally, that's the whole substitution situation. - the module will match if the statement returns one or more rows. one row? matched. fifty rows? matched. zero rows? not matched, sorry babes. π
- the
lowkey important: by default the plugin will do nothing. NOTHING. she's just standing there. one of the following actions should be specified, otherwise what are we even doing here π
so, pick your fighter:
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 match. yes, the capitalization of DID NOT is the original's, and honestly? valid. it's giving emphasis.score(default: empty) β if given, this score will be applied to the session. points. on the board. πfield(default:client_address) β the field the query parameter will be taken from. that's where we're pulling the value from, bestie. π
π EXAMPLE WITH A MYSQL TABLE π
you may use the following table for storing IPv4 addresses in MySQL. here it is, exact, do not improvise:
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'));
look at that UNIQUE KEY on client_ip. she said no duplicates in THIS house. π
and then you use it as a whitelist in mtpolicyd like so:
<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>
see the ... at the end? that's not me being lazy, that's the original being mysterious. the manpage is keeping secrets. respect it. π
π AUTHOR π
Markus Benning <ich@markusbenning.de> β the author. the originator. the moment. π
π 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
free software, GPL v2, June 1991 β a classic, a legend, an elder stateswoman of licensing. πΈ
and that's the whole page, bestie!! π₯° this was Mail::...qlList(3pm), page rendered with perl v5.38.2 on 2024-05-26 β mwah, go configure your whitelist, you absolute icon πβ¨π¦
π¦ where this page comes from
- debian trixie: mtpolicyd 2.05-1.2 Β· GPL-2.0-only
- ubuntu questing: mtpolicyd 2.05-1.2
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms