Class AoservJilterHandler

java.lang.Object
com.aoindustries.aoserv.jilter.AoservJilterHandler
All Implemented Interfaces:
JilterHandler

public class AoservJilterHandler extends Object implements JilterHandler
What does a forwarding look like? It appears that a forwarding is accepted like any other address as local. Then sendmail performs the forwarding without a milter check on the way out.

TODO: EmailAttachmentType filters - go into .zip, .tar, .tgz, .tar.gz, ..., too.

Author:
AO Industries, Inc.
  • Field Details

    • NOTIFY_ONLY_MODE

      public static final boolean NOTIFY_ONLY_MODE
      When true, notices will be sent but emails will not be stopped.
      See Also:
  • Constructor Details

  • Method Details

    • getInCounter

      public static EmailCounter getInCounter(JilterConfiguration configuration, String accounting)
      Gets the inbound email counter for the provided business, or null if its inbound email is not limited.
    • getOutCounter

      public static EmailCounter getOutCounter(JilterConfiguration configuration, String accounting)
      Gets the outbound email counter for the provided business, or null if its outbound email is not limited.
    • getRelayCounter

      public static EmailCounter getRelayCounter(JilterConfiguration configuration, String accounting)
      Gets the relay email counter for the provided business, or null if its relay email is not limited.
    • getSupportedProcesses

      public int getSupportedProcesses()
      Specified by:
      getSupportedProcesses in interface JilterHandler
    • connect

      public JilterStatus connect(String hostname, InetAddress hostaddr, Properties properties)
      Compare to email_smtp_relays table, looking for deny or deny_spam.

      TODO: Verify against realtime blacklists.

      Specified by:
      connect in interface JilterHandler
    • helo

      public JilterStatus helo(String helohost, Properties properties)
      This method is currently disabled by getSupportedProcesses and should not be called by sendmail.
      Specified by:
      helo in interface JilterHandler
    • envfrom

      public JilterStatus envfrom(String[] argv, Properties properties)
      TODO: Verify that against SPF / PTR / MX records. TODO: Don't allow outbound to send for an address that doesn't match the IP for the customer (virtual hosting IP enforcement)
      Specified by:
      envfrom in interface JilterHandler
    • envrcpt

      public JilterStatus envrcpt(String[] argv, Properties properties)
      1. If mail going from local to esmtp, then:
        1. Don't allow empty from address
        2. If this ao_server has "restrict_outbound_email" set to true: Make sure from address is a valid address on this machine
        3. Limit as outgoing mail (use noLimitToAddresses)
      2. If mail going from local to local, then:
        1. Make sure recipient is a valid email address on this machine
        2. Do not limit the email
      3. If mail going from esmtp to esmtp, then:
        1. Make sure hostaddr is one of IP addresses of this machine OR relaying has been allowed from that IP
        2. Don't allow empty from address
        3. Make sure from address is a valid address on this machine
        4. Limit as outgoing (use noLimitToAddresses) if hostaddr is on this machine OR limit as relay if from an outside IP
      4. If mail going from esmtp to local, then:
        1. Make sure recipient is a valid email address on this machine
        2. Limit as incoming mail
      5. If mail going from auth to esmtp, then:
        1. Make sure authenticated
        2. Don't allow empty from address
        3. Make sure from address is a valid address on this machine
        4. Limit as outgoing (use noLimitToAddresses) if hostaddr is on this machine OR limit as relay if from an outside IP
      6. If mail going from auth to local, then:
        1. Make sure recipient is a valid email address on this machine
        2. Limit as incoming mail
      7. If any other pattern, then:
        1. Return failure code and description
      Specified by:
      envrcpt in interface JilterHandler
    • header

      public JilterStatus header(String headerf, String headerv)
      TODO: Strip any of the typical spamassassin headers, so that procmail will not default to deliverying if spamassassin fails and doesn't modify the headers (Prevent spam with spamassassin headers from falling through) TODO: Check for X-Loop here instead of procmail for more performance. TODO: Reenable header in other parts of this code to activate this method.
      Specified by:
      header in interface JilterHandler
    • eoh

      public JilterStatus eoh()
      Specified by:
      eoh in interface JilterHandler
    • body

      public JilterStatus body(ByteBuffer bodyp)
      TODO: Call SpamAssassin from here TODO: Limit inbox size here TODO: Reenable body in other parts of this code to activate this method.
      Specified by:
      body in interface JilterHandler
    • eom

      public JilterStatus eom(JilterEOMActions eomActions, Properties properties)
      Specified by:
      eom in interface JilterHandler
    • abort

      public JilterStatus abort()
      Specified by:
      abort in interface JilterHandler
    • close

      public JilterStatus close()
      Specified by:
      close in interface JilterHandler
    • getRequiredModifications

      public int getRequiredModifications()
      Specified by:
      getRequiredModifications in interface JilterHandler
    • isHostAddrLocal

      protected boolean isHostAddrLocal()
      Determines if the current hostaddr is local.
    • isHostAddrRelayingAllowed

      protected boolean isHostAddrRelayingAllowed()
      Checks if relaying has been allowed from hostaddr.
    • checkFromIsLocal

      protected JilterStatus checkFromIsLocal()
      Makes sure the from address is a valid address on this machine.
      Returns:
      null if passed or JilterStatus for not allowed.
    • checkToIsLocal

      protected JilterStatus checkToIsLocal(String to)
      Makes sure the to address is a valid address on this machine.
      Returns:
      null if passed or JilterStatus for not allowed.