Package org.apache.james.jspf.impl
Class SPF
java.lang.Object
org.apache.james.jspf.impl.SPF
- All Implemented Interfaces:
SPFChecker
- Direct Known Subclasses:
DefaultSPF
This class is used to generate a SPF-Test and provided all intressting data.
-
Constructor Summary
ConstructorsConstructorDescriptionSPF
(DNSService dnsProbe) Uses passed logger and passed dnsServicerSPF
(DNSService dnsProbe, SPFRecordParser parser, MacroExpand macroExpand, SPFExecutor executor) Uses passed services -
Method Summary
Modifier and TypeMethodDescriptionRun check for SPF with the given values.checkSPF
(SPFSession spfData) Run check for SPF with the given values.Return the FallbackPolicy object which can be used to provide default spfRecords for hosts which have no recordsReturn the OverridePolicy object which can be used to override spfRecords for hostsReturn a default policy for SPFvoid
setDefaultExplanation
(String defaultExplanation) Set the default explanation which will be used if no explanation is found in the SPF Recordvoid
setSPFMustEqualsTXT
(boolean mustEquals) Set to true if a PermError should returned when a domain publish a SPF-Type and TXT-Type SPF-Record and both are not equals.void
setTimeOut
(int timeOut) Set the amount of time (in seconds) before an TermError is returned when the dnsserver not answer.void
setUseBestGuess
(boolean useBestGuess) Set to true for using best guess.void
setUseTrustedForwarder
(boolean useTrustedForwarder) Set to true to enable trusted-forwarder.org whitelist.
-
Constructor Details
-
SPF
Uses passed logger and passed dnsServicer- Parameters:
dnsProbe
- the dns provider
-
SPF
public SPF(DNSService dnsProbe, SPFRecordParser parser, MacroExpand macroExpand, SPFExecutor executor) Uses passed services- Parameters:
dnsProbe
- the dns providerparser
- the parser to use
-
-
Method Details
-
checkSPF
Run check for SPF with the given values.- Parameters:
ipAddress
- The ipAddress the connection is comming frommailFrom
- The mailFrom which was providedhostName
- The hostname which was provided as HELO/EHLO- Returns:
- result The SPFResult
-
checkSPF
public DNSLookupContinuation checkSPF(SPFSession spfData) throws PermErrorException, NoneException, TempErrorException, NeutralException Description copied from interface:SPFChecker
Run check for SPF with the given values.- Specified by:
checkSPF
in interfaceSPFChecker
- Parameters:
spfData
- The SPF1Data which should be used to run the check- Throws:
PermErrorException
- Get thrown if an error was detectedNoneException
- Get thrown if no Record was foundNoneException
TempErrorException
- Get thrown if a DNS problem was detectedNeutralException
- Get thrown if the result should be neutral- See Also:
-
getPolicies
Return a default policy for SPF -
setTimeOut
public void setTimeOut(int timeOut) Set the amount of time (in seconds) before an TermError is returned when the dnsserver not answer. Default is 20 seconds.- Parameters:
timeOut
- The timout in seconds
-
setDefaultExplanation
Set the default explanation which will be used if no explanation is found in the SPF Record- Parameters:
defaultExplanation
- The explanation to use if no explanation is found in the SPF Record
-
setUseBestGuess
public void setUseBestGuess(boolean useBestGuess) Set to true for using best guess. Best guess will set the SPF-Record to "a/24 mx/24 ptr ~all" if no SPF-Record was found for the doamin. When this was happen only pass or netural will be returned. Default is false.- Parameters:
useBestGuess
- true to enable best guess
-
getFallbackPolicy
Return the FallbackPolicy object which can be used to provide default spfRecords for hosts which have no records- Returns:
- the FallbackPolicy object
-
setUseTrustedForwarder
public void setUseTrustedForwarder(boolean useTrustedForwarder) Set to true to enable trusted-forwarder.org whitelist. The whitelist will only be queried if the last Mechanism is -all or ?all. See http://trusted-forwarder.org for more informations Default is false.- Parameters:
useTrustedForwarder
- true or false
-
getOverridePolicy
Return the OverridePolicy object which can be used to override spfRecords for hosts- Returns:
- the OverridePolicy object
-
setSPFMustEqualsTXT
public void setSPFMustEqualsTXT(boolean mustEquals) Set to true if a PermError should returned when a domain publish a SPF-Type and TXT-Type SPF-Record and both are not equals. Defaults false- Parameters:
mustEquals
- true or false
-