Phew.. finally i managed to set up a SOCKS5 proxy server with authentication. It was all very easy but of course there is no tutorial for that to be found anywhere.
- it lets anyone (as in any IP address) connect
- it requires user and password of a systemuser (e.g. root)
Here is how I did it on Linux Debian 6 (Squeeze) minimal x86, at first I will explain it without authentication and then tell you what to modify to add authentication:
apt-get update apt-get upgrade apt-get install nano
.. to update your system and to install the text editor nano.
Then install dante-server:
apt-get install dante-server
It will output an error message in the end:
Not starting Dante SOCKS daemon: not configured.
So let’s configure it. The configuration file is at:
nano /etc/danted.conf
Rename it and make a new one:
mv /etc/danted.conf /etc/danted1.conf nano /etc/danted.conf
Now copy this and insert it into PuTTY with a right click:
logoutput: /var/log/socks.log internal: venet0:0 port = 1080 external: 111.111.111.111 method: username none #rfc931 clientmethod: none user.privileged: root user.notprivileged: nobody user.libwrap: nobody client pass { from: 0.0.0.0/0 port 1-65535 to: 0.0.0.0/0 log: connect disconnect error } pass { from: 0.0.0.0/0 to: 0.0.0.0/0 protocol: tcp udp }
Now you have to change the following lines depending on your system.
internal: venet0:0 port=1080
venet0:0 is the network adapter/interface which can be (and very likely is) different on your system.
To check the name use the command:
ifconfig
Which will output the names. In my opinion it should have been venet0 for me, but it didn’t work so just try all of them if the proxy server refuses connection.
Another very typical name would be eth0.
The IP address needs to be changed to the EXTERNAL IP of your server (the one you could also access an apache web server with from your computer):
external: 111.111.111.111
To save with the nano editor hold CTRL+X and confirm the changes with “y”.
Now make sure dante-server is stopped and start it again:
/etc/init.d/danted stop /etc/init.d/danted start
Try to connect with your browser. We haven’t set an authentication yet so a web browser is an easy way to check if it is working. If it says “connection refused” you entered wrong information in the config file.
If it opens the website you are trying to access, congrats! Now let’s implement authentication which is really easy. Simply change the following line:
method: username none #rfc931
to
method: username #rfc931
Now you should be able to identify yourself with the user specified in the following line:
user.privileged: root
Yes, it is the system user. If you specify root you have to log in with the username “root” and the password of your server/vps that you use for SSH access.
//EDIT: Technically authentication had been enabled before,too except now you just disabled the access for non-verified users.
You might have to start the server as root for authentication to work (or with sudo).
Restart danted/dante-server:
/etc/init.d/danted stop /etc/init.d/danted start
.. and check if the authentication works. I checked it with the P2P file sharing program “Ares” which returns “Test passed” if it works. And that’s it, hope this tutorial helped someone.