unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* GnuPG homedir and package.el?
@ 2017-03-04 16:41 Jens Lechtenboerger
  2017-03-14 19:37 ` Ted Zlatanov
  0 siblings, 1 reply; 18+ messages in thread
From: Jens Lechtenboerger @ 2017-03-04 16:41 UTC (permalink / raw)
  To: emacs-devel

[-- Attachment #1: Type: text/plain, Size: 359 bytes --]

Hi there,

is there a reason that package.el sets up its own GnuPG homedir (in
package-import-keyring and package--check-signature-content)?

That choice does not work with Qubes OS and Split GPG [0].

Attached is a patch introducing a new user option to use the
default GnuPG home.

Best wishes
Jens

[0] https://github.com/QubesOS/qubes-issues/issues/2660


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: package.diff --]
[-- Type: text/x-diff, Size: 2467 bytes --]

commit 28105308487b231e57770c1af0c5989ba6d6b66c
Author: Jens Lechtenboerger <jens.lechtenboerger@fsfe.org>
Date:   Sat Mar 4 17:17:52 2017 +0100

    Introduce customizable variable package-use-separate-gnupghome
    
    * lisp/emacs-lisp/package.el (package-import-keyring)
      (package--check-signature-content): Use new variable
      package-use-separate-gnupghome to decide whether to use separate
      GnuPG homedir or default one.

diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el
index 8d5fac9..f212028 100644
--- a/lisp/emacs-lisp/package.el
+++ b/lisp/emacs-lisp/package.el
@@ -305,6 +305,17 @@ package-directory-list
 (declare-function epg-find-configuration "epg-config"
                   (protocol &optional no-cache program-alist))
 
+(defcustom package-use-separate-gnupghome t
+  "Whether to use default GnuPG homedir or create a separate one.
+If t (the default), package creates a separate directory to store
+ELPA signing keys.  That directory is then used as GnuPG homedir
+when verifying signatures on packages.
+If you want to keep all public keys in one place, including the
+ELPA signing key, set to nil."
+  :type 'boolean
+  :risky t
+  :version "26.0.50.2")
+
 (defcustom package-check-signature
   (if (and (require 'epg-config)
            (epg-find-configuration 'OpenPGP))
@@ -1209,7 +1220,8 @@ package--check-signature-content
 errors."
   (let* ((context (epg-make-context 'OpenPGP))
          (homedir (expand-file-name "gnupg" package-user-dir)))
-    (setf (epg-context-home-directory context) homedir)
+    (when package-use-separate-gnupghome
+      (setf (epg-context-home-directory context) homedir))
     (condition-case error
         (epg-verify-string context content string)
       (error (package--display-verify-error context sig-file)
@@ -1478,9 +1490,10 @@ package-import-keyring
   (setq file (expand-file-name file))
   (let ((context (epg-make-context 'OpenPGP))
         (homedir (expand-file-name "gnupg" package-user-dir)))
-    (with-file-modes 448
-      (make-directory homedir t))
-    (setf (epg-context-home-directory context) homedir)
+    (when package-use-separate-gnupghome
+      (with-file-modes 448
+        (make-directory homedir t))
+      (setf (epg-context-home-directory context) homedir))
     (message "Importing %s..." (file-name-nondirectory file))
     (epg-import-keys-from-file context file)
     (message "Importing %s...done" (file-name-nondirectory file))))

^ permalink raw reply related	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2017-04-11 12:43 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-03-04 16:41 GnuPG homedir and package.el? Jens Lechtenboerger
2017-03-14 19:37 ` Ted Zlatanov
2017-03-18 11:26   ` Jens Lechtenboerger
2017-03-20 13:37     ` Ted Zlatanov
2017-03-20 17:43       ` Jens Lechtenboerger
2017-03-26  7:41         ` Jens Lechtenboerger
2017-04-01 14:01           ` Jens Lechtenboerger
2017-04-01 14:22             ` Eli Zaretskii
2017-04-01 15:01               ` Jens Lechtenboerger
2017-04-01 15:18                 ` Eli Zaretskii
2017-04-01 16:08               ` Jens Lechtenboerger
2017-04-01 17:19                 ` Eli Zaretskii
2017-04-04 15:04                 ` Ted Zlatanov
2017-04-05 10:21                   ` Jens Lechtenboerger
2017-04-05 13:31                     ` Ted Zlatanov
2017-04-05 14:49                       ` Jens Lechtenboerger
2017-04-11  9:30                     ` Eli Zaretskii
2017-04-11 12:43                       ` Jens Lechtenboerger

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).