plugin-check-helo.so

A mailfront plugin to provide an ability to reject, defer or add it's HELO
name checking results to message header.

Reference:
http://www.linuxmagic.com/best_practices/valid_helo_domain.html

This plugin checks sequence:

(1).  If $HELO_CHECK_SKIP is set, this plugin will be skipped.

(2).  If $RELAYCLIENT is set, add to message header and skip the remaining
      checks.  Example of message header added:

      X-HELO-Check-Result: SKIPPED: $RELAYCLIENT is set for 1.2.3.4

(3).  If sender is authenticated, add to message header and skip the
      remaining checks.  Example of message header added:

      X-HELO-Check-Result: SKIPPED: authenticated user from 1.2.3.4

(4).  If $RBLSMTPD is set and empty, add to message header and skip the
      remaining checks.

(5).  Check HELO name for the following:
      (5.1).  Cannot starts with ".", "[" and "-"
      (5.2).  Cannot ends with ".", "]" and "-"
      (5.3).  Must have at least a "." (dot)
      (5.4).  Cannot have any of the following characters besides TAB
              and SPACE:
                  ~!@#$%^&*()_+={}[]:;"'<>,?/|
      (5.5).  Cannot use a valid IPv4 or IPv6 address
      NOTE: If any of the above checks failed, the remaining checks will
      be skipped.
      (Refer to $HELO_CHECK_ADD_HEADER, $HELO_CHECK_DEFER and
      $HELO_CHECK_REJECT)
      Example of message header added:

      X-HELO-Check-Result: FAILED
      X-HELO-Check-Summary: '.' found in last character of HELO name sender_set_HELO_name

(6).  Do a DNS A record or AAAA record lookup for HELO name according to
      ${PROTO}REMOTEIP. If the DNS lookup failed will skip all remaining checks
      and add to message header or defer or reject.
      (Refer to $HELO_CHECK_ADD_HEADER, $HELO_CHECK_DEFER and
      $HELO_CHECK_REJECT)

      If $HELO_CHECK_ADD_HEADER is set will add the check to message header.
      ($HELO_CHECK_REJECT and $HELO_CHECK_DEFER not set)
      Example of message header added:

      X-HELO-Check-Result: FAILED
      X-HELO-Check-Summary: HELO name sender_set_HELO_name DNS A record lookup failed

(7).  If $HELO_CHECK_MATCH_IP is set, this plugin will check whether
      ${PROTO}REMOTEIP and HELO name IP are the same. If this check failed will
      skip all remaining checks and add to message header or defer or reject
      accordingly.

      If $HELO_CHECK_ADD_HEADER is set will add the check to message header.
      ($HELO_CHECK_REJECT and $HELO_CHECK_DEFER not set)
      Example of message header added:

      X-HELO-Check-Result: FAILED
      X-HELO-Check-Summary: Sorry, your HELO name IPv4 doesn't resolve to match your IPv4.

(8).  If $HELO_CHECK_MATCH_IP_CLASS is set, this plugin will check whether
      ${PROTO}REMOTEIP and HELO name IP are in the same IP class. If this check
      failed will skip all remaining checks and add to message header or defer
      or reject accordingly.

      If $HELO_CHECK_ADD_HEADER is set will add the check to message header.
      ($HELO_CHECK_REJECT and $HELO_CHECK_DEFER not set)
      Example of message header added:

      X-HELO-Check-Result: FAILED
      X-HELO-Check-Summary: Sorry, your HELO name IPv4 doesn't resolve to match your IPv4 class.

(9).  If all checks pass and $HELO_CHECK_ADD_HEADER is set will add the check
      to message header.

      Example of message header added:

      X-HELO-Check-Result: PASSED
      X-HELO-Check-Summary: HELO name sender_HELO_name from REMOTEIP 1.2.3.4 is valid.

(10). If $HELO_CHECK_VERBOSE is set, this plugin will log all its checking
      to stderr.


Requirements:

- mailfront version 2.22 or later (might work with earlier version)
- bglibs version 2.04 or later (might work with earlier version)

Installation:

- Build and install mailfront
- Switch back to this package
- Adjust the contents of the conf-* files
- Build the sources by running "make"
- Install the plugin by running "make install"


Configuration:

Place check-helo in mailfront's plugin list. Depending on your setup
- edit the smtpfront-qmail shell script and place the string "check-helo"
  after "add-received"
- edit the PLUGINS environment variable and place the string "check-helo"
  after "add-received"
- place the argument "check-helo" after the "add-received" of the
  mailfront command

Set up environment as described in plugin-check-helo.html.


This package is Copyright(C) 2019 Giam Teck Choon or CHOON.NET,
and may be copied according to the GNU GENERAL PUBLIC LICENSE (GPL)
Version 2 or a later version.  A copy of this license is included with
this package.  This package comes with no warranty of any kind.
