Added support for MacroListVerify option
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
0.9.5 UNRELEASED
|
||||
- Beta 1 (updated Alpha -> Beta warning in README and trove classifiers)
|
||||
- Add support for MacroList option
|
||||
- Added support for MacroList option
|
||||
- Added support for MacroListVerify option
|
||||
|
||||
0.9.4 2018-03-09
|
||||
- Create PID directory if it is missing
|
||||
|
||||
@@ -60,6 +60,7 @@ class dkimMilter(Milter.Base):
|
||||
@Milter.noreply
|
||||
def connect(self,hostname,unused,hostaddr):
|
||||
self.internal_connection = False
|
||||
self.external_connection = False
|
||||
self.hello_name = None
|
||||
# sometimes people put extra space in sendmail config, so we strip
|
||||
self.receiver = self.getsymval('j').strip()
|
||||
@@ -83,6 +84,15 @@ class dkimMilter(Milter.Base):
|
||||
if (len(macro.split('|')) == 1 and macroresult) or macroresult in \
|
||||
macro.split('|')[1:]:
|
||||
self.internal_connection = True
|
||||
if milterconfig.get('MacroListVerify'):
|
||||
macrolist = milterconfig.get('MacroListVerify')
|
||||
for macro in macrolist:
|
||||
macroname = macro.split('|')[0]
|
||||
macroname = '{' + macroname + '}'
|
||||
macroresult = self.getsymval(macroname)
|
||||
if (len(macro.split('|')) == 1 and macroresult) or macroresult in \
|
||||
macro.split('|')[1:]:
|
||||
self.external_connection = True
|
||||
if self.internal_connection:
|
||||
connecttype = 'INTERNAL'
|
||||
else:
|
||||
@@ -163,7 +173,7 @@ class dkimMilter(Milter.Base):
|
||||
domain = milterconfig.get('Domain')
|
||||
else:
|
||||
domain = ''
|
||||
if (self.fdomain in domain) and (not milterconfig.get('Mode') == 'v'):
|
||||
if (self.fdomain in domain) and ((not milterconfig.get('Mode') == 'v') or not self.external_connection):
|
||||
txt = self.fp.read()
|
||||
self.sign_dkim(txt)
|
||||
result = None
|
||||
|
||||
@@ -48,7 +48,8 @@ defaultConfigData = {
|
||||
'InternalHosts' : '127.0.0.1',
|
||||
'InternalHostsObj' : False,
|
||||
'DiagnosticDirectory' : '',
|
||||
'MacroList' : ''
|
||||
'MacroList' : '',
|
||||
'MacroListVerify' : ''
|
||||
}
|
||||
|
||||
|
||||
@@ -337,7 +338,8 @@ def _readConfigFile(path, configData = None, configGlobal = {}):
|
||||
'InternalHosts' : 'dataset',
|
||||
'InternalHostsObj': 'bool',
|
||||
'DiagnosticDirectory' : 'str',
|
||||
'MacroList' : 'dataset'
|
||||
'MacroList' : 'dataset',
|
||||
'MacroListVerify' : 'dataset'
|
||||
}
|
||||
|
||||
# check to see if it's a file
|
||||
|
||||
@@ -289,6 +289,16 @@ at the time the filter receives a connection from the MTA and its availability
|
||||
depends upon the version of milter used to compile the filter and the version
|
||||
of the MTA making the connection.
|
||||
|
||||
.TP
|
||||
.I MacroListVerify (dataset)
|
||||
Defines a set of MTA-provided
|
||||
.I macros
|
||||
that should be checked to see if the sender has been determined to be an
|
||||
external source and therefore whether or not the message should be signed.
|
||||
Entries in this data set follow the same form as those of the
|
||||
.I MacroList
|
||||
option above. [this option is not inhereted from OpenDKIM]
|
||||
|
||||
.TP
|
||||
.I Mode (string)
|
||||
Selects operating modes. The string is a concatenation of characters that
|
||||
|
||||
Reference in New Issue
Block a user