Added support for MacroListVerify option
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
0.9.5 UNRELEASED
|
0.9.5 UNRELEASED
|
||||||
- Beta 1 (updated Alpha -> Beta warning in README and trove classifiers)
|
- 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
|
0.9.4 2018-03-09
|
||||||
- Create PID directory if it is missing
|
- Create PID directory if it is missing
|
||||||
|
|||||||
@@ -60,6 +60,7 @@ class dkimMilter(Milter.Base):
|
|||||||
@Milter.noreply
|
@Milter.noreply
|
||||||
def connect(self,hostname,unused,hostaddr):
|
def connect(self,hostname,unused,hostaddr):
|
||||||
self.internal_connection = False
|
self.internal_connection = False
|
||||||
|
self.external_connection = False
|
||||||
self.hello_name = None
|
self.hello_name = None
|
||||||
# sometimes people put extra space in sendmail config, so we strip
|
# sometimes people put extra space in sendmail config, so we strip
|
||||||
self.receiver = self.getsymval('j').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 \
|
if (len(macro.split('|')) == 1 and macroresult) or macroresult in \
|
||||||
macro.split('|')[1:]:
|
macro.split('|')[1:]:
|
||||||
self.internal_connection = True
|
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:
|
if self.internal_connection:
|
||||||
connecttype = 'INTERNAL'
|
connecttype = 'INTERNAL'
|
||||||
else:
|
else:
|
||||||
@@ -163,7 +173,7 @@ class dkimMilter(Milter.Base):
|
|||||||
domain = milterconfig.get('Domain')
|
domain = milterconfig.get('Domain')
|
||||||
else:
|
else:
|
||||||
domain = ''
|
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()
|
txt = self.fp.read()
|
||||||
self.sign_dkim(txt)
|
self.sign_dkim(txt)
|
||||||
result = None
|
result = None
|
||||||
|
|||||||
@@ -48,7 +48,8 @@ defaultConfigData = {
|
|||||||
'InternalHosts' : '127.0.0.1',
|
'InternalHosts' : '127.0.0.1',
|
||||||
'InternalHostsObj' : False,
|
'InternalHostsObj' : False,
|
||||||
'DiagnosticDirectory' : '',
|
'DiagnosticDirectory' : '',
|
||||||
'MacroList' : ''
|
'MacroList' : '',
|
||||||
|
'MacroListVerify' : ''
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -337,7 +338,8 @@ def _readConfigFile(path, configData = None, configGlobal = {}):
|
|||||||
'InternalHosts' : 'dataset',
|
'InternalHosts' : 'dataset',
|
||||||
'InternalHostsObj': 'bool',
|
'InternalHostsObj': 'bool',
|
||||||
'DiagnosticDirectory' : 'str',
|
'DiagnosticDirectory' : 'str',
|
||||||
'MacroList' : 'dataset'
|
'MacroList' : 'dataset',
|
||||||
|
'MacroListVerify' : 'dataset'
|
||||||
}
|
}
|
||||||
|
|
||||||
# check to see if it's a file
|
# 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
|
depends upon the version of milter used to compile the filter and the version
|
||||||
of the MTA making the connection.
|
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
|
.TP
|
||||||
.I Mode (string)
|
.I Mode (string)
|
||||||
Selects operating modes. The string is a concatenation of characters that
|
Selects operating modes. The string is a concatenation of characters that
|
||||||
|
|||||||
Reference in New Issue
Block a user