ONLamp.com    
 Published on ONLamp.com (http://www.onlamp.com/)
 See this if you're having trouble printing code examples


Big Scary Daemons

Finding Help on IRC

01/03/2002

The FreeBSD community has three major components: mailing lists, conventions, and IRC. I hang out on the mailing lists as much as I can. Conventions cost money, and there's no way I can hit them all anyway. So, one day I decided to track down the IRC. I specifically wanted to lurk on #freebsdhelp, to see what sorts of things people were having trouble with. (Despite what you might think, I do try to make these articles useful!)

For anyone who isn't familiar with IRC, it's an online chat system that predates ICQ, AIM, and most of the other "instant messaging" systems. I first encountered it in the late 1980s, and used it to kill time in the computer lab while waiting for someone to get off a Macintosh so I could use the building's only laser printer. For me, IRC lost its charms about 1990 or so, about the same time as the university bought a high-volume laser printer, and I hadn't touched it for more than a decade. I remembered IRC as a more rough-and-tumble environment than email; people tend to be less formal, speak before thinking, and make a variety of comments that would shame their mothers. It's somewhat like geek CB radio.

FreeBSD includes a whole slew of IRC clients under /usr/ports/irc. A few Web searches gave me the vague idea that BitchX was decent, so I ran portinstall bitchx, waited for the install to finish, and typed "BitchX". (Reading documentation for a new program is such a complete waste of time, after all!) The program took over my xterm and printed out a nice multicolored ASCII display. After I trimmed out the fancy graphics, I got some useful information.

BitchX: Auto Response is set to - mwlucas
Connecting to port 6667 of server irc.bitchx.com [refnum 0]
-scsi.mykrissy.com(***)- Looking up your hostname...
-scsi.mykrissy.com(***)- Found your hostname (cached)
-scsi.mykrissy.com(***)- Checking ident...
-scsi.mykrissy.com(***)- Checking for open socks server...
-scsi.mykrissy.com(***)- No ident response; username prefixed with ~
-scsi.mykrissy.com(***)- No socks server found (good!)...

So I can talk to the server. The server can find some things on my system, and can't find others. A little later I see:

 [total users on irc(248)]
 [unknown connections(1)]
 [total servers on irc(6)] (avg. 41 users per server)
 [total channels created(54)] (avg. 4 users per channel)
 Current Local Users: 48  Max: 245 
 Current Global Users: 248  Max: 994 
 MOTD File is missing 
 Mode change [+x] for user mwlucas
 Mode change [+iw] for user mwlucas

According to the FreeBSD FAQ, I want to be on the channel #freebsdhelp. Should be simple enough, no? Dusting off some very rusty memories, I type

/join #freebsdhelp
 mwlucas [~mwlucas@scsi-10795.blackhelicopters.org] has joined
#freebsdhelp
 [Users(#freebsdhelp:1)]
[@mwlucas   ]
 Channel #freebsdhelp was created at Thu Dec 6 16:51:16 2001
 BitchX: Join to #freebsdhelp was synched in 2.928 secs!!
 mode/#freebsdhelp [+nt] by mwlucas
 [04:52pm][@mwlucas(+iwx)][Mail: 30] [#freebsdhelp(+nt)]
 [Lag ??] [O/1 N/0 I/0 V/0 F/0]
[U:a:S:b:h]
[#freebsdhelp]

This cannot be correct. It says I'm the only user, but #freebsdhelp has been kicking around for years. Something isn't right. It's time to go back and read the documentation. Oh, well.

Internet Relay Chat is pretty simple. Central servers relay messages between each other and distribute them to users. A collection of servers tied together is called a "network." Many of these servers only allow connections from a certain group of IP addresses or users. If you're talking to one network, you will only see messages from that network. EFNet is perhaps the best-known such network, but there are others, such as DALNET and Undernet. IRC frequently (but not always) requires some minimal authentication and identification from the client, as provided by the auth service found on TCP port 113. IRC commands are all prefaced by "/"; things you type without the leading / are echoed onto the channel.

The comparison between IRC and CB radios isn't that bad, either. In addition to the standard 40 channels, some CB radios had options for "upper side band" and "lower side band." Channel 19 in standard band was not the same as Channel 19 in upper side band. Similarly, #freebsdhelp on DALNET is not the same as #freebsdhelp on EFNet. IRC also has many of the same charms as CB radio has. The last time I turned on a CB, I mostly heard static. Every few moments, however, someone keyed their mic and shouted "Green beans! Green beans! GREEN BEANS!" (My wife still hasn't recovered.) Altogether, it's not that different from IRC.

Related Reading

Learning the Unix Operating System, 5th EditionLearning the Unix Operating System, 5th Edition
By Jerry Peek, Grace Todino & John Strang
Table of Contents
Index
Sample Chapter
Full Description

So, I need a server that will relay my messages to the appropriate network. I need an identd server on my local system. I also want to set up my client so that I'll automatically connect to my chosen network and log on to a channel of my choice, much like my late father's CB radio was turned to channel 14 LSB by default. I'm on Comcast at the moment, courtesy of the also-late @Home, so I could use their IRC server if I wanted. This server will probably vanish soon, so I might as well look around for a good one. Google leads me to http://www.efnet.org/ircdb/servers.php, which has a list of all IRC servers and terms under which connections are allowed. It doesn't take long to find one that allows connections from anywhere.

I set my server with the /server command in the IRC client. The first server I try tells me that it cannot check my ident service, and hence I am a loser who is not worthy of accessing their glorious service. Well, I suppose a firm "no" is better than nothing. And if I fix ident, I should get a new and more exciting error message.

The ident (or auth) protocol identifies users. It's an old protocol, and isn't very reliable or secure. I can easily set up an identd server that will identify me as "George W. Bush, US President." IRC won't care, and neither should other network services. More complicated versions of identd will return things such as encrypted cookies to validate users, but that's well beyond the scope of identd for IRC.

FreeBSD includes a minimal ident service in inetd. If you search /etc/inetd.conf, you'll find several sample lines for auth services. The first examples return errors for all ident requests. The third and fourth provide a limited ident service that works well enough for IRC. The last sample is useful for an add-on identd; it works out-of-the-box with /usr/ports/security/pidentd. I uncommented the third auth example, which enables FreeBSD's built-in ident, and restarted inetd.

The IRC server complained that it still couldn't connect to my ident service. Checking netstat -na on the local machine, it seemed that they didn't even try! Well, that's annoying. I decided to start monitoring my firewall, to see what packets the IRC server was sending --

Firewall.

Oh. Yes, well, I suppose the packet filter might have something to do with it. I opened port 113, and tried again. This time, I got a friendly message saying that ident worked. I typed /server servername, and received a friendly message welcoming me to the chosen EFNet server. I'm in!

Now, to try some things. Once again, I type /join #freebsdhelp. A list of all the users currently on #freebsdhelp scrolls past, and I am suddenly eavesdropping on conversations between users all over the world.

Every IRC user has a nickname, or handle. Messages appear with the user's IRC nickname, followed by the message. To send a message to the entire channel, you just type what you want to broadcast. You can send a private message to a user's nickname by typing /mesg nickname, followed by the nickname you want to talk to. Your nickname defaults to your username on your local system or, in my case, mwlucas. If you change your nickname while in IRC, it announces the change to everyone on the channel you're on.

Each IRC network provides a different set of channels. You can find all of the channels on a network with the command /list. Listing the entire channel list for a server is a bad idea, however; it can be quite long, and you can wind up flooding your own connection and disconnecting yourself from the server. The /list command does allow you to do some basic regex-style searching, so you can do things such as /list *bsd* to find out which channels include "bsd" in their names. Some non-computer-related subjects also include the letters "bsd", so don't arbitrarily join all the channels you find.

You can run some basic checks on other users by with the /finger and /whois commands. /finger requires that the user have finger running on their system, while /whois checks the information that they've provided to the IRC server. Both are easily forged, and should not be trusted.

I'm not there for more than thirty seconds when somebody says, "Hey! It's the guy from O'Reillynet, or someone pretending to be him!" I instantly start receiving dozens of private messages from users asking me to share some droplets from my vast font of wisdom, as this column obviously means that I have extensive experience with their exact combination of hardware and software. I bear up for about ten minutes, then type /quit to leave BitchX and catch my breath.

Obviously, I need to change my nickname if I want to enjoy IRC. And I have to have it set before I log in at all, or everyone will see the name change. BitchX allows you to set your username with some environment variables.

$IRCNICK is your chosen IRC nickname. $IRCNAME is your "real name," which is a bit of a misnomer. I can set $IRCNAME to "Chuck, the Gerbil of Doom" if I wish, and IRC will take it. Finally, $IRCSERVER is your default preferred IRC server. By setting these in my .cshrc, the next time I run BitchX I won't be mugged by people who need help. I'd rather help out one person at a time.

Having lurked anonymously in #freebsdhelp for a while, I have to say that it's a valuable resource to the FreeBSD community. The people are almost always friendly and helpful, and it provides a quicker response than the mailing lists. You won't get the same depth of exposure that a mailing list message gives you, but that might be alright if you have a basic question. And the next time you say something there, I might be the one who helps you out.

Michael W. Lucas


Read more Big Scary Daemons columns.

Return to the BSD DevCenter.

Copyright © 2009 O'Reilly Media, Inc.