Mail::...dition(3pm)
π Mail::MtPolicyd::Plugin::Condition β the mtpolicyd condition queen π
okay bestie, sit down, hydrate, because we're talking about Mail::MtPolicyd::Plugin::Condition, a mtpolicyd plugin that handles conditions based on session values. she's giving gatekeeper energy and honestly? she ate. π
β¨ VERSION β¨
version 2.05 π
πΈ DESCRIPTION πΈ
she will return an action, a score, or execute further plugins β but ONLY if the specified condition matched. no match, no vibes. it's giving conditional. π¦
π PARAMETERS π
π key (required)
the name of the variable to check, bestie. non-negotiable.
the syntax is literally:
(<scope>:)?<variable-name>
if no scope is given, it defaults to request. no scope? no problem, she picks for you. π«Ά
possible scopes are:
session,sβ session variables.request,rβ request attribute variables.
examples, because we love a visual:
session:user_policy
s:user_policy
request:queue_id
r:queue_id
queue_id
at least one of the following parameters should be given, or your condition will never match. like, ever. tragic. π
match(default:empty) β simple string equal match. she's basic but she works.re_match(default:empty) β match the content of the session variable against an regex.lt_match(default:empty) β match if numerical less than.gt_match(default:empty) β match if numerical greater than.invert(default:0) β if set to1the logic will be inverted. flip the script, periodt. π
finally, an action must be specified. it's not optional, it's the moment.
first the score will be applied, then the action will be executed β or, if specified, additional plugins will be executed.
action(default:empty) β the action to return when the condition matched.score(default:empty) β the score to add if the condition matched.Plugin(default:empty) β execute this plugins when the condition matched.
note the capitalPonPlugin, bestie. it'sPlugin, notplugin. iykyk. π
π EXAMPLE: use of postfix policy_context π
the policy_context of postfix could be used to trigger checks in mtpolicyd. main character feature, honestly.
to activate additional checks in mtpolicyd from within postfix you may use a configuration in postfix main.cf like:
# check, no additional checks
check_policy_service inet:localhost:12345
...
# check with additional checks!
check_policy_service { inet:localhost:12345, policy_context=strict_checks }
in mtpolicyd.conf:
<Plugin if-strict-checks>
module = "Condition"
key = "policy_context"
match = "strict_checks"
<Plugin strict-check>
# ...
</Plugin>
# more checks ...
</Plugin>
the policy_context feature will be available in postfix 3.1 and later. so if you're on anything olderβ¦ thoughts and prayers. π―οΈ
if you need completely different checks, consider using the vhost_by_policy_context (mtpolicyd) option with different virtual hosts. different vhost, different vibe. β¨
π¦ EXAMPLE: execute postgrey action in postfix π¦
if the session variable "greylisting" is "on", return the postfix action "postgrey":
<Plugin trigger-greylisting>
module = "Condition"
key = "greylisting"
match = "on"
action = "postgrey"
</Plugin>
the variable may be set by a UserConfig module like SqlUserConfig. slay. π
the postgrey action in postfix may look like:
smtpd_restriction_classes = postgrey
postgrey = check_policy_service inet:127.0.0.1:11023
π 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
and that's the whole page, bestie!! π«Ά this was Mail::...dition(3pm), rendered by perl v5.38.2 on 2024-05-26. go forth and match some conditions, 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