- Added support for AuthservID option

This commit is contained in:
Scott Kitterman
2018-03-04 15:15:37 -05:00
parent 2e9d0f607f
commit df19aa081e
4 changed files with 21 additions and 6 deletions
+1
View File
@@ -10,6 +10,7 @@
- Make RSA signatures in dkimpy-milter optional, so dkimpy-milter can be
added after an existing DKIM signing application to add an Ed25519
signature (Thanks to A. Schulze for the patch)
- Added support for AuthservID option
0.9.3 2018-03-02
- Fixup csl dataset processing for single item lists
+1 -2
View File
@@ -29,13 +29,12 @@ SyslogFacility implemented verified
File dataset implemented verified
0.9.4 (Alpha)
AuthservID implemented verified
0.9.5 (Beta)
AuthservID
Diagnostics
DiagnosticDirectory
InternalHosts
SyslogSuccess
1.0.0
+6 -2
View File
@@ -63,6 +63,10 @@ class dkimMilter(Milter.Base):
self.hello_name = None
# sometimes people put extra space in sendmail config, so we strip
self.receiver = self.getsymval('j').strip()
try:
self.AuthservID = milterconfig['AuthservID']
except:
self.AuthservID = self.receiver
if hostaddr and len(hostaddr) > 0:
ipaddr = hostaddr[0]
"""if iniplist(ipaddr,self.conf.internal_connect): FIXME
@@ -152,7 +156,7 @@ class dkimMilter(Milter.Base):
# FIXME: don't delete A-R headers from trusted MTAs
try:
ar = authres.AuthenticationResultsHeader.parse_value(FWS.sub('',val))
if ar.authserv_id == self.receiver:
if ar.authserv_id == self.AuthservID:
self.chgheader('authentication-results',i,'')
if milterconfig.get('Syslog'):
syslog.syslog('REMOVE: {0}'.format(val))
@@ -175,7 +179,7 @@ class dkimMilter(Milter.Base):
else:
result = 'none'
if self.arresults:
h = authres.AuthenticationResultsHeader(authserv_id = self.receiver,
h = authres.AuthenticationResultsHeader(authserv_id = self.AuthservID,
results=self.arresults)
h = fold(str(h))
if milterconfig.get('Syslog'):
+13 -2
View File
@@ -31,6 +31,7 @@ import re
import urllib
import stat
import dkim
import socket
# default values
@@ -82,8 +83,14 @@ def _find_boolean(item):
else:
raise dkim.ParameterError()
return item
####################
def _calculate_authserv_id(as_id):
"""Determine AuthservID if needed"""
if as_id == 'HOSTNAME':
as_id = socket.gethostname()
return as_id
####################
def _dataset_to_list(dataset):
"""Convert a dataset (as defined in dkimpymilter.8) and return a python
list of values."""
@@ -217,5 +224,9 @@ def _readConfigFile(path, configData = None, configGlobal = {}):
syslog.syslog(str('name: ' + name + ' value: ' + value + ' conversion: ' + conversion))
configData[name] = conversion(value)
fp.close()
try:
configData['AuthservID'] = _calculate_authserv_id(configData['AuthservID'])
except:
pass
return(configData)