To create new wiki account, please join us on #znc at Libera.Chat and ask admins to create a wiki account for you. You can say thanks to spambots for this inconvenience.

Tor: Difference between revisions

From ZNC
Jump to navigation Jump to search
m small additional highlight of "proxychains znc"
m added note about proxychains4
Line 46: Line 46:
  sudo /etc/init.d/tor restart
  sudo /etc/init.d/tor restart
...and now you will be able to connect to that .onion address in ZNC by using the server address of ''10.99.99.90''. For each .onion address you would like to resolve, just add another mapaddress line.
...and now you will be able to connect to that .onion address in ZNC by using the server address of ''10.99.99.90''. For each .onion address you would like to resolve, just add another mapaddress line.
'''NOTE''': With proxychains4 it has been reported that the above use of mapaddress via the torrc file is no longer needed (as it was with proxychains 3.1 and earlier), and may even cause problems doing so, and freenodeok2gncmy.onion can be specified directly in ZNC as the server address.


[[Category: Software]]
[[Category: Software]]

Revision as of 20:03, 12 March 2020

Introduction

This has been copied from http://area51archives.com/index.php?title=Using_ZNC_with_Tor&action=edit

Alternative method

There is an open issue at GitHub on supporting SOCKS proxies directly and there user ErebusBat gives alternative method quoted below.



FYI this can be easily accomplished using socat by running the following command on the ZNC server, then using 127.0.0.1:4321 as the server in ZNC.

Freenode via TOR: socat TCP4-LISTEN:4321,fork SOCKS4A:localhost:freenodeok2gncmy.onion:6697,socksport=9050

Assume you just want to use proxy.mycompany.com:8080 as your SOCKS proxy, then the command would be: socat TCP4-LISTEN:4321,fork SOCKS4A:proxy.mycompany.com:freenodeok2gncmy.onion:6697,socksport=8080

Obviously you can replace the .onion address with another IRC server, or change the port.

Installing Tor

Follow the instructions at the tor installation guide.

Installing ZNC

The installation page gives you an easy walkthrough on compiling and install ZNC for your distribution of choice. This page will have the most up to date version listed quicker than the PPA listed below. For novices, the PPA should serve to be easier to maintain, but comes with a potential lapse of updates. It's your choice.

For Ubuntu-based distros, please refer to the Ubuntu section in the installation guide to install ZNC.

After you have compiled and/or installed znc, you need to configure znc before continuing by running:

znc --makeconf

At the end of the makeconf screen when it asks if you would like to launch ZNC, select "no."

ProxyChains

Tor ships with a SOCKS proxy which is used to tunnel traffic through the Tor network. ZNC doesn't have the option to use SOCKS proxies, that's where ProxyChains comes in. ProxyChains allows you to force an application to use a SOCKS proxy. Luckily, ProxyChains is configured to work with Tor out of the box! You may already have ProxyChains installed. If not, it's a simple run of this command to get it:

sudo apt-get install proxychains

If you are not able to get it via apt, or are not using Ubuntu, you can acquire the source from the ProxyChains website.

.onion Resolution

At this point, you can simply run proxychains znc from the command line. This will start up znc and tunnel its connections via Tor. However, it will not work if you attempt to connect to .onion addresses. If you run znc as a system service, then you'll need to edit that config file to launch znc via proxychains. What we will have to do instead, is map an IP address in the Tor configuration to resolve to the .onion address. This is annoying, but it's really your only shot of making this work. You will want to use an IP range that you will not use, and never plan on using. Let's say you want to connect to 2600net. The .onion address is awwqg2ishrohngue.onion. You would need to open the /etc/tor/torrc file and add at the end of the file:

mapaddress  10.99.99.90 awwqg2ishrohngue.onion

If you were to try to connect to freenode's hidden service (via tor-sasl), you would instead add at the end of the /etc/tor/torrc file:

mapaddress  10.99.99.90 freenodeok2gncmy.onion

Save the file, and restart Tor using:

sudo /etc/init.d/tor restart

...and now you will be able to connect to that .onion address in ZNC by using the server address of 10.99.99.90. For each .onion address you would like to resolve, just add another mapaddress line.

NOTE: With proxychains4 it has been reported that the above use of mapaddress via the torrc file is no longer needed (as it was with proxychains 3.1 and earlier), and may even cause problems doing so, and freenodeok2gncmy.onion can be specified directly in ZNC as the server address.