This matcher makes it possible to combine the results of several
matchers using logical operations. CombineMatcher uses
prefix-notation in its expressions and uses the following format:
the operand, a comma, first argument, a comma, second argument.
For example, an AND expression should be formatted the following
way: (V_AND, matcher1, matcher2).
Expressions using more than one operands should be bracketed, e.g.,
(V_OR (V_AND, matcher1, matcher2), matcher3).
The following operations are available:
V_AND : Logical AND operation.
V_OR : Logical OR operation.
V_XOR : Logical XOR operation.
V_NOT : Logical negation.
V_EQ : Logical equation.
| Example 5.21. Whitelisting e-mail recipients |
|---|
|
A simple use for CombineMatcher is to filter the recipients of e-mail addresses using the following process:
Python:
class SmtpRecipientMatcherProxy(SmtpProxy):
recipient_matcher="SmtpCombineMatcher"
def config(self):
super(SmtpRecipientMatcherProxy, self).config()
MatcherPolicy(name="SmtpCombineMatcher", matcher=CombineMatcher (expr=(V_AND, "SmtpCheckrecipient", "SmtpWhitelist")))
MatcherPolicy(name="SmtpWhitelist", matcher=RegexpMatcher (match_list=("info@example.com",), ignore_list=None))
MatcherPolicy(name="SmtpCheckrecipient", matcher=SmtpInvalidRecipientMatcher (server_port=25, cache_timeout=60, force_delivery_attempt=FALSE, server_name="recipientcheck.example.com"))
|
Copyright: © 2021 Balasys IT Security
Send your comments to support@balasys.hu


