unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Jens Lechtenboerger <jens.lechtenboerger@fsfe.org>
To: emacs-devel@gnu.org
Subject: GnuPG homedir and package.el?
Date: Sat, 04 Mar 2017 17:41:54 +0100	[thread overview]
Message-ID: <87zih1gfjh.fsf@informationelle-selbstbestimmung-im-internet.de> (raw)

[-- 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))))

             reply	other threads:[~2017-03-04 16:41 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-04 16:41 Jens Lechtenboerger [this message]
2017-03-14 19:37 ` GnuPG homedir and package.el? 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87zih1gfjh.fsf@informationelle-selbstbestimmung-im-internet.de \
    --to=jens.lechtenboerger@fsfe.org \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).