Image of the glider from the Game of Life by John Conway
Skip to content

Irssi Proxy

I've blogged on and on about Irssi, the single best IRC client out there, as most of you would agree. The reason it is so great, is the sheer number of features it has. There is no other client like it. In fact, here is a quick and dirty Top 10, why Irssi is so great:

  • Perl scripting
  • Slim, yet powerful
  • Multi-server support
  • Sensible defaults
  • Tab completion
  • /lastlog (need I say more?)
  • Self-defined tab completion
  • Paste detection
  • Plugins
  • Configurable keybindings
  • Themes and formats
  • SSL
  • Irssi proxy

Ok. So, a few more than 10. I could go on and on about the wonderful features that Irssi brings to the table. However, it's the last feature I mentioned, that I want to spend some time on: Irssi proxy.

When I use Irssi, as do most users, I use it inside of screen. I do this for a couple reasons. First, I want to be able to maintain my connection, without thinking about it. I hate having all these applications, just to do one thing here, and another thing there. I'm always in the terminal, so it makes sense to me to run a terminal-based IRC client. Second, I want to maintain my connection, so I always have access to backlogs, and I am always available for others to reach me. Thirdly, I want to be able to access my IRC connection, regardless of my location, keeping that single login. Screen + Irssi makes this possible. So, just at first glance, screen and Irssi are a dream come true... until I discovered Irssi proxy.

I read a lot of blogs and planets on the web, and the one theme that has been sticking out lately is using IRC effectively. This means more than just connecting when you need something, and disconnecting when you're done. Managing an IRC connection, and having the power over that connection to implement encryption, use any client you wish, and stay connected, thus, staying visible and available for someone who needs you.

Before I get into the nitty-gritty on setting it up, let me explain what it is. Irssi-proxy is effectively an IRC bouncer, with a few extra perks. First, launch up Irssi inside of screen as you normally would, then enable the proxy. With the proxy running, you now have the power to point any IRC client to the IP address and port of the proxy, both locally, and remotely. For example:

I have Irssi running now. However, I prefer to have all my instant communication in one application, such as Gaim, rather than separating it out. So, I enable the Irssi proxy plugin and tell it the port to listen on. Now, just for kicks, I'm not on the same computer that is running Irssi, as such, I need a way to access the port on that local machine. In walk SSH tunnel. I create an SSH tunnel between the remote computer running the Irssi proxy, and my local machine that I am going to start Gaim with. Once the tunnel is created, I then point Gaim to use localhost on the tunnel port for SSH. Before you can say "Bob is your uncle", I am now connected to my Irssi session with Gaim, and the whole process is transparent to anyone in the channels I'm in.

Let's look at this in closer detail, with a detailed how-to. First, run Irssi inside of screen. This should be a no-brainer.

aaron@achiles:~$ screen irssi

Next, connect to your server of choice, in this case Freenode. You will need to add Freenode to your server list, and take note to what you call the network. For example, in Irssi:

/server add -auto freenode 6667 password

In this case, I called the network "freenode". Whatever you call your network, you will need to remember it, as it is needed in this next step with the proxy. First we need to load the proxy module. It's important to note, also, that Irssi needs to be compiled with this module. Otherwise, you'll have to do it yourself, or use another proxy. In the case of Ubuntu and Debian, the proxy is built into the binary. Once loaded, we need to set a password, and tell the proxy what ports we want the client running on for each server. Yes, if you connect to multiple servers, you will have to tell it a separate port for every server. Follow the example below (where 'secret' is just some password):

/load proxy
/set irssiproxy_password secret
/set irssiproxy_ports freenode=3333

Ok. I've just told the Irssi proxy to listen on port 3333 for the 'freenode' network, which holds the physical connection on 6667. So, on the box running Irssi, I can load any local IRC client, point it to localhost:3333, and I can take advantage of the Irssi proxy. However, I want to run Gaim on a different computer than Irssi, so pointing it to localhost:3333 won't work. Unless, I create an SSH tunnel. This is easy:

aaron@achiles:~$ ssh -L 6667:localhost:3333

Easy as pie. From here, I can now point my local IRC client, in this case Gaim, to localhost:6667, and it will translate to localhost:3333 on the remote machine, where Irssi proxy is running. Irssi will accept the connection, and now Gaim is connected to my Irssi connection, using it as a bouncer to the Freenode network. And all I really did was:

  1. Load Irssi in screen
  2. Start up the Irssi proxy
  3. Create an SSH tunnel to the remote box running the proxy
  4. Point my local client to the SSH tunnel

4 easy steps. The great thing? Irssi will accept as many connections as you like. This means, I can be running a local client on my home desktop, a local client on my laptop, and local client on my work box and a local client at school. Heck, I could have multiple connections on just one machine: Gaim, XChat, Mirc, Trillian, BitchX, etc all using the Irssi proxy. And with the SSH tunnel, everything is encrypted on the wire.

Ok, now that that is over with, let's look at why you would want to do this. First, the disadvantages:

  • You need access to both an SSH client and an IRC client on the local machine.
  • Even though you connect to Irssi with XChat, for example, and all the channels load up, the back history that Irssi may have from the channel is not available.
  • It takes extra configuration to point the client to the right address and port, and some aren't intuitive or easy to do so.

However, with that said, there are a few advantages:

  • Irssi is still available with all your channels and settings. After all, you are running Irssi on the remote machine.
  • You can use any IRC client you like: GUI or text-based.
  • You can access the session regardless of location, just as you can with SSH and screen.
  • Using the SSH tunnel, everything is encrypted on the wire.
  • The process is transparent to the channel users.
  • Maintain a single connection, with multiple connections using the same nick.

I hope this makes sense. Basically, Irssi is running on machine A, and you are located on machine B. Launch as many clients as you like on machine B pointing to the SSH tunnel created between machine A and machine B. Do the same with machine C, D, E, F, etc. One true connection to the IRC server, and one nick is all that is needed.

The only problem I have found to this solution, is when you leave a channel on the local client (Gaim, for example), you also leave the channel in Irssi on the remote machine. This is a problem, because if you close your local IRC client, all the channels that you are in inside Irssi, you will leave. The only way around this, is to cut the SSH tunnel BEFORE exiting your IRC client. Thus keeping you in the channels without leaving. There has to be a way for Irssi to keep you in your channels when you close the local client, I just haven't figured that out as of yet.

Anyway, there are plenty of other tutorials and for each server how-tos on the web covering this very subject. It's where I learned how to do this. Hopefully, my tutorial made it a little bit easier, but if not, Google is your friend. And, of course, I'll help to the best of my ability.

Happy IRC'ing!

{ 6 } Comments

  1. Bryan Kaplan using Lynx 2.8.5rel.5 on Unknown O.S. | February 8, 2007 at 3:58 pm | Permalink

    I don't know about gaim, but in irssi you just type /bye and the remote client will quit without parting you from any channels.

  2. Bender using SeaMonkey 1.1.1 on GNU/Linux | May 7, 2007 at 3:01 pm | Permalink

    Good guide, thanks.

    Two things:
    I use screen all day. Love it, live in it. But I run irssi in dtach. Screen is overkill for just the detach function (you can still run the dtach session inside of a screen session on your local machine). Just mentioning it in case you haven't seen it.

    Second, I too like all my IM wrapped up in all one app. I assume you know about bitlbee? With it, you can put all your IM inside of irc (you did say you like console apps).

  3. somac using Firefox on Windows XP | May 11, 2007 at 12:58 am | Permalink

    Anyone recommend a proxy to browse myspace

  4. Soliton using Opera 9.22 on GNU/Linux 64 bits | September 15, 2007 at 3:48 am | Permalink

    The problem with leaving all channels on exit is with gaim. For whatever reason it sends a part for all channels before exiting. Might be fixed by now though...

  5. Sandy using Firefox on Mac OS | February 20, 2008 at 8:03 am | Permalink

    Thanks! Works like a charm.

    Minor nitpick: you say you are running irssi and gaim on separate machines, but the prompt for both reads "aaron@achiles". Might want to change that to make it clearer for folks who have never set up a SSH tunnel (which commands are run on client vs server, etc).

  6. Milos Kaurin using Google Chrome 18.0.1025.152 on Windows 7 | April 10, 2012 at 1:04 pm | Permalink

    Love your post. Thanks :)

{ 2 } Trackbacks

  1. [...] is a link that I got a lot of great information from: Filed under: Uncategorized No Comments Comments (0) Trackbacks (0) ( subscribe to comments on [...]

  2. IRC Proxy. (ssh) « Talueee's Blog | March 3, 2011 at 12:51 pm | Permalink

    [...] Link [...]

Post a Comment

Your email is never published nor shared.

Switch to our mobile site