[Remail] remail/gpg: Use the lists private key for signing

Thomas Gleixner tglx at linutronix.de
Tue Feb 18 21:48:33 CET 2020


Konstantin reported that outgoing mail from a mailing list is signed with
the default private key found in the private keyring.

That's caused by just handing boolen True into the sign argument of
gpg_encrypt() while the documentation clearly says:

  sign (defaults to None)
    Either the Boolean value True, or the fingerprint of a key which is
    used to sign the encrypted data. If True is specified, the default key
    is used for signing. When not specified, the data is not signed.

Hand the list account fingerprint in if signing is enabled in the
configuration.

Reported-by: Konstantin Ryabitsev <konstantin at linuxfoundation.org>
Signed-off-by: Thomas Gleixner <tglx at linutronix.de>
---
Note: Untested 
---
 remail/gpg.py |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

--- a/remail/gpg.py
+++ b/remail/gpg.py
@@ -89,9 +89,14 @@ import os
     def do_encrypt(self, payload, fingerprints):
         ''' Common encryption helper'''
 
+        if self.config.sign:
+            signit = self.account.fingerprint
+        else:
+            signit = None
+
         enc = self.gpg.encrypt(payload, fingerprints, armor=self.config.armor,
                                always_trust=self.config.always_trust,
-                               sign=self.config.sign)
+                               sign=signit)
         if enc.ok:
             return str(enc)
         raise RemailGPGException('Encryption fail: %s' % enc.status)



More information about the Remail mailing list