fix(tunnel): pass /absolute/path/to/tor to cretz/bine (#323)
* fix(tunnel): pass /absolute/path/to/tor to cretz/bine It seems cretz/bine is not aware of https://blog.golang.org/path-security for now. I am planning to send over a diff for that later today. In the meanwhile, do the right thing here, and make sure that we obtain the absolute path to the tor binary before we continue. This work is part of https://github.com/ooni/probe-engine/issues/283. * fix tests when tor is not installed
This commit is contained in:
parent
2539a17ff9
commit
a9b3a3b3a5
6 changed files with 136 additions and 5 deletions
|
|
@ -74,10 +74,18 @@ func torStart(ctx context.Context, config *Config) (Tunnel, error) {
|
|||
extraArgs = append(extraArgs, "notice stderr")
|
||||
extraArgs = append(extraArgs, "Log")
|
||||
extraArgs = append(extraArgs, fmt.Sprintf(`notice file %s`, logfile))
|
||||
// Implementation note: here we make sure that we're not going to
|
||||
// execute a binary called "tor" in the current directory on Windows
|
||||
// as documented in https://blog.golang.org/path-security.
|
||||
exePath, err := config.execabsLookPath(config.torBinary())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
config.logger().Infof("tunnel: exec: %s %+v", exePath, extraArgs)
|
||||
instance, err := config.torStart(ctx, &tor.StartConf{
|
||||
DataDir: stateDir,
|
||||
ExtraArgs: extraArgs,
|
||||
ExePath: config.TorBinary,
|
||||
ExePath: exePath,
|
||||
NoHush: true,
|
||||
})
|
||||
if err != nil {
|
||||
|
|
|
|||
Loading…
Reference in a new issue