Bypass Amazon EC2 HELO hostnames.

Detect old service before adding missing ones while updating LDAP data for Dovecot 2.3. fixes #121
This commit is contained in:
Zhang Huangbin
2021-06-04 12:32:51 +08:00
parent d0c4c21f48
commit 3b22086cc3
2 changed files with 9 additions and 14 deletions
+1
View File
@@ -106,6 +106,7 @@
/^\d{1,3}-\d{1,3}-\d{1,3}-\d{1,3}\.mail-(mail|campmail)\.facebook\.com$/ OK
/^outbound-\d{1,3}-\d{1,3}-\d{1,3}-\d{1,3}\.pinterestmail\.com$/ OK
/\.outbound\.protection\.outlook\.com$/ OK
/^ec2-\d{1,3}-\d{1,3}-\d{1,3}-\d{1,3}\..*\.compute\.amazonaws\.com$/ OK
/^out\d{1,3}-\d{1,3}-\d{1,3}-\d{1,3}\.mail\.qq\.com$/ OK
# reject HELO which contains IP address
+8 -14
View File
@@ -40,21 +40,15 @@ for (dn, entry) in allUsers:
enabledService = entry['enabledService']
_update = False
if b'imaptls' not in enabledService:
enabledService += [b'imaptls']
_update = True
if b'pop3tls' not in enabledService:
enabledService += [b'pop3tls']
_update = True
if b'smtptls' not in enabledService:
enabledService += [b'smtptls']
_update = True
if b'sievetls' not in enabledService:
enabledService += [b'sievetls']
_update = True
# If old service is disabled for the user, then no need to add the new one.
for old, new in [(b'imapsecured', b'imaptls'),
(b'pop3secured', b'pop3tls'),
(b'smtpsecured', b'smtptls'),
(b'sievesecured', b'sievetls')]:
if (old in enabledService) and (new not in enabledService):
enabledService.append(new)
_update = True
if _update:
print("* ({} of {}) Updating user: {}".format(count, total, mail))