Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tor control channel #4802

Merged
merged 24 commits into from
Sep 17, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
f01109c
WIP: Tor control channel
riastradh-brave Feb 29, 2020
a415a1f
Add GetSOCKSListeners and cleanup
darkdh Aug 4, 2020
44042fa
Apply auto selected port from tor
darkdh Aug 6, 2020
40b96b4
Fix tor control sequence checker failure
darkdh Aug 8, 2020
f76bab7
Auth cookies might contains 0x00 in the middle of byte stream which will
darkdh Aug 10, 2020
a9ca802
Move TorControl from scoped_refptr to unique_ptr and observer_list to
darkdh Aug 11, 2020
f3e76ef
Merge TorControl and TorControlImpl since we don't have to split depe…
darkdh Aug 11, 2020
f870d70
Monitor tor bootstrap and fix event subscription after relaunch tor w…
darkdh Aug 14, 2020
fe8c516
Cleanup old tor process which was not reaped by utility process
darkdh Aug 19, 2020
d13ff83
Use owner_task_runner for callbacks, delegate methods to simplify the…
darkdh Aug 21, 2020
dae92ba
Use WeakPtr
darkdh Aug 21, 2020
3352cc9
Fix windows issues:
darkdh Aug 22, 2020
0cb59cc
Prevent requests from getting through between tor launched and tor co…
darkdh Aug 24, 2020
28e011f
Fix opening old control channel bug which causes event subscriptions …
darkdh Aug 25, 2020
b746095
Fix tor launcher hanging after tor crashes and
darkdh Aug 25, 2020
f3d6aba
Cleanup: lint, DCHECK, VLOG
darkdh Aug 26, 2020
c4cc2ee
Add BraveOmniboxViewViewsTest.TorInitProgress and fix browser tests D…
darkdh Aug 27, 2020
058dd07
Move TorControl under browser
darkdh Aug 31, 2020
8554c22
Add ReadLine test case
darkdh Sep 11, 2020
a1112da
Remove unused kTorExecutablePath
darkdh Sep 11, 2020
e65243b
Fix TorControl::Delegate callback lifetime issue
darkdh Sep 16, 2020
c667a2c
Address review feedback
darkdh Sep 16, 2020
03f860e
clang-format
darkdh Sep 16, 2020
81567f0
Showing tor status on NTP
darkdh Sep 17, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 0 additions & 15 deletions browser/brave_content_browser_client.cc
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ using extensions::ChromeContentBrowserClientExtensionsPart;

#if BUILDFLAG(ENABLE_TOR)
#include "brave/browser/tor/tor_navigation_throttle.h"
#include "brave/common/tor/switches.h"
#endif

#if BUILDFLAG(ENABLE_SPEEDREADER)
Expand Down Expand Up @@ -257,20 +256,6 @@ void BraveContentBrowserClient::AppendExtraCommandLineSwitches(
command_line->AppendSwitchASCII("brave_session_token",
base::NumberToString(session_token));
}

if (process_type == switches::kUtilityProcess) {
#if BUILDFLAG(ENABLE_TOR)
// This is not ideal because it adds the tor executable as a switch
// for every utility process, but it should be ok until we land a
// permanent fix
base::FilePath path =
g_brave_browser_process->tor_client_updater()->GetExecutablePath();
if (!path.empty()) {
command_line->AppendSwitchPath(tor::switches::kTorExecutablePath,
path.BaseName());
}
#endif
}
}

std::vector<std::unique_ptr<blink::URLLoaderThrottle>>
Expand Down
17 changes: 12 additions & 5 deletions browser/profiles/brave_profile_manager_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
#include "base/strings/utf_string_conversions.h"
#include "brave/browser/profiles/brave_unittest_profile_manager.h"
#include "brave/browser/profiles/profile_util.h"
#include "brave/browser/tor/tor_launcher_factory.h"
#include "brave/browser/tor/tor_profile_service_factory.h"
#include "brave/browser/tor/tor_profile_service_impl.h"
#include "brave/browser/translate/buildflags/buildflags.h"
#include "brave/common/tor/pref_names.h"
#include "brave/common/tor/tor_constants.h"
#include "brave/components/brave_webtorrent/browser/webtorrent_util.h"
#include "chrome/browser/net/proxy_config_monitor.h"
Expand Down Expand Up @@ -253,9 +253,16 @@ TEST_F(BraveProfileManagerTest, ProxyConfigMonitorInTorProfile) {
std::unique_ptr<ProxyConfigMonitor> monitor(new ProxyConfigMonitor(profile));
auto* proxy_config_service = monitor->GetProxyConfigServiceForTesting();
net::ProxyConfigWithAnnotation config;
proxy_config_service->GetLatestProxyConfig(&config);
EXPECT_TRUE(config.value().proxy_rules().empty());

// Emulate get socks info from tor control
auto* tor_profile_service = TorProfileServiceFactory::GetForProfile(profile);
static_cast<tor::TorProfileServiceImpl*>(tor_profile_service)
->NotifyTorNewProxyURI("socks5://127.0.0.1:5566");

proxy_config_service->GetLatestProxyConfig(&config);
const std::string& proxy_uri =
config.value().proxy_rules().single_proxies.Get().ToURI();
EXPECT_EQ(proxy_uri, g_browser_process->local_state()
->GetString(tor::prefs::kTorProxyString));
config.value().proxy_rules().single_proxies.Get().ToURI();
EXPECT_EQ(proxy_uri, "socks5://127.0.0.1:5566");
}
2 changes: 2 additions & 0 deletions browser/tor/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ source_set("tor") {

if (enable_tor) {
sources += [
"tor_control.cc",
"tor_control.h",
"tor_launcher_factory.cc",
"tor_launcher_factory.h",
"tor_navigation_throttle.cc",
Expand Down
Loading