Hack 93 Set Up an IRC Proxy

 < Day Day Up > 

figs/moderate.gif figs/hack93.gif

IRC everywhere and never miss anything with an IRC proxy/bouncer .

First of all, you might wonder what a bouncer actually is. The word "proxy" is probably a more accurate description. A bouncer, like a proxy, is a program that connects you to a service (it's IRC in this context, but there are proxies for many different services) and acts as some sort of buffer. Also, like many web proxies, most bouncers cache data. Sometimes they also allow you to hide your real location, particularly if the proxy runs in a completely different place from where you are. People will see that your connection comes from the proxy host and will not be able to see where you are connecting to the proxy from.

CtrlProxy is a good example of an IRC proxy. It connects to your IRC servers and channels and accepts connections from you. Although CtrlProxy is not the only IRC bouncer available, it is one of the more advanced. Like most bouncers, it caches all your received messages while you're away, and, as soon as you connect to CtrlProxy, you'll get them sent to you. Another interesting feature is that CtrlProxy allows you to connect from multiple places. So when you leave home, you can keep your IRC client running on your desktop machine. At work, you can connect to CtrlProxy, and you'll get exactly the same session you left at home. Or if you have multiple machines at home, you can run your IRC client on all of them without being in the channel with three clones . And of course, if you fear the mess when you have your chat logs on lots of separate machines, CtrlProxy can keep them on your server too.

14.9.1 Setting Up CtrlProxy

CtrlProxy is supported on Unix platforms only. With some work, it's possible to get it working on Windows machines, but you're on your own then.

There are two ways to get hold of CtrlProxy. You can either use the package manager for your operating system, or you can compile it from source. A ctrlproxy package is available for most Linux distributions and the BSD port collections. You can get the source from http://ctrlproxy.vernstok.nl. After unpacking the tarball contents, run ./Configure and then run make install . Before you run CtrlProxy, you will have to create a configuration file. At the moment, there are two ways to do this.

The first way to configure CtrlProxy is to take the example file ctrlproxyrc.example from the source tree and adapt it to your setup. It's an XML-formatted file, so it is quite logical to read and understand.

The example contains a list of modules to load. It's usually a good idea to leave those as they are, unless you know exactly what the modules do. Then there is the list of the IRC networks you're on. For every network, you have to specify things like a nickname, an IRC name , and some other details that don't really require any further explanation. In the configuration, you must also set up a listener. A listener is something that allows you to connect to CtrlProxy with your IRC client. When creating multiple IRC networks, make sure each listener listens on a different port. Then you get a list of servers and the channels you want to join. If you want to, you can specify more than one server. CtrlProxy will switch to the next server when a server connection fails. When you start CtrlProxy, it will join each channel automatically. Of course, if you want to join other channels, you can do so with your IRC client when it is connected to the listener.

If the XML configuration file confuses you, there's always the second option. There's a little configuration wizard, called ctrlproxy-setup , inside the CtrlProxy source tree. This generates a ready-to-use configuration file after asking a few questions.

Here's a little sample configuration file, which connects you to the freenode IRC network (and two channels: #ctrlproxy and #irchacks) and a public BitlBee server:

 <?xml version="1.0"?> <ctrlproxy>     <plugins>         <plugin autoload="1" file="libsocket"/>         <plugin autoload="1" file="librepl_memory"/>         <plugin autoload="1" file="libadmin"/>         <plugin autoload="1" file="liblog_irssi">             <logfile>/home/wilmer/irclogs/</logfile>         </plugin>         <plugin autoload="1" file="libctcp"/>         <plugin autoload="1" file="libstrip"/>         <plugin autoload="1" file="libnickserv"/>         <plugin autoload="1" file="libantiflood"/>         <plugin autoload="1" file="libauto-away">             <message time="300">I'm currently away, sorry!</message>         </plugin>     </plugins>     <networks>         <network autoconnect="1" client_pass="secret" name="FREENODE"             nick="wilmer" username="wilmer" fullname="Wilmer van der Gaast">             <listen>                 <ipv4 port="6667"/>             </listen>             <servers>                 <ipv4 host="irc.freenode.net"/>                 <ipv4 host="sterling.freenode.net"/>                 <ipv6 host="gerrold.freenode.net"/>             </servers>             <channel name="#ctrlproxy" autojoin="1"/>             <channel name="#irchacks" autojoin="1"/>         </network>         <network autoconnect="1" client_pass="secret" name="BEE">             <listen>                 <ipv4 port="6668"/>             </listen>             <servers>                 <ipv4 host="im.bitlbee.org"/>             </servers>         </network>     </networks> </ctrlproxy> 

14.9.2 Running the Hack

By default, CtrlProxy reads its configuration from a file called .ctrlproxyrc in your home directory. If you want to put the configuration somewhere else, you have to specify the location when you start CtrlProxy. You will probably also want to run CtrlProxy in daemon mode so it will continue running when you log out. To start CtrlProxy in daemon mode using the configuration file ~/.ctrlproxy/ctrlproxyrc , type this:

 %  ctrlproxy -D -r ~/.ctrlproxy/ctrlproxy  

CtrlProxy will start, and now you can connect to it by pointing your favorite IRC client at the CtrlProxy listeners. Connect to port 6668 on the host running CtrlProxy (you can use localhost if you are running your client on the same machine), and you'll see the BitlBee session. Connect to port 6667 on the CtrlProxy host, and you'll notice you appear to have been in the two channels for some time already. Don't forget to specify the server password if you put one in the configuration file. If anybody said anything between the moment you started CtrlProxy and the moment you connected to the listener, you'll get those messages too.

Now you can try to make two connections to one listener. As if by magic, you'll find that it just works, and you'll get all the messages on both machines. Of course, when you say something, you'll see that on your other clients too. To some extent, this may depend on how your IRC client behavessome clients get very confused when they receive messages from their own nick!

14.9.3 Advanced Features

CtrlProxy has some other quite interesting features. Automatic identification to NickServ is one particularly useful feature. It can also be used to generate pisg-like statistics [Hack #14] automatically. By the time you read this hack, several other new features will probably be available. If you want to get more information about them, it's a good idea to read the documentation that comes with CtrlProxy. You can do a lot with this program. Explaining all of it is beyond the scope of this book, but hopefully this is enough to give you some idea of what it can do.

Wilmer van der Gaast

 < Day Day Up > 


IRC Hacks
IRC Hacks
ISBN: 059600687X
EAN: 2147483647
Year: 2004
Pages: 175
Authors: Paul Mutton

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net