Package com.aoindustries.aoserv.jilter
Class AoservJilterHandler
java.lang.Object
com.aoindustries.aoserv.jilter.AoservJilterHandler
- All Implemented Interfaces:
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 Summary
Modifier and TypeFieldDescriptionstatic final boolean
Whentrue
, notices will be sent but emails will not be stopped.Fields inherited from interface com.sendmail.jilter.JilterHandler
PROCESS_BODY, PROCESS_CONNECT, PROCESS_ENVFROM, PROCESS_ENVRCPT, PROCESS_HEADER, PROCESS_HELO, SMFIF_ADDHDRS, SMFIF_ADDRCPT, SMFIF_CHGBODY, SMFIF_CHGHDRS, SMFIF_DELRCPT, SMFIF_MODBODY, SMFIF_NONE
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionabort()
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.protected JilterStatus
Makes sure the from address is a valid address on this machine.protected JilterStatus
checkToIsLocal
(String to) Makes sure the to address is a valid address on this machine.close()
connect
(String hostname, InetAddress hostaddr, Properties properties) Compare to email_smtp_relays table, looking for deny or deny_spam.envfrom
(String[] argv, Properties properties) TODO: Verify that against SPF / PTR / MX records.envrcpt
(String[] argv, Properties properties) If mail going from local to esmtp, then: Don't allow empty from address If this ao_server has "restrict_outbound_email" set to true: Make sure from address is a valid address on this machine Limit as outgoing mail (use noLimitToAddresses) If mail going from local to local, then: Make sure recipient is a valid email address on this machine Do not limit the email If mail going from esmtp to esmtp, then: Make sure hostaddr is one of IP addresses of this machine OR relaying has been allowed from that IP Don't allow empty from address Make sure from address is a valid address on this machine Limit as outgoing (use noLimitToAddresses) if hostaddr is on this machine OR limit as relay if from an outside IP If mail going from esmtp to local, then: Make sure recipient is a valid email address on this machine Limit as incoming mail If mail going from auth to esmtp, then: Make sure authenticated Don't allow empty from address Make sure from address is a valid address on this machine Limit as outgoing (use noLimitToAddresses) if hostaddr is on this machine OR limit as relay if from an outside IP If mail going from auth to local, then: Make sure recipient is a valid email address on this machine Limit as incoming mail If any other pattern, then: Return failure code and descriptioneoh()
eom
(JilterEOMActions eomActions, Properties properties) static EmailCounter
getInCounter
(JilterConfiguration configuration, String accounting) Gets the inbound email counter for the provided business, ornull
if its inbound email is not limited.static EmailCounter
getOutCounter
(JilterConfiguration configuration, String accounting) Gets the outbound email counter for the provided business, ornull
if its outbound email is not limited.static EmailCounter
getRelayCounter
(JilterConfiguration configuration, String accounting) Gets the relay email counter for the provided business, ornull
if its relay email is not limited.int
int
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.helo
(String helohost, Properties properties) This method is currently disabled bygetSupportedProcesses
and should not be called by sendmail.protected boolean
Determines if the current hostaddr is local.protected boolean
Checks if relaying has been allowed from hostaddr.
-
Field Details
-
NOTIFY_ONLY_MODE
public static final boolean NOTIFY_ONLY_MODEWhentrue
, notices will be sent but emails will not be stopped.- See Also:
-
-
Constructor Details
-
AoservJilterHandler
- Throws:
IOException
-
-
Method Details
-
getInCounter
Gets the inbound email counter for the provided business, ornull
if its inbound email is not limited. -
getOutCounter
Gets the outbound email counter for the provided business, ornull
if its outbound email is not limited. -
getRelayCounter
Gets the relay email counter for the provided business, ornull
if its relay email is not limited. -
getSupportedProcesses
public int getSupportedProcesses()- Specified by:
getSupportedProcesses
in interfaceJilterHandler
-
connect
Compare to email_smtp_relays table, looking for deny or deny_spam.TODO: Verify against realtime blacklists.
- Specified by:
connect
in interfaceJilterHandler
-
helo
This method is currently disabled bygetSupportedProcesses
and should not be called by sendmail.- Specified by:
helo
in interfaceJilterHandler
-
envfrom
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 interfaceJilterHandler
-
envrcpt
- If mail going from local to esmtp, then:
- Don't allow empty from address
- If this ao_server has "restrict_outbound_email" set to true: Make sure from address is a valid address on this machine
- Limit as outgoing mail (use noLimitToAddresses)
- If mail going from local to local, then:
- Make sure recipient is a valid email address on this machine
- Do not limit the email
- If mail going from esmtp to esmtp, then:
- Make sure hostaddr is one of IP addresses of this machine OR relaying has been allowed from that IP
- Don't allow empty from address
- Make sure from address is a valid address on this machine
- Limit as outgoing (use noLimitToAddresses) if hostaddr is on this machine OR limit as relay if from an outside IP
- If mail going from esmtp to local, then:
- Make sure recipient is a valid email address on this machine
- Limit as incoming mail
- If mail going from auth to esmtp, then:
- Make sure authenticated
- Don't allow empty from address
- Make sure from address is a valid address on this machine
- Limit as outgoing (use noLimitToAddresses) if hostaddr is on this machine OR limit as relay if from an outside IP
- If mail going from auth to local, then:
- Make sure recipient is a valid email address on this machine
- Limit as incoming mail
- If any other pattern, then:
- Return failure code and description
- Specified by:
envrcpt
in interfaceJilterHandler
- If mail going from local to esmtp, then:
-
header
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 interfaceJilterHandler
-
eoh
- Specified by:
eoh
in interfaceJilterHandler
-
body
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 interfaceJilterHandler
-
eom
- Specified by:
eom
in interfaceJilterHandler
-
abort
- Specified by:
abort
in interfaceJilterHandler
-
close
- Specified by:
close
in interfaceJilterHandler
-
getRequiredModifications
public int getRequiredModifications()- Specified by:
getRequiredModifications
in interfaceJilterHandler
-
isHostAddrLocal
protected boolean isHostAddrLocal()Determines if the current hostaddr is local. -
isHostAddrRelayingAllowed
protected boolean isHostAddrRelayingAllowed()Checks if relaying has been allowed from hostaddr. -
checkFromIsLocal
Makes sure the from address is a valid address on this machine.- Returns:
null
if passed orJilterStatus
for not allowed.
-
checkToIsLocal
Makes sure the to address is a valid address on this machine.- Returns:
null
if passed orJilterStatus
for not allowed.
-