From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Jens Lechtenboerger Newsgroups: gmane.emacs.devel Subject: GnuPG homedir and package.el? Date: Sat, 04 Mar 2017 17:41:54 +0100 Message-ID: <87zih1gfjh.fsf@informationelle-selbstbestimmung-im-internet.de> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: blaine.gmane.org 1488645729 30749 195.159.176.226 (4 Mar 2017 16:42:09 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sat, 4 Mar 2017 16:42:09 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Mar 04 17:42:05 2017 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ckCku-0007Uv-2e for ged-emacs-devel@m.gmane.org; Sat, 04 Mar 2017 17:42:04 +0100 Original-Received: from localhost ([::1]:35854 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ckCkz-00052D-RB for ged-emacs-devel@m.gmane.org; Sat, 04 Mar 2017 11:42:09 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:38597) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ckCkt-000526-0M for emacs-devel@gnu.org; Sat, 04 Mar 2017 11:42:04 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ckCkp-0004UZ-Tb for emacs-devel@gnu.org; Sat, 04 Mar 2017 11:42:03 -0500 Original-Received: from mx2.mailbox.org ([80.241.60.215]:45551) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ckCkp-0004U8-J0 for emacs-devel@gnu.org; Sat, 04 Mar 2017 11:41:59 -0500 Original-Received: from smtp1.mailbox.org (smtp1.mailbox.org [80.241.60.240]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx2.mailbox.org (Postfix) with ESMTPS id A6C7E4451C for ; Sat, 4 Mar 2017 17:41:57 +0100 (CET) X-Virus-Scanned: amavisd-new at heinlein-support.de Original-Received: from smtp1.mailbox.org ([80.241.60.240]) by spamfilter03.heinlein-hosting.de (spamfilter03.heinlein-hosting.de [80.241.56.117]) (amavisd-new, port 10030) with ESMTP id kGwiTknT8num for ; Sat, 4 Mar 2017 17:41:56 +0100 (CET) OpenPGP: id=0xA142FD84; url=https://www.informationelle-selbstbestimmung-im-internet.de/A142FD84.asc Mail-Followup-To: emacs-devel@gnu.org X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 80.241.60.215 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:212750 Archived-At: --=-=-= Content-Type: text/plain 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 --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=package.diff commit 28105308487b231e57770c1af0c5989ba6d6b66c Author: Jens Lechtenboerger 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)))) --=-=-=--