[tbb-commits] [tor-launcher/master] Bug 25405: cannot use Moat if a meek bridge is configured

gk at torproject.org gk at torproject.org
Mon Sep 3 08:52:22 UTC 2018


commit a5791ec33537b5efefb5c64c240e48d9ce1c8721
Author: Kathy Brade <brade at pearlcrescent.com>
Date:   Tue Mar 6 15:39:11 2018 -0500

    Bug 25405: cannot use Moat if a meek bridge is configured
    
    When doing Moat things, use a separate profile for the secondary browser
    (instead of trying to use the main meek helper profile). This is
    accomplished by setting a TOR_BROWSER_MEEK_PROFILE environment variable
    which meek-client-torbrowser uses to get the profile path if it is set.
---
 src/modules/tl-bridgedb.jsm |  9 +++++++--
 src/modules/tl-util.jsm     | 19 +++++++++++++++++--
 2 files changed, 24 insertions(+), 4 deletions(-)

diff --git a/src/modules/tl-bridgedb.jsm b/src/modules/tl-bridgedb.jsm
index 339cb39..8b7a1d6 100644
--- a/src/modules/tl-bridgedb.jsm
+++ b/src/modules/tl-bridgedb.jsm
@@ -224,17 +224,22 @@ _MoatRequestor.prototype =
     }
 
     let ptStateDir = TorLauncherUtil.getTorFile("tordatadir", false);
-    if (!ptStateDir)
+    let meekHelperProfileDir = TorLauncherUtil.getTorFile("pt-profiles-dir",
+                                                          true);
+    if (!ptStateDir || !meekHelperProfileDir)
     {
       let msg = TorLauncherUtil.getLocalizedString("datadir_missing");
       return Promise.reject(new Error(msg));
     }
     ptStateDir.append("pt_state");  // Match what tor uses.
 
+    meekHelperProfileDir.appendRelativePath("profile.moat-http-helper");
+
     let envAdditions = { TOR_PT_MANAGED_TRANSPORT_VER: "1",
                          TOR_PT_STATE_LOCATION: ptStateDir.path,
                          TOR_PT_EXIT_ON_STDIN_CLOSE: "1",
-                         TOR_PT_CLIENT_TRANSPORTS: this.kTransport };
+                         TOR_PT_CLIENT_TRANSPORTS: this.kTransport,
+                         TOR_BROWSER_MEEK_PROFILE: meekHelperProfileDir.path };
     if (this.mLocalProxyURL)
       envAdditions.TOR_PT_PROXY = this.mLocalProxyURL;
 
diff --git a/src/modules/tl-util.jsm b/src/modules/tl-util.jsm
index 292f88b..36abeaa 100644
--- a/src/modules/tl-util.jsm
+++ b/src/modules/tl-util.jsm
@@ -561,6 +561,8 @@ let TorLauncherUtil =  // Public
             path = "Tor\\torrc";
           else if ("tordatadir" == aTorFileType)
             path = "Tor";
+          else if ("pt-profiles-dir" == aTorFileType)
+            path = "Tor\\PluggableTransports";
         }
         else if (this.isMac)
         {
@@ -574,6 +576,8 @@ let TorLauncherUtil =  // Public
             path = "Tor/torrc";
           else if ("tordatadir" == aTorFileType)
             path = "Tor";
+          else if ("pt-profiles-dir" == aTorFileType)
+            path = "Tor/PluggableTransports";
           else if (isIPC)
             path = "Tor/" + ipcFileName;
         }
@@ -589,6 +593,8 @@ let TorLauncherUtil =  // Public
             path = "Tor/torrc";
           else if ("tordatadir" == aTorFileType)
             path = "Tor";
+          else if ("pt-profiles-dir" == aTorFileType)
+            path = "Tor/PluggableTransports";
           else if (isIPC)
             path = "Tor/" + ipcFileName;
         }
@@ -606,7 +612,9 @@ let TorLauncherUtil =  // Public
           path = "Data\\Tor\\torrc";
         else if ("tordatadir" == aTorFileType)
           path = "Data\\Tor";
-      }
+        else if ("pt-profiles-dir" == aTorFileType)
+          path = "Data\\Browser";
+        }
       else // Linux, Mac OS and others.
       {
         // This block is also used for the non-TorBrowser-Data/ case.
@@ -620,6 +628,8 @@ let TorLauncherUtil =  // Public
           path = "Data/Tor/torrc";
         else if ("tordatadir" == aTorFileType)
           path = "Data/Tor";
+        else if ("pt-profiles-dir" == aTorFileType)
+          path = "Data/Browser";
         else if (isIPC)
           path = "Data/Tor/" + ipcFileName;
       }
@@ -662,10 +672,15 @@ let TorLauncherUtil =  // Public
         {
           try
           {
-            if ("tordatadir" == aTorFileType)
+            if (("tordatadir" == aTorFileType) ||
+                ("pt-profiles-dir" == aTorFileType))
+            {
               torFile.create(torFile.DIRECTORY_TYPE, 0o700);
+            }
             else
+            {
               torFile.create(torFile.NORMAL_FILE_TYPE, 0o600);
+            }
           }
           catch (e)
           {



More information about the tbb-commits mailing list