Mail::...tRegex(3pm)
π Mail::Milter::Module::ConnectRegex β the manual, but make it make sense π
okay bestie, welcome to the Mail::Milter::Module::ConnectRegex page, straight out of the User Contributed Perl Documentation pile. the header up top is a little truncated situation (it literally says Mail::...tRegex(3pm), no cap), but we all know who she is. let's get into it. π¦
β¨ NAME β¨
Mail::Milter::Module::ConnectRegex β a milter that accepts or rejects connecting hosts when they match your regex(es). she's giving gatekeeper. π
πΈ SYNOPSIS πΈ
use Mail::Milter::Module::ConnectRegex;
my $milter = new Mail::Milter::Module::ConnectRegex('^foo$');
my $milter2 = &ConnectRegex(qw{^foo$ ^bar$}); # convenience
$milter2->set_message('Connections from %H disallowed');
π DESCRIPTION π
so basically: this milter module rejects any connecting host whose hostname or IP address matches the regular expressions you hand her. she's very picky. very discerning. very "you're not on the list". π«
and plot twist β she can also serve as a whitelisting Chain element instead, so she's not just a hater, she's flexible. see accept_match() below for that whole situation. π
π METHODS π
β new(REGEX[, ...])
takes one or more regular expressions, either as plain strings or as qr// precompiled regexes. she tests them in sequence, and the first match terminates checking β no second chances, no do-overs, periodt.
β οΈ important bestie note: all IP address literals get wrapped in [square brackets]. so if you wanna test an IP address instead of a hostname, you gotta make sure those brackets are actually there:
^\[ADDRESS\]$
π¦ accept_match(FLAG)
- if FLAG is
0(which is the default), a matching regex means the connection gets rejected. bye. π - if FLAG is
1, a matching regex makes this module returnSMFIS_ACCEPTinstead. this is the glow-up that lets aConnectRegexlive inside aMail::Milter::Chaincontainer (inaccept_break(1)mode) and function as a whitelist rather than a blacklist. she's on your side now. π«Ά
this method returns a reference to the object itself, so you can chain the method calls together. so convenient of her. β¨
π set_message(MESSAGE)
sets the message used when rejecting connections. this string may contain the substring %H, which gets replaced by the matching hostname or IP address. very personalized. very bespoke. π
this method also returns a reference to the object itself, so yes, chaining again. she loves a chain. βοΈβ¨
π BUGS π
in Sendmail 8.11 and 8.12, a milter rejection at the connect stage does not allow the reply message to be set β it just becomes "not accepting messages". tragic. but this module still attempts to set the reply code and message anyway, in the hope that this will be fixed someday. she's manifesting. πβ¨
π AUTHOR π
Todd Vierling, <tv@duh.org> <tv@pobox.com>
π SEE ALSO π
Mail::Milter::Object
π POD ERRORS π
hey! the above document had some coding errors, which are explained below:
Around line 71:
You can't have =items (as at line 83) unless the first thing after the =over is an =item
(not me snitching on the pod, but okay, we report the errors around here. π)
and that's the whole page, bestie! this was perl v5.36.0, dated 2023-01-22, and the footer was out here calling her Mail::...tRegex(3pm) one more time for the road. mwah. π
πβ¨
π¦ where this page comes from
- debian bookworm: libmail-milter-perl 0.07-2 Β· BSD-3-Clause
- ubuntu noble: libmail-milter-perl 0.07-2 Β· BSD-3-Clause
- ubuntu resolute: libmail-milter-perl 0.07-2 Β· BSD-3-Clause
- ubuntu stonking: libmail-milter-perl 0.07-2 Β· BSD-3-Clause
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms