summaryrefslogtreecommitdiff
path: root/tickets/b6df8a5d7d3d4b7e8c2ddf8c95cfc33d/Maildir/new/1455998999.M586821P17339Q97.exolobe1
blob: 3ea0ae1c5acfa37f5a2c6754b2a6443d93e16d4e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
Return-Path: <obnam-dev-bounces@obnam.org>
X-Original-To: distix@pieni.net
Delivered-To: distix@pieni.net
Received: from bagpuss.pepperfish.net (bagpuss.pepperfish.net [148.251.8.16])
	(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
	(No client certificate requested)
	by pieni.net (Postfix) with ESMTPS id D96D42E096
	for <distix@pieni.net>; Fri, 11 Sep 2015 07:22:46 +0200 (CEST)
Received: from platypus.pepperfish.net (unknown [10.112.100.20])
	by bagpuss.pepperfish.net (Postfix) with ESMTP id 7C285CC1;
	Fri, 11 Sep 2015 06:22:46 +0100 (BST)
Received: from ip6-localhost ([::1] helo=platypus.pepperfish.net)
	by platypus.pepperfish.net with esmtp (Exim 4.80 #2 (Debian))
	id 1ZaGnO-0007VW-CH; Fri, 11 Sep 2015 06:22:46 +0100
Received: from inmail0 ([10.112.100.10] helo=mx0.pepperfish.net)
 by platypus.pepperfish.net with esmtp (Exim 4.80 #2 (Debian))
 id 1ZaGnM-0007VQ-OW
 for <obnam-dev@obnam.org>; Fri, 11 Sep 2015 06:22:44 +0100
Received: from mail-ig0-f173.google.com ([209.85.213.173])
 by mx0.pepperfish.net with esmtps (TLS1.2:RSA_ARCFOUR_SHA1:128)
 (Exim 4.80) (envelope-from <mathstuf@gmail.com>) id 1ZaGnL-0004Im-1F
 for obnam-dev@obnam.org; Fri, 11 Sep 2015 06:22:44 +0100
Received: by igcpb10 with SMTP id pb10so37115786igc.1
 for <obnam-dev@obnam.org>; Thu, 10 Sep 2015 22:22:30 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
 h=from:to:cc:subject:date:message-id:in-reply-to:references;
 bh=TKZkM02v+kOdX6WT1YlQa12frpe7tmVH5nWS+ibrVlY=;
 b=H+nNRQpdaM5I6MSS2b/cRwRuiApxserz7ElAyuyraMIJrt01VX4XIEdg4DLR4mW5yQ
 uZy3QkmJGWLINkeLVP+0jOgLpR9bmpb5FGBk8go9JS4PTEFsc4TRGHp2LKDKVvNoXf3m
 wZs+tbBVNsprtctZKm0+f9v5xPq85S8iJb7FvYRWUn6EqTQkYdlwNeCIp9QB+Ow6wzWU
 Ne8+2h2NaXky4AqhLD1euGsY2JGNkBpbNzRSYo9tTLVgCjVc3/ZA43NBRW2I5bncE7H5
 zxvnxaZDf/e2EhCWHFX+z/d6JZ8viYmlnTuR3/NaDA2r7Y986FusBoczTntgFtJVpZKd
 6TKQ==
X-Received: by 10.50.27.102 with SMTP id s6mr487510igg.23.1441948950490;
 Thu, 10 Sep 2015 22:22:30 -0700 (PDT)
Received: from localhost (45.sub-70-209-135.myvzw.com. [70.209.135.45])
 by smtp.gmail.com with ESMTPSA id e18sm157391ioe.21.2015.09.10.22.22.29
 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
 Thu, 10 Sep 2015 22:22:29 -0700 (PDT)
From: Ben Boeckel <mathstuf@gmail.com>
To: obnam-dev@obnam.org
Date: Fri, 11 Sep 2015 01:22:14 -0400
Message-Id: <1441948936-12526-2-git-send-email-mathstuf@gmail.com>
X-Mailer: git-send-email 2.5.1
In-Reply-To: <1441948936-12526-1-git-send-email-mathstuf@gmail.com>
References: <1441948936-12526-1-git-send-email-mathstuf@gmail.com>
X-Spam-Score: -0.5
X-Spam-Score-int: -4
X-Spam-Bar: /
X-Scanned-By: pepperfish.net, Fri, 11 Sep 2015 06:22:44 +0100
X-Spam-Report: Content analysis details: (-0.5 points)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 1.0 PPF_FROM_CONTAINS_MAIL The From header contains 'mail'
 1.2 FREEMAIL_FROM Sender email is commonly abused enduser mail provider
 (mathstuf[at]gmail.com)
 -0.0 SPF_PASS               SPF: sender matches SPF record
 -1.9 BAYES_00               BODY: Bayes spam probability is 0 to 1%
 [score: 0.0000]
 -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's
 domain
 0.1 DKIM_SIGNED            Message has a DKIM or DK signature,
 not necessarily valid
 -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature
 -0.7 RCVD_IN_DNSWL_LOW      RBL: Sender listed at http://www.dnswl.org/, low
 trust [209.85.213.173 listed in list.dnswl.org]
X-ACL-Warn: message may be spam
X-Scan-Signature: 531f3386b8fdbaa107ddf70a0e4d95bf
Cc: Ben Boeckel <mathstuf@gmail.com>
Subject: [PATCH 1/3] encryption_plugin: add a gpg-homedir configuration
	option
X-BeenThere: obnam-dev@obnam.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: Obnam development discussions <obnam-dev-obnam.org>
List-Unsubscribe: <http://listmaster.pepperfish.net/cgi-bin/mailman/listinfo/obnam-dev-obnam.org>,
 <mailto:obnam-dev-request@obnam.org?subject=unsubscribe>
List-Archive: <http://listmaster.pepperfish.net/pipermail/obnam-dev-obnam.org>
List-Post: <mailto:obnam-dev@obnam.org>
List-Help: <mailto:obnam-dev-request@obnam.org?subject=help>
List-Subscribe: <http://listmaster.pepperfish.net/cgi-bin/mailman/listinfo/obnam-dev-obnam.org>,
 <mailto:obnam-dev-request@obnam.org?subject=subscribe>
Sender: obnam-dev-bounces@obnam.org
Errors-To: obnam-dev-bounces@obnam.org

Signed-off-by: Ben Boeckel <mathstuf@gmail.com>
---
 obnam.1.in                            |  5 +++++
 obnamlib/plugins/encryption_plugin.py | 15 ++++++++++++---
 2 files changed, 17 insertions(+), 3 deletions(-)

diff --git a/obnam.1.in b/obnam.1.in
index bb9bd0e..71772d5 100644
--- a/obnam.1.in
+++ b/obnam.1.in
@@ -426,6 +426,11 @@ and then tell
 about it using the
 .B \-\-encrypt\-with
 option.
+You may optionally use a separate home directory using the
+.B \-\-gpg-homedir
+option. By default, the default directory for
+.BR gpg(1)
+will be used.
 .SS "Configuration files"
 .B obnam
 will look for configuration files in a number of locations.
diff --git a/obnamlib/plugins/encryption_plugin.py b/obnamlib/plugins/encryption_plugin.py
index ec3bcca..6e7c2b1 100644
--- a/obnamlib/plugins/encryption_plugin.py
+++ b/obnamlib/plugins/encryption_plugin.py
@@ -49,6 +49,11 @@ class EncryptionPlugin(obnamlib.ObnamPlugin):
             'size of symmetric key, in bits',
             metavar='BITS',
             group=encryption_group)
+        self.app.settings.string(
+            ['gpg-homedir'],
+            'home directory for GPG',
+            metavar='HOMEDIR',
+            group=encryption_group)
 
         self.tag = "encrypt1"
 
@@ -87,7 +92,7 @@ class EncryptionPlugin(obnamlib.ObnamPlugin):
     @property
     def pubkey(self):
         if self._pubkey is None:
-            self._pubkey = obnamlib.get_public_key(self.keyid)
+            self._pubkey = obnamlib.get_public_key(self.keyid, gpghome=self.gpg_homedir)
         return self._pubkey
 
     @property
@@ -98,6 +103,10 @@ class EncryptionPlugin(obnamlib.ObnamPlugin):
             return '/dev/random'
 
     @property
+    def gpg_homedir(self):
+        return self.app.settings.get('gpg-homedir')
+
+    @property
     def symmetric_key_bits(self):
         return int(self.app.settings['symmetric-key-bits'] or '256')
 
@@ -139,7 +148,7 @@ class EncryptionPlugin(obnamlib.ObnamPlugin):
         key = self._symkeys.get(repo, toplevel)
         if key is None:
             encoded = repo.get_fs().cat(os.path.join(toplevel, 'key'))
-            key = obnamlib.decrypt_with_secret_keys(encoded)
+            key = obnamlib.decrypt_with_secret_keys(encoded, gpghome=self.gpg_homedir)
             self._symkeys.put(repo, toplevel, key)
         return key
 
@@ -222,7 +231,7 @@ class EncryptionPlugin(obnamlib.ObnamPlugin):
     def _get_key_string(self, keyid):
         verbose = self.app.settings['key-details']
         if verbose:
-            user_ids = obnamlib.get_public_key_user_ids(keyid)
+            user_ids = obnamlib.get_public_key_user_ids(keyid, gpghome=self.gpg_homedir)
             if user_ids:
                 return "%s (%s)" % (keyid, ", ".join(user_ids))
         return str(keyid)
-- 
2.5.1


_______________________________________________
obnam-dev mailing list
obnam-dev@obnam.org
http://listmaster.pepperfish.net/cgi-bin/mailman/listinfo/obnam-dev-obnam.org