5

I would like to run Tor on my Mac, such that another program (a Ruby script) can make HTTP requests through my running Tor process. I installed via "sudo port install tor" and then launched tor like so

tor --CookieAuthentication 0 --HashedControlPassword "" --ControlPort 9050 --SocksPort 50001

But I'm confused about the difference between ControlPort and SocksPort. In my script, should I be connecting to 127.0.0.1:9050 or to 127.0.0.1:50001?

Thanks, -

3 Answers 3

4

The control port is used for controlling Tor, usually via other software like Arm.

The Socks port is the port running as a SOCKS5 proxy. This is the one you want to use. Please note that Tor is not an HTTP proxy, so your script will need to be configured to use a SOCKS5 proxy.

1
  • So if I were connecting on Telnet, would I connect via "127.0.0.1:50001"?
    – Dave
    Sep 17, 2016 at 17:00
1

SocksPort is for accepting SOCKS connections from tor clients(=applications that will be "torified"), ControlPort is for communicating with tor controllers, i.e. applications that are interacting and possibly modifying tor's configuration(like "running config" on Cisco)

1

The SOCKSPort is for talking to other applications. Tor runs as a SOCKS proxy and other applications (like a web browser, another proxy etc.) could connect to it. The manpage writes:

SOCKSPort [address:]port|unix:path|auto [flags] [isolation flags]

Open this port to listen for connections from SOCKS-speaking applications.

The ControlPort is for connecting with the Tor process and sending it commands. You can use the ControlPort for changing the configuration, getting information about the network, Tor circuits etc. The manpage writes:

ControlPort PORT|unix:path|auto [flags]

If set, Tor will accept connections on this port and allow those connections to control the Tor process using the Tor Control Protocol (described in control-spec.txt).

So your Ruby software should talk to port 50001, the SOCKSPort. However you wrote about HTTP requests. Please make sure that your Ruby software will issue SOCKS requests or you might run into other problems. Depending on the kind of requests it might be a good idea to use some other HTTP proxy (like Privoxy) between your Ruby software and Tor.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .