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
FieldsModifier and TypeFieldDescriptionstatic final booleanWhentrue, 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
Constructors -
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 JilterStatusMakes sure the from address is a valid address on this machine.protected JilterStatuscheckToIsLocal(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 EmailCountergetInCounter(JilterConfiguration configuration, String accounting) Gets the inbound email counter for the provided business, ornullif its inbound email is not limited.static EmailCountergetOutCounter(JilterConfiguration configuration, String accounting) Gets the outbound email counter for the provided business, ornullif its outbound email is not limited.static EmailCountergetRelayCounter(JilterConfiguration configuration, String accounting) Gets the relay email counter for the provided business, ornullif its relay email is not limited.intintTODO: 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 bygetSupportedProcessesand should not be called by sendmail.protected booleanDetermines if the current hostaddr is local.protected booleanChecks 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
Creates a newAoservJilterHandler.- Throws:
IOException
-
-
Method Details
-
getInCounter
Gets the inbound email counter for the provided business, ornullif its inbound email is not limited. -
getOutCounter
Gets the outbound email counter for the provided business, ornullif its outbound email is not limited. -
getRelayCounter
Gets the relay email counter for the provided business, ornullif its relay email is not limited. -
getSupportedProcesses
public int getSupportedProcesses()- Specified by:
getSupportedProcessesin interfaceJilterHandler
-
connect
Compare to email_smtp_relays table, looking for deny or deny_spam.TODO: Verify against realtime blacklists.
- Specified by:
connectin interfaceJilterHandler
-
helo
This method is currently disabled bygetSupportedProcessesand should not be called by sendmail.- Specified by:
heloin 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:
envfromin 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:
envrcptin 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:
headerin interfaceJilterHandler
-
eoh
- Specified by:
eohin 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:
bodyin interfaceJilterHandler
-
eom
- Specified by:
eomin interfaceJilterHandler
-
abort
- Specified by:
abortin interfaceJilterHandler
-
close
- Specified by:
closein interfaceJilterHandler
-
getRequiredModifications
public int getRequiredModifications()- Specified by:
getRequiredModificationsin 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:
nullif passed orJilterStatusfor not allowed.
-
checkToIsLocal
Makes sure the to address is a valid address on this machine.- Returns:
nullif passed orJilterStatusfor not allowed.
-
