tor opens multiple ports if `ExtORPort auto` is used multiple times; only uses one of them
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.