DEV Community

loading...
Cover image for How to set up a proxy server in Kali Linux

How to set up a proxy server in Kali Linux

dennismaina profile image Dennis Maina ・3 min read

We all hate it knowing that we are leaving our prints on the internet every time we surf. Or maybe you want to access a service that is not allowed in your location and you simply can't. This article will help you become anonymous on the internet and overcome some of those barriers. Let's have some fun.

Disclaimer: This article is purely for educational purposes only. I am not liable for any malicious intent done with this information.

Required tools

  • tor
  • proxychains

Proxychains is an open-source software and mostly comes pre-installed in Kali Linux. This tool redirects TCP connections through proxies like TOR, SOCKS4, and SOCKS5 and as the name suggests, it allows us to chain proxy servers. With this tool we can hide the source address of our traffic and evade IDS and Firewalls.

To install tor, run this command in your terminal.

sudo apt install tor
Enter fullscreen mode Exit fullscreen mode

To install proxychains, run this command.

sudo apt install proxychains
Enter fullscreen mode Exit fullscreen mode

Next, we're going to edit the procychains configuration file.
You can edit this using your favorite text editor. In our case, we're going to be using nano editor which runs in the terminal.
On your terminal type,

sudo nano /etc/proxychains.conf
Enter fullscreen mode Exit fullscreen mode

After opening the file, we need to do a few changes;
To enable a functionality, remove the '#' at the beginning of that line, and to disable add a '#' at the beginning of that line.

  • Look for the line with dynamic_chain and enable it.
  • Look for the line with strict_chain and disable it.
  • Look for the line with proxy_dns and enable it.
  • Look for the line with Proxy DNS requests - no leak for DNS data and enable it.
  • Add tor socks5 at the end.

Now, your file should look something like this.

# proxychains.conf  VER 3.1
#
# HTTP, SOCKS4, SOCKS5 tunneling proxifier with DNS.
#       

# The option below identifies how the ProxyList is treated.
# only one option should be uncommented at time,
# otherwise the last appearing option will be accepted
#
dynamic_chain
#
# Dynamic - Each connection will be done via chained proxies
# all proxies chained in the order as they appear in the list
# at least one proxy must be online to play in chain
# (dead proxies are skipped)
# otherwise EINTR is returned to the app
#
#strict_chain
#
# Strict - Each connection will be done via chained proxies
# all proxies chained in the order as they appear in the list
# all proxies must be online to play in chain
# otherwise EINTR is returned to the app
#
#random_chain
#
# Random - Each connection will be done via random proxy
# (or proxy chain, see  chain_len) from the list.
# this option is good to test your IDS :)

# Make sense only if random_chain
#chain_len = 2

# Quiet mode (no output from library)
#quiet_mode

Proxy DNS requests - no leak for DNS data
proxy_dns
# Some timeouts in milliseconds
tcp_read_time_out 15000
tcp_connect_time_out 8000

# ProxyList format
#       type  host  port [user pass]
#       (values separated by 'tab' or 'blank')
#
#
#        Examples:
#
#               socks5  192.168.67.78   1080    lamer   secret
#               http    192.168.89.3    8080    justu   hidden
#               socks4  192.168.1.49    1080
#               http    192.168.39.93   8080    
#
#
#       proxy types: http, socks4, socks5
#        ( auth types supported: "basic"-http  "user/pass"-socks )
#
[ProxyList]
# add proxy here ...
# meanwile
# defaults set to "tor"
socks4  127.0.0.1 9050
socks5 127.0.0.1 9050
Enter fullscreen mode Exit fullscreen mode

Now save the changes by pressing CTRL + O then ENTER followed by CTRL + X to exit.

SOCKS is an internet protocol that routes packets between a server and a client using a proxy server.
127.0.0.1 is the loopback IP address.
9050 is the port by default TOR listens on for proxy connections.

Finally, start the tor service by running this command:

service tor start
Enter fullscreen mode Exit fullscreen mode

To check the status of the service, run

service tor status
Enter fullscreen mode Exit fullscreen mode

After starting TOR, run the following command to start proxychains

proxychains firefox www.duckduckgo.com
Enter fullscreen mode Exit fullscreen mode

And in the browser tab opened visit https://dnsleaktest.com/ to do a DNS Leak Test.

The good thing about proxychains is that it dynamically changes your IP address without leaking your DNS

And Boom! I'm in the US.
dnsleak

Discussion (0)

pic
Editor guide