Setting up a FreeBSD socks proxy server for use with mIRC
Update: Looking for the sss.pl? Try the Simple Sockets Server project page.
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!
Warning: Declaration of Social_Walker_Comment::start_lvl(&$output, $depth, $args) should be compatible with Walker_Comment::start_lvl(&$output, $depth = 0, $args = Array) in /Users/wade/Sites/hm2k.org/wp-content/plugins/social/lib/social/walker/comment.php on line 18
Warning: Declaration of Social_Walker_Comment::end_lvl(&$output, $depth, $args) should be compatible with Walker_Comment::end_lvl(&$output, $depth = 0, $args = Array) in /Users/wade/Sites/hm2k.org/wp-content/plugins/social/lib/social/walker/comment.php on line 42
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: [email protected]
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
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
[…] ??? ???. ??? ????? socks proxy server? ?????? ??. ??? ?? ?? ???? ss5? ?? ??? ???(??? ??? ??? ???.) […]
Hi, I want to porting ssspl to FreeBSD ports tree. But I found the file released in sourceforge.net is too old. (FreeBSD ports system can’t fetch file from SVN or any SCM.) Could you please update the file in the download zone? Thank you very much!
@Goad That would be great!
I’ll update the download files, but you can download it as a GNU tarball from here:
http://ssspl.svn.sourceforge.net/viewvc/ssspl/?view=tar
Thank you very much!!
(Download from viewvc can’t know what version the file is…:~)
This post is now badly outdated. FreeBSD’s latest update is 3.6.4-3, which is iver 2 years old. The port is not being maintained anymore. Newest version is 3.8.5-1.
No. The post was written back in 2008, so it was accurate at the time of writing.
According to FreshPorts the latest FreeBSD ports release is 3.6.4_2.
For updated information about setting up a FreeBSD socks proxy server, check out the Simple Socks Server for Perl project
@hm2k
Does this socks work with sending/receiving dcc sends as well or just for chatting?
Wonderful!
I mean how hard was it to find a simple socks server for just this purpose. 🙂 Dante was just stupid and not even supporting file based authentication.