Making GPG-Mailgate compatible with RFC 2821 (Simple Mail Transfer Protocol). The previous reverted commits made the gateway incompatible with the RFC. However, compatibility has to be activated in the settings. Most mail servers ignore the case sensitivity of the mail addresses, so this should not be a big issue.
A quick solution to make the S/MIME functionality compatible with the RFC was not found so this needs to be fixed later.
This commit is contained in:
parent
3cefd27163
commit
228d43e936
4 changed files with 27 additions and 1 deletions
|
@ -37,6 +37,7 @@ This is a combined work of many developers and contributors:
|
||||||
# To Do
|
# To Do
|
||||||
|
|
||||||
* clean up code
|
* clean up code
|
||||||
|
* IMPORTANT: S/MIME ignores case sensitivity settings
|
||||||
* rewrite and improve installation instructions
|
* rewrite and improve installation instructions
|
||||||
* rewrite readme of gpg-mailgate-web in markdown
|
* rewrite readme of gpg-mailgate-web in markdown
|
||||||
* rename from gpg-mailgate to openpgp-s-mime-mailgate or something.....
|
* rename from gpg-mailgate to openpgp-s-mime-mailgate or something.....
|
||||||
|
|
|
@ -12,6 +12,13 @@ keymap_only = no
|
||||||
# (Default is to use older inline-style PGP encoding.)
|
# (Default is to use older inline-style PGP encoding.)
|
||||||
mime_conversion = yes
|
mime_conversion = yes
|
||||||
|
|
||||||
|
# RFC 2821 defines that the user part of a mail address should be treated case sensitive.
|
||||||
|
# However in the real world this is ignored very often. This option enforces that
|
||||||
|
# email addresses are treated according to RFC 2821. If you encounter any problems
|
||||||
|
# based on the case sensitivity of mail addresses, set this setting to yes.
|
||||||
|
# This setting does not apply for S/MIME.
|
||||||
|
mail_case_sensitive = no
|
||||||
|
|
||||||
[gpg]
|
[gpg]
|
||||||
# the directory where gpg-mailgate public keys are stored
|
# the directory where gpg-mailgate public keys are stored
|
||||||
# (see INSTALL for details)
|
# (see INSTALL for details)
|
||||||
|
|
|
@ -211,10 +211,24 @@ def to_smime_handler( raw_message, recipients = None ):
|
||||||
|
|
||||||
|
|
||||||
keys = GnuPG.public_keys( cfg['gpg']['keyhome'] )
|
keys = GnuPG.public_keys( cfg['gpg']['keyhome'] )
|
||||||
|
if cfg['default'].has_key('mail_case_sensitive') and cfg['default']['mail_case_sensitive'] == 'yes':
|
||||||
|
for fingerprint in keys:
|
||||||
|
splitted_address = keys[fingerprint].split('@')
|
||||||
|
keys[fingerprint] = splitted_address[0] + '@' + splitted_address[1].lower()
|
||||||
|
else:
|
||||||
|
for fingerprint in keys:
|
||||||
|
keys[fingerprint] = keys[fingerprint].lower()
|
||||||
|
|
||||||
gpg_to = list()
|
gpg_to = list()
|
||||||
ungpg_to = list()
|
ungpg_to = list()
|
||||||
|
|
||||||
for to in to_addrs:
|
for to in to_addrs:
|
||||||
|
if cfg['default'].has_key('mail_case_sensitive') and cfg['default']['mail_case_sensitive'] == 'yes':
|
||||||
|
splitted_to = to.split('@')
|
||||||
|
to = splitted_to[0] + '@' + splitted_to[1].lower()
|
||||||
|
else:
|
||||||
|
to = to.lower()
|
||||||
|
|
||||||
if to in keys.values() and not ( cfg['default'].has_key('keymap_only') and cfg['default']['keymap_only'] == 'yes' ):
|
if to in keys.values() and not ( cfg['default'].has_key('keymap_only') and cfg['default']['keymap_only'] == 'yes' ):
|
||||||
gpg_to.append( (to, to) )
|
gpg_to.append( (to, to) )
|
||||||
elif cfg.has_key('keymap') and cfg['keymap'].has_key(to):
|
elif cfg.has_key('keymap') and cfg['keymap'].has_key(to):
|
||||||
|
|
|
@ -93,7 +93,11 @@ if __name__ == "__main__":
|
||||||
signers = p7.get0_signers(sk)
|
signers = p7.get0_signers(sk)
|
||||||
signing_cert = signers[0]
|
signing_cert = signers[0]
|
||||||
|
|
||||||
signing_cert.save(os.path.join(CERT_PATH, from_addr))
|
#Save certificate compatible to RFC 2821
|
||||||
|
splitted_from_addr = from_addr.split('@')
|
||||||
|
processed_from_addr = splitted_from_addr[0] + '@' + splitted_from_addr[1].lower()
|
||||||
|
|
||||||
|
signing_cert.save(os.path.join(CERT_PATH, processed_from_addr))
|
||||||
|
|
||||||
# format in user-specific data
|
# format in user-specific data
|
||||||
# sending success mail only for S/MIME as GPGMW handles this on its own
|
# sending success mail only for S/MIME as GPGMW handles this on its own
|
||||||
|
|
Loading…
Reference in a new issue