-
-
Notifications
You must be signed in to change notification settings - Fork 259
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 external process - Allows Trezor Suite use Tor from Tails OS #15642
base: develop
Are you sure you want to change the base?
Conversation
e58e29e
to
41b74a6
Compare
6c177a3
to
39fcd71
Compare
c5882bc
to
c6b8e46
Compare
c6b8e46
to
cd010d9
Compare
cd010d9
to
0628e51
Compare
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.
Sorry, I haven't reviewed the most important parts yet, so I just put here some observations for now.
61c8bec
to
8e2cbed
Compare
@marekrjpolak I had to rebase because new yarn version in develop was breaking the ci tests in this branch. |
@marekrjpolak I added some commits to remove the experimental feature But the tor-external is the same, I have just removed snowflake stuff. And tested all the core functionalities and edge cases that I considered critical and they are OK. |
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.
Sorry for having to wait this long for my review.
- Apart from some rather small comments, it looks good I believe
- Politically, I don't think anything about removing Snowflake from Suite, so I'm willing to approve with or without it. 🤷
- I still haven't tested it, so I'm gonna do it right now.
|
||
export type ExperimentalFeatureConfig = { | ||
title: TranslationKey; | ||
description: TranslationKey; | ||
isDesktopOnly: boolean; |
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.
I wouldn't add new isDesktopOnly
but use existing isDisabled
(which seems unused right now) instead. Or the other way around, remove isDisabled
? Anyway, the double filtering in Experimental.tsx seems unnecessary.
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 true, I did not realized of that. Thanks
72259fa
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.
Probably should be negated :)
packages/suite/src/views/settings/SettingsGeneral/Experimental.tsx
Outdated
Show resolved
Hide resolved
errorMessages.push(error.message); | ||
throw new Error('Tor not alive'); | ||
}; | ||
const params: ScheduleActionParams = { |
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 is much better, in my opinion. Just two things:
timeout
is a limit for one action attempt after which it throws instead, whilegap
is a delay between two consecutive attempts. It's perfectly fine to have both defined, I just want to make sure that it's what you want.- I think there's no need for
abortController
check inside an action and aborting it fromattemptFailureHandler
, as thegetIsStopped
check could be done in the action itself, which makesattemptFailureHandler
redundant.. If you're not against, I can try to propose an adjustment after the review.
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.
Would this work for you?
const checkConnection: ScheduledAction<boolean> = async () => {
if (this.getIsStopped()) return false;
const isConnected = await this.controlPort.connect();
const isAlive = this.controlPort.ping();
const isCircuitEstablished = this.getIsCircuitEstablished();
// It is running so let's not wait anymore.
if (isConnected && isAlive && isCircuitEstablished) {
return true;
}
throw new Error('Tor not alive');
};
const params: ScheduleActionParams = {
attempts: MAX_TRIES_WAITING,
timeout: WAITING_TIME,
gap: WAITING_TIME,
};
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.
I understood the difference between timeout
and gap
, and think in this case both are necessary.
Regarding abortController
if you want to propose and adjustment, it is welcome :)
const processes = [ | ||
{ | ||
type: 'tor', | ||
process: new TorProcess({ | ||
host: settings.host, | ||
port: settings.port, | ||
controlPort: settings.controlPort, | ||
torDataDir: settings.torDataDir, | ||
}), | ||
}, | ||
{ | ||
type: 'tor-external', | ||
process: new TorExternalProcess(), | ||
}, | ||
]; | ||
|
||
const getTarget = () => { | ||
const { useExternalTor } = store.getTorSettings(); | ||
const currentTarget = useExternalTor ? 'tor-external' : 'tor'; | ||
|
||
return processes.find(process => process.type === currentTarget)!.process; | ||
}; | ||
|
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.
I believe it could be enough to have two const
s for two different processes here and select one or another based on useExternalTor
, instead of finding in an array.
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 that works and simpler. 1d3da5a
@karliatto it seems to work with external Tor for me 👍 . I'm sometimes able to break it by turning the external experimental feature off while Tor is on in Suite (so it probably doesn't start the internal Tor process?) but it's a corner case anyway, right? |
Yes, that is kind of corner case in my opinion. If you do that, you need to switch Tor off/on so it starts internal Tor process. |
Description
This PR allows to run Trezor Suite with external Tor, in order to
Like every great power it comes with great responsibility, so when running Tor External user could do something wrong that ruins their privacy so user has to know what he is doing when using this feature.
checkSocks5Proxy
to make sure there is a socks5 proxy running in the port for External Tor.checkSocks5Proxy
TorExternalProcess
to allow handle external Tor and update the Tor module so it can change from bundled Tor to External Tor.useExternalTor
External Tor
to experimental features in Suite.How to test it:
9050
- Not necessary in Tails since it is running by default - but you need to make sure the circuit are established - Tails will ask you for it when starting.When running and doing discover with a device connected you should be able to make sure that all the connection is going throw Tor by running
watch -n 1 'lsof -i TCP | grep electron'
and checking that there is not connection going to the open internet. You should see TCP connection tolocalhost:9050
and no connection to anything else that is not inlocalhost:xxxx
.Related Issue
Resolve #5819 After 2 years open. 🎉