Setting up a FreeBSD socks proxy server for use with mIRC

I’m getting fed up with my current IRC BNC software. At the moment I’m using psyBNC, which means I have to connect to it like you would an IRC server, then issue commands to that to tell it to connect to the IRC server of your choice.

I no longer need the features of psyBNC and decided that there must be a better way.

At first I started looking at other, more basic BNC software, but then worked out that they work in very much the same way as psyBNC in the fact that you have to first connect to it, then tell it where to connect to.

So I thought… What about a socks5 proxy?

My BNC currently runs on my FreeBSD server, which I use for my IRC activity as it has plenty of IPs and lots of Vhosts.

mIRC can connect to an IRC Server through a Socks4, Socks5, or Proxy firewall.

In mIRC the fields the Firewall/Proxy dialogue box are as follows: Firewall Support <None|Server|DCC|Both>; Protocol <Socks4|Socks5|Proxy>; Hostname; User ID; Password; Port.

Judging by this, what I need is some kind of Socks daemon/server that has the ability to allow for a username or user id and a password.

I had a look at using OpenSSH’s Socks compatible dynamic forwarding by doing the following:

ssh -D<port> user@hostname

However, I discovered that the hostname was required, and I could not connect to any host on demand as expected.

So I decided to look at FreshPorts for Socks software, there are a few options…

  • 3proxy – russian software, not a fan of this, it lacks documentation and support
  • csocks – i386 only, no good on x64 machines
  • nylon – seems pretty neat, tested it out, it has no options for username/password auth
  • p5-Socks – a perl module, not a daemon
  • proxy-connect – lacks proper maintenance
  • prtunnel – poor documentation, doesn’t appear to do the task I want
  • socks5 – “NEC has a funky license for this software”
  • ss5 – bingo!
  • tsocks – “Allow non SOCKS aware applications to use SOCKS without modification” — not what I want.

ss5 appears to be what I am looking for…

cd /usr/ports/net/ss5/ && make install clean

Based on the ss5 manual page I decided to create a ss5.conf file, which looked like this:

set SS5_SOCKS_USER hm2k
set SS5_SOCKS_PORT 33333
set SS5_SOCKS_ADDR rofl.name
set SS5_PASSWORD_FILE ~/ss5/ss5.passwd
set SS5_CONFIG_FILE ~/ss5/ss5.conf
set SS5_LOG_FILE ~/ss5/ss5.log
auth 0.0.0.0/0 – u
permit u 0.0.0.0/0 – 0.0.0.0/0 – - – - -

Once I’d done this, I tried to run it. I found that I wasn’t able to specify a config file meaning I probably wasn’t able to run this under anything other than root.

One thing I didn’t understand is that the ss5 configuration documentation say one of the variables (which the manual says to put into the config file) allows you to specify a config file. Which does not make sense!

So I decided to take a different approach, and coded my own SOCKS5 Server Script in perl…

I call it Simple Socks Server for Perl (sss.pl).

I hope someone else finds my script useful, and with any luck user feedback will drive me to develop it further.

Enjoy!

Related posts:

  1. Configuring a FreeBSD IRC Shell Server This is a brief guide created to help configure a...
  2. FreeBSD 6.2 “/usr/ports: No such file or directory” I recently setup a new FreeBSD 6.2 server, only to...
  3. Why I registered mIRC For those that don’t know… mIRC is communication software,...
  4. Twitter for mIRC I signed up for Twitter quite some months ago, but...

3 Comments »

  1. prez said,

    October 19, 2008 @ 4:25 am

    Hello HM2K,

    I have not tested your Perl script just yet, though, I have also tryed finding similar as you in the past. With no avail, I just decided to IRC over SSH. I prefer using my Irssi client from my home Linux desktop, but for the past ~two years, I have been connecting to my FreeBSD colocated. :/

    Perhaps I will try your script, it may be just what I needed! (two years ago. lol.)

    (prez@DALnet / prez@EFnet / prez@rizon)
    email:

  2. Daz Webugz said,

    November 6, 2008 @ 1:09 am

    Dear HM2k,

    I have been trying to access to a network behind some SSH severs via the Internet. I guess your script would be a great help.

    The following depicts the connections:-

    1) Home ——-> Internet ——–> FreeBDS SSH Gateway ——> Private IP Network

    2) Home ——–> Internet ———> FreeBDS SSH Gateway —–> FreeBDS server —–> Private IP Network

    I would like to SSH/SNMP directly to the private network from home.

    So far, I am only successful setting up a socks server using SSH -D on situation 1; however only TCP traffic allows.

    I have tried running your script but to no avail. Perhaps, I am missing something. Your advice a greatly appreciated.

    Thank you.
    daz

  3. Adrian Scott . com said,

    February 14, 2009 @ 5:07 pm

    Hey, neat code. Any luck getting this working with browsers? (I came across your posts trying to access from Firefox.)

    It seems like exactly what I’m looking for to do web-browsing thru one of my remote servers, but i haven’t been able to figure out how to do so.

    Have tried sss.pl w/ no username/pwd… have tried using nputty port fwd-ing a bit as well…

    any help would be most welcome…

    -a

RSS feed for comments on this post · TrackBack URL

Leave a Comment