6.7.9.7. Using matcher classes in proxy classes

To actually use the defined matchers, they have to be specified in the proper attributes of the particular proxy class. The proxy classes can use matchers for a variety of tasks. The matchers to be used by the particular proxy class can be added as Changed class attributes.

Using matchers in proxy classes

Figure 6.73. Using matchers in proxy classes

For example, SmtpProxy can use three different matchers: one to check the relayed domains (for example, using a RegexpMatcher), and two SmptInvalidMatchers (one for sender, one for the recipient address verification). For the details of the matchers usable by a given proxy class see the attributes of the class in Chapter 4, Proxies in Proxedo Network Security Suite 2 Reference Guide.

Example 6.15. SmtpProxy class using a matcher for controlling relayed zones
Python:
class SmtpMatcherProxy(SmtpProxy):
  relay_domains_matcher="Smtpdomains"
  def config(self):
    SmtpProxy.config(self)

MatcherPolicy(name="Smtpdomains", matcher=RegexpMatcher(match_list=("example.com",),\
 ignore_list=None))