- 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 - Make RSA signatures in dkimpy-milter optional, so dkimpy-milter can be
added after an existing DKIM signing application to add an Ed25519 added after an existing DKIM signing application to add an Ed25519
signature (Thanks to A. Schulze for the patch) signature (Thanks to A. Schulze for the patch)
- Added support for AuthservID option
0.9.3 2018-03-02 0.9.3 2018-03-02
- Fixup csl dataset processing for single item lists - Fixup csl dataset processing for single item lists
+1 -2
View File
@@ -29,13 +29,12 @@ SyslogFacility implemented verified
File dataset implemented verified File dataset implemented verified
0.9.4 (Alpha) 0.9.4 (Alpha)
AuthservID implemented verified
0.9.5 (Beta) 0.9.5 (Beta)
AuthservID
Diagnostics Diagnostics
DiagnosticDirectory DiagnosticDirectory
InternalHosts InternalHosts
SyslogSuccess SyslogSuccess
1.0.0 1.0.0
+6 -2
View File
@@ -63,6 +63,10 @@ class dkimMilter(Milter.Base):
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()
try:
self.AuthservID = milterconfig['AuthservID']
except:
self.AuthservID = self.receiver
if hostaddr and len(hostaddr) > 0: if hostaddr and len(hostaddr) > 0:
ipaddr = hostaddr[0] ipaddr = hostaddr[0]
"""if iniplist(ipaddr,self.conf.internal_connect): FIXME """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 # FIXME: don't delete A-R headers from trusted MTAs
try: try:
ar = authres.AuthenticationResultsHeader.parse_value(FWS.sub('',val)) 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,'') self.chgheader('authentication-results',i,'')
if milterconfig.get('Syslog'): if milterconfig.get('Syslog'):
syslog.syslog('REMOVE: {0}'.format(val)) syslog.syslog('REMOVE: {0}'.format(val))
@@ -175,7 +179,7 @@ class dkimMilter(Milter.Base):
else: else:
result = 'none' result = 'none'
if self.arresults: if self.arresults:
h = authres.AuthenticationResultsHeader(authserv_id = self.receiver, h = authres.AuthenticationResultsHeader(authserv_id = self.AuthservID,
results=self.arresults) results=self.arresults)
h = fold(str(h)) h = fold(str(h))
if milterconfig.get('Syslog'): if milterconfig.get('Syslog'):
+13 -2
View File
@@ -31,6 +31,7 @@ import re
import urllib import urllib
import stat import stat
import dkim import dkim
import socket
# default values # default values
@@ -82,8 +83,14 @@ def _find_boolean(item):
else: else:
raise dkim.ParameterError() raise dkim.ParameterError()
return item 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): def _dataset_to_list(dataset):
"""Convert a dataset (as defined in dkimpymilter.8) and return a python """Convert a dataset (as defined in dkimpymilter.8) and return a python
list of values.""" list of values."""
@@ -217,5 +224,9 @@ def _readConfigFile(path, configData = None, configGlobal = {}):
syslog.syslog(str('name: ' + name + ' value: ' + value + ' conversion: ' + conversion)) syslog.syslog(str('name: ' + name + ' value: ' + value + ' conversion: ' + conversion))
configData[name] = conversion(value) configData[name] = conversion(value)
fp.close() fp.close()
try:
configData['AuthservID'] = _calculate_authserv_id(configData['AuthservID'])
except:
pass
return(configData) return(configData)