-
Notifications
You must be signed in to change notification settings - Fork 893
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
Tor control channel #4802
Conversation
88f5bdf
to
f0f8170
Compare
d7f8272
to
54647a3
Compare
7a8c911
to
137c310
Compare
72d7c33
to
7c2cfe7
Compare
af889e8
to
429c208
Compare
b4d9660
to
15d1a5e
Compare
--- a/sandbox/policy/win/sandbox_win.cc | ||
+++ b/sandbox/policy/win/sandbox_win.cc | ||
@@ -887,6 +887,7 @@ ResultCode SandboxWin::StartSandboxedProcess( | ||
launcher_process_command_line.HasSwitch(switches::kNoSandbox)) { | ||
base::LaunchOptions options; | ||
options.handles_to_inherit = handles_to_inherit; | ||
+ BraveLaunchOption(cmd_line, &options); | ||
+ BraveLaunchOption(process_type, &options); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we convert this to a define since you're changing it anyway?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sure, will do
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
browser/tor/tor_control.cc
Outdated
#else | ||
const char maxpid[] = "4194304"; // 0x400000 | ||
#endif | ||
const size_t kBufSiz = strlen(maxpid); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't look right, the pid string is not going to be 4294967292 characters long and this whole thing seems overly complicated. Why aren't we just reading the file as a string like normal?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That is strlen of it so it would be 10 characters long max on Windows and 7 characters long on POSIX
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
but yeah, will just read the file as a string
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed in 12c003763561ef5dc1ef014d4769d24a84c58883
browser/tor/tor_control.cc
Outdated
} | ||
|
||
// XXX DEBUG | ||
static std::string escapify(const char *buf, int len) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should be at the top in an anonymous namespace
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed in 12c003763561ef5dc1ef014d4769d24a84c58883
browser/tor/tor_launcher_factory.cc
Outdated
KillTorProcess(); | ||
// Post delayed relaucn for control to stop | ||
content::GetUIThreadTaskRunner({}) | ||
->PostDelayedTask(FROM_HERE, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit - 4 spaces for continuation of a line
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed in 60f91be
Remove kTorProxyString without migration is becasue it was always default value
cause the cookies to be truncated if we store it as std::string
…ndency and it is fully encapsulated by TorLauncherFactory
… flow Also remove unused ReLaunch
1. Build failed 2. Not handling CRLF when reading port file 3. Not checking process validity before killing it Fix tor crash handler is not getting called
relaunch tor with 1s interval when tor crashes
…CHECK failure fix lint
and remove owner_task_runner to avoid confusion
4f3a328
to
81567f0
Compare
Resolves brave/brave-browser#359
Resolves brave/brave-browser#649
Resolves brave/brave-browser#1113
Tor control channel spec:
https://gitweb.torproject.org/torspec.git/plain/control-spec.txt
This PR implements access to the Tor control socket, which lets us monitor the status of the tor daemon and control it without restarting it. This is a necessary step for brave/brave-browser#649, as well as getting the progress bar that browser-laptop used to have, along with other amenities like displaying where the exit nodes you're using are.
Also it improves tor crashes or tor launcher crashes with cleanup method before launch.
Work to do before merge:
Follow-up issues:
GETINFO VERSION
somewhere, perhaps inbrave://version
or inbrave://tor
as in Expose Tor log inbrave://tor
brave-browser#8106.Submitter Checklist:
npm run lint
)git rebase master
(if needed).git rebase -i
to squash commits (if needed).Test Plan:
OS-chosen port for tor
On Mac and Linux:
lsof -nP -iTCP -sTCP:LISTEN
On Windows:
netstat -ano -p tcp -b
(requires admin privileges because of-b
)There are two port, one is control port (which should be same as
user_dir/tor/watch/controlport
) another is what we really care about. (should not be 9250, 9260, 9270, 9280, or 9290)Tor initialization progress indicator
Tor process crash handling
tor-VERSION-PLATFORM-brave-REVISION
, eg tor-0.3.5.11-darwin-brave-0)Tor launcher crash handling
Reviewer Checklist:
After-merge Checklist:
changes has landed on.