Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#6507 closed defect (fixed)

Explicit "ORPort 0" should still trigger client mode

Reported by: zwol Owned by:
Priority: High Milestone: Tor: 0.2.3.x-final
Component: Core Tor/Tor Version: Tor: 0.2.3.19-rc
Severity: Keywords: tor-client
Cc: Actual Points:
Parent ID: Points:
Reviewer: Sponsor:

Description

I have some scripts (which worked with 0.2.2.x) that explicitly specify "ORPort 0" in torrc files they generate for a Tor process that's meant to run in client mode. With 0.2.3.x, this seems to put the configuration parser into server mode, and then it bombs out because it doesn't like UseBridges=1 in server mode.

Child Tickets

Change History (10)

comment:1 Changed 7 years ago by nickm

Milestone: Tor: 0.2.3.x-final

ug. Looks like there are still a few checks "options->ORPort" as a boolean.

Two options:

  • Revise the parsing code, so that 'FooPort 0' clears out the FooPort options, and makes option->FooPort become NULL.
  • Revise everything that looks at (options->FooPort) as a boolean.

It looks like there are still 5 boolean checks for ORPort, 12 boolean checks for DirPort, 2 for TransPort, and 1 for ControlPort. That makes 19 places in the code to fix altogether if we take the second approach. I'm thinking that the first might make more sense.

comment:2 Changed 7 years ago by nickm

Hm. On the other hand, parse_port_config uses "FooPort 0" to mean "Ignore the default setting for the port if there is one." So revising the parsing code so that SocksPort 0 was the same as providing no SOCKSPort would be broken. That means that the first option isn't so great.

And on the other hand, scanning the options to see whether an ORPort is set or not probably requires actually parsing them, to so that NoListen addresses don't get counted. That means that the second option isn't as easy as replacing all the options->FooPort with a new function call.

More thought needed.

comment:3 Changed 7 years ago by arma

If you put

SocksPort 9050
SocksPort 0

in your torrc, it gives you a socksport.

If you put

SocksPort 9050

in your torrc and then start Tor with socksport 0 on the commandline, it disables your socksport.

Not wrong, maybe, but not totally intuitive either.

comment:4 Changed 7 years ago by nickm

That's mostly correct, since command line overrides torrc. The part that's wrong there is that "SocksPort 0" shouldn't be allowed in the same configuration domain as an actual socks configuration: if you say socksport 9050 in your torrc, saying socksport 0 there too ought not be allowed.

comment:5 Changed 7 years ago by nickm

Status: newneeds_review

Please review branch "bug6507"

comment:6 Changed 7 years ago by nickm

Priority: normalmajor

comment:7 Changed 7 years ago by nickm

Okay, still looks fine to me, and it's gone a week without review. Merging.

comment:8 Changed 7 years ago by nickm

Resolution: fixed
Status: needs_reviewclosed

comment:9 Changed 7 years ago by nickm

Keywords: tor-client added

comment:10 Changed 7 years ago by nickm

Component: Tor ClientTor
Note: See TracTickets for help on using tickets.