summaryrefslogtreecommitdiffstats
path: root/config/chroot_local-patches/0002-Allow-specifying-that-Enigmail-keyserver-communicati.patch
blob: 0a19508141fdfd130eaa2f9a2ab82c3b9d9b995a (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
From: intrigeri <intrigeri@boum.org>
Date: Tue, 31 Jan 2017 16:04:33 +0000
Subject: Allow specifying that Enigmail keyserver communication is torified
 already.

This can be done by setting extensions.torbirdy.enigmail.already_torified
to true.

It is needed e.g. when using GnuPG 2.1+, in which case these keyserver options
break dirmngr:

  no-try-dns-srv,http-proxy=socks5h://127.0.0.1:9150

... as reported e.g. on https://trac.torproject.org/projects/tor/ticket/19971
and https://labs.riseup.net/code/issues/11948.

The correct way to torify keyserver communication with Modern GnuPG is to set
"use-tor" in ~/.gnupg/dirmngr.conf. Let's not break things for users who have
configured this properly, e.g. Tails.

Note that the Enigmail master branch has code to use Tor for keyserver
operations. My understanding of the code is that it supports GnuPG 2 nicely, and
detects whether dirmngr is already configured to use Tor. Once that's released
and ready for production use, the parts of the Torbirdy code that are about
torifying Enigmail communication with keyservers can go away:

  https://sourceforge.net/p/enigmail/source/ci/74e19771ec18cd5e7b542c32a9b34d47697f50ed/

... which is why I didn't bother investing time into a nicer solution on
Torbirdy's side.
---
 chrome/content/overlay.js     |  1 +
 chrome/content/preferences.js | 13 ++++++++-----
 defaults/preferences/prefs.js |  1 +
 3 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/chrome/content/overlay.js b/chrome/content/overlay.js
index 1f72c9d..f0c0304 100644
--- a/usr/share/xul-ext/torbirdy/chrome/content/overlay.js
+++ b/usr/share/xul-ext/torbirdy/chrome/content/overlay.js
@@ -40,6 +40,7 @@
         // Tor.
         if (type === 0) {
           myPanel.label = strbundle.getString("torbirdy.enabled.tor");
+          org.torbirdy.prefs.setProxyTor();
         }
         // JonDo/Whonix.
         if (type === 1) {
diff --git a/chrome/content/preferences.js b/chrome/content/preferences.js
index 87f46aa..73ef18f 100644
--- a/usr/share/xul-ext/torbirdy/chrome/content/preferences.js
+++ b/usr/share/xul-ext/torbirdy/chrome/content/preferences.js
@@ -41,17 +41,19 @@ if (!org.torbirdy.prefs) org.torbirdy.prefs = new function() {
     if (pub.prefs.getBoolPref("extensions.torbirdy.enigmail.throwkeyid")) {
       opts += "--throw-keyids ";
     }
-    var proxy = "socks5h://127.0.0.1:9050";
-    if (anonService === "jondo") {
-      proxy = "http://127.0.0.1:4001";
+    if (! pub.prefs.getBoolPref("extensions.torbirdy.gpg_already_torified")) {
+      var proxy = "socks5h://127.0.0.1:9050";
+      if (anonService === "jondo") {
+        proxy = "http://127.0.0.1:4001";
+      }
+      opts += "--keyserver-options=no-try-dns-srv,http-proxy=" + proxy + " ";
     }
 
     return opts +
            "--no-emit-version " +
            "--no-comments " +
            "--display-charset utf-8 " +
-           "--keyserver-options no-auto-key-retrieve,no-try-dns-srv,http-proxy=" +
-           proxy;
+           "--keyserver-options no-auto-key-retrieve";
   };
 
   pub.updateKeyserver = function(anonService) {
@@ -201,6 +203,7 @@ if (!org.torbirdy.prefs) org.torbirdy.prefs = new function() {
 
     pub.setPanelSettings(pub.strBundle.GetStringFromName("torbirdy.enabled.tor"), "green");
     pub.prefs.setIntPref(pub.prefBranch + 'proxy', 0);
+    pub.setPreferences("extensions.enigmail.agentAdditionalParam", pub.setEnigmailPrefs("tor"));
   };
 
   pub.setProxyJonDo = function() {
diff --git a/defaults/preferences/prefs.js b/defaults/preferences/prefs.js
index 8b43562..ea316d3 100644
--- a/usr/share/xul-ext/torbirdy/defaults/preferences/prefs.js
+++ b/usr/share/xul-ext/torbirdy/defaults/preferences/prefs.js
@@ -5,6 +5,7 @@ pref("extensions.torbirdy.warn", true);
 pref("extensions.torbirdy.startup_folder", false);
 pref("extensions.torbirdy.enigmail.throwkeyid", false);
 pref("extensions.torbirdy.enigmail.confirmemail", false);
+pref("extensions.torbirdy.gpg_already_torified", false);
 pref("extensions.torbirdy.timezone", true);
 pref("extensions.torbirdy.whonix_run", true);
 pref("extensions.torbirdy.info_run", false);