Opened 9 months ago

Closed 9 months ago

#33074 closed defect (not a bug)

tor opens multiple ports if `ExtORPort auto` is used multiple times; only uses one of them

Reported by: dcf Owned by:
Priority: Medium Milestone: Tor: unspecified
Component: Core Tor/Tor Version:
Severity: Normal Keywords:
Cc: Actual Points:
Parent ID: Points:
Reviewer: Sponsor:

Description

Create a file logenv and make it executable:

#!/bin/sh
env >> env.txt

Run tor with this torrc:

SocksPort 0
ORPort auto
BridgeRelay 1
PublishServerDescriptor 0

ServerTransportPlugin logenv exec ./logenv

ExtORPort auto
ExtORPort auto
ExtORPort auto
ExtORPort auto
ExtORPort auto

The 5 instances of ExtORPort auto cause tor to open 5 separate ports:

Jan 28 02:13:57.497 [notice] Opening Extended OR listener on 127.0.0.1:0
Jan 28 02:13:57.497 [notice] Extended OR listener listening on port 45725.
Jan 28 02:13:57.497 [notice] Opened Extended OR listener on 127.0.0.1:0
Jan 28 02:13:57.497 [notice] Opening Extended OR listener on 127.0.0.1:0
Jan 28 02:13:57.497 [notice] Extended OR listener listening on port 38173.
Jan 28 02:13:57.497 [notice] Opened Extended OR listener on 127.0.0.1:0
Jan 28 02:13:57.497 [notice] Opening Extended OR listener on 127.0.0.1:0
Jan 28 02:13:57.497 [notice] Extended OR listener listening on port 34313.
Jan 28 02:13:57.497 [notice] Opened Extended OR listener on 127.0.0.1:0
Jan 28 02:13:57.497 [notice] Opening Extended OR listener on 127.0.0.1:0
Jan 28 02:13:57.498 [notice] Extended OR listener listening on port 44593.
Jan 28 02:13:57.498 [notice] Opened Extended OR listener on 127.0.0.1:0
Jan 28 02:13:57.498 [notice] Opening Extended OR listener on 127.0.0.1:0
Jan 28 02:13:57.498 [notice] Extended OR listener listening on port 40255.
Jan 28 02:13:57.498 [notice] Opened Extended OR listener on 127.0.0.1:0

Only one of them (the first one logged) is actually given to the pluggable transport:

$ grep ^TOR_PT_EXTENDED_SERVER_PORT env.txt 
TOR_PT_EXTENDED_SERVER_PORT=127.0.0.1:45725

I expected that tor would report an error if ExtORPort were used more than once, or perhaps deduplicate multiple identical ExtORPort lines.

Child Tickets

Change History (3)

comment:1 Changed 9 months ago by nickm

Milestone: Tor: unspecified

So, I would have expected something closer to the current behavior:

  1. Multiple ExtORPort lines cause Tor to open multiple ExtORPorts.
  2. auto here means more or less "open a port at an address you pick".

What do other people think? Is this a bug, or working as intended?

comment:2 in reply to:  1 Changed 9 months ago by dcf

Replying to nickm:

So, I would have expected something closer to the current behavior:

  1. Multiple ExtORPort lines cause Tor to open multiple ExtORPorts.
  2. auto here means more or less "open a port at an address you pick".

Okay, I can appreciate that viewpoint as well. I tend to forget that torrc is more imperative than declarative. The handling of ExtORPort is consistent, in my testing, with that of SOCKSPort and ORPort: multiple line cause multiple ports to be opened, with the only error condition being if you use both port number 0 and something non-0. I can see how it could be useful to open up an additional ExtORPort at a static port number, for some kind of externally managed pluggable transport integration, even if that port number is not the one that gets advertised through TOR_PT_EXTENDED_SERVER_PORT.

comment:3 Changed 9 months ago by dcf

Resolution: not a bug
Status: newclosed
Note: See TracTickets for help on using tickets.