The sys admin's daily grind: CGI:IRC

Getting Chatty


Have you ever felt frustrated because you were looking forward to a chat session but didn't have access to a client? Firewalls, or simply not having access to your own machine, can be frustrating. Wth CGI:IRC, all you need for IRC is a web browser.

By Charly Kühnast

In some situations, I would rather chat online than phone people. My preferred IRC client is Irssi [1]. It runs in a screen session on a server that I can access from wherever I happen to be using SSH.

Sometimes SSH just isn't an option, like when your customers' firewalls are too tightly locked down or if you visit an Internet café on vacation. A tool with the typographically challenging name of CGI:IRC [2] can be the answer.

The software gives you a web interface that passes input on to the IRC server (Figure 1).

Figure 1: Chatting with a difference - CGI:IRC gives a web server globally accessible IRC client functionality.

What I like about CGI:IRC is that it is installed easily and quickly but still gives me enough configuration options to support more complex setups. For the install, you need a CGI-capable web server and Perl version 5.

Just upload the script to the server, and drop the configuration files into the server's CGI directory. Newcomers might like to refer to the installation page [3] for tips on doing this.

CGI:IRC takes an unusual, but sensible, approach with its two configuration files. One file contains critical settings, which can be set up in a couple of minutes so you can get started right away. The other file, cgiirc.config.full, contains examples of more complex settings.

I started by checking out the basic configuration: default_server stores my IRC server's name and default_port stores the port number.

The port number is set to 6667, although servers with different port numbers are becoming increasingly common because some hosting providers have started to block IRC).

default_channel contains a comma-separated list of channels that the CGI:IRC user is allowed to use. The user is not permitted access to any channels not on this list.

When you log on, you can choose a nickname. If you don't choose one, CGI:IRC simply assigns a name on the basis of the schema stored in default_nick. This defaults to CGI???, where the question marks are replaced by a number after you log on.

Access Control

The ipaccess file handles access control. CGI:IRC will just ignore you unless you have an entry like the following line in cgiirc.config:

ip_access_file = ipaccess

To support any number of connections from localhost, I can just add an entry for 127.0.0.1 to the ipaccess file. To restrict the number of simultaneous connections to 50, the entry would be 127.0.0.1 50. To prevent access from a specific network, for example 10.0.0.0/8, I would just enter 10.0.0.0/8 0.

After completing the setup, I can chat to my heart's content, no matter where I happen to be. I mean, why should I have to live without a chat session, just because the Internet cafés in Majorca don't allow SSH?

INFO
[1] Irssi: http://www.irssi.org
[2] CGI:IRC: http://cgiirc.sourceforge.net
[3] Installation tips: http://cgiirc.sourceforge.net/docs/install.php
THE AUTHOR

Charly Kühnast is a Unix System Manager at the data center in Moers, near Germany's famous River Rhine. His tasks include ensuring firewall security and availability and taking care of the DMZ (demilitarized zone).