INTRODUCTION TO IRC
Like its time-delayed relative, electronic mail, Internet Relay Chat, or IRC, is an network-based communication technology that has both shaped and been shaped by the social interaction of its users. It provides millions with the ability to share thoughts, ideas and information with others around the world on any imaginable topic.
This page introduces IRC (Internet Relay Chat) and covers the details of setting up a small IRC server under Linux.
There are a number of servers that implement the IRC client/server protocol specification. As with nearly every network protocol in use, its details are contained in a Reqest For Comments (RFC) document. The following RFC's relate to IRC.
Experimental
RFC 1459 Internet Relay Chat Protocol J. Oikarinen, D. Reed May 1993
Informational
RFC 2810 Internet Relay Chat: Architecture C. Kalt April 2000 Updates RFC 1459
RFC 2811 Internet Relay Chat: Channel Management C. Kalt April 2000 Updates RFC 1459
RFC 2812 Internet Relay Chat: Client Protocol C. Kalt April 2000 Updates RFC 1459
RFC 2813 Internet Relay Chat: Server Protocol C. Kalt April 2000 Updates RFC 1459
These are available as text and can be obtained by anonymous ftp to ftp.isi.edu. Look for them in the directory in-notes/.
The file rfc2810.txt contains a concise introduction to the basic terms and concepts of IRC. Rfc2811.txt contains some information that would be appreciated by those who are running clients and want to get involved in creating and possibly operating IRC channels. Those interested in setting up and maintaining an IRC server or getting involved with client/server development should of course should read them all. ;^(
Further information on the many aspects of IRC (Clients, servers, networks, commands, etc.) as can be found at [www.irchelp.org].
There is also an IRC tutorial at http://www.irchelp.org/irchelp/irctutorial.html .
The rest of this paper will focus on the details setting up a specific IRC server, the dancer-ircd.
SETTING UP A DANCER-IRCD IRC SERVER
Dancer-ircd (not to be confused with the IRC Bot Dancer-Bot) consists of a modified Hybrid-ircd; [Hybrid-ircd] being another IRC server that is in widespread use on many networks, such as well as the large EFnet. The policy differences between Hybrid and Dancer reflect the principles of the Open Projects Network (OPN) as well as the additional privacy/security concerns addressed by the dancer developers. For more info on OPN check out [www.freenode.net]. It appears that dancer-ircd is looking for developers.
While dancer-ircd is scalable, the intended application of the software has alot to do with how things are initially configured. Many security issues can be side-stepped by not having to provide certain functionality, such as allowing connections to or from other IRC servers.
The *smallish* scale of this server can be defined as have less than 1000 users at a time, is not linked to any large IRC server and will not serve as a hub to which other large servers will connect.
For the curious, the requirements for linking to EFnet can be found at ftp://ftp.blackened.com/pub/irc/new-server-guidelines.
THE STEPS FOR SETTING UP A DANCER-IRCD SERVER
0) Obtain the requisite hardware (a dedicated unix-based server), network connection of 1.5 Mbps or greater (though this depends on usage) and a internet domain with a registered fixed (or neutered?) IP address (unless your setting this up on a private network for fun).
1) Obtain and unpack the source file.
The source for dancer-ircd can be found at [http://freenode.net/dancer_ircd.shtml]
Download and extract dancer-ircd-1.0.31+maint8-fn6.tar.gz.
If you are running IPv6 get the IPv6 patch and apply it to the source. From within the source dir use the command
# patch -p1 < dancer-maint5+IPv6.diff
Get familiar with layout of the source tree.
2) Determine the installation directories for the src, config and log files.
This depends on the what unix the server will be installed on as well as the preferences of the admin. There are a number of config and log files. To keep things simple I used /usr/local/bin for the src, put all the configs in in /etc/dancer-ircd/ and the log files in /var/log/dancer-ircd/.
Also it would be more secure to create a special user to run the ircd process under (such as dancer) to avoid the risks inherent in running the server daemon as root.
3) Edit the config.h file to suit the needs of your OS or and server.
This is where the default directories are set as well as many system and server options. It requires a careful read-through as there are many options regarding IRC server operation.
Though this is a matter of preference, I used the following directories for the ircd files. These would be of course be different if the server were to be run by, and under, a special user directory.
#define DPATH "./" #define SPATH "/usr/local/bin/dancer-ircd" #define CPATH "/etc/dancer-ircd/ircd.conf" #define KPATH "/etc/dancer-ircd/kline.conf" #define DLPATH "/etc/dancer-ircd/dline.conf" #define MPATH "/etc/dancer-ircd/motd" #define LPATH "/var/log/dancer-ircd/ircd.log" #define PPATH "/var/run/dancer-ircd.pid" #define HPATH "/etc/dancer-ircd/ohelp" #define OPATH "/etc/dancer-ircd/omotd"
To start the server daemon it was necessary to increase the limit on the number of file descriptors (1024 on my system) to atleast the value of the constant HARD_FDLIMIT. The means of doing this will vary according to your OS. See http://openprojects.nu/sponsoring_servers.shtml .
To keep going I temporarily lowered the limit in config.h as follows. This means I must do a rebuild after it is increased to acceptable values.
#define HARD_FDLIMIT_ 512 #define INIT_MAXCLIENTS 400
If you want to log users and operators you need to create the user.log and oper.log files.
#define FNAME_USERLOG "/var/log/dancer-ircd/user.log" #define FNAME_OPERLOG "/var/log/dancer-ircd/oper.log"
It seems that changing some, and perhaps others, of the following defines from the default values in config.h will break the compile.
#define USE_SERVICES #define CRYPT_OPER_PASSWORD #define IDLE_CHECK
When you are satisfied with the config.h file it is time to build the source.
4) Build and install the source. Test the initial installation by running the ircd by hand and using a client to connect to the local server. Check the logs to troubleshoot and correct any installation problems.
To build and install.
# cd dancer-ircd-1.0.31+maint8-fn6 # configure --prefix=/your/install/dir --other=configoptions # make # make install
If you want the man page you have to put it there yourself.
# cp doc/ircd.8 /usr/local/man/man8/
Copy the example ircd.conf file into the directory you specified as the config file directory in config.h. In my case it was /etc/dancer-ircd.
#cp doc/example.conf /etc/dancer-ircd/ircd.conf
Make sure the path for the config and log files exist and open a tail on the logfile in another shell.
# tail -f logfile
Then run the daemon with
# dancer-ircd
If you get the following message you still need to address the file descriptor limit by either lowering the value in config.h or increasing the system limit and cleaning/rebuilding.
ircd fd table too big Hard Limit: 1024 IRC max: 4086 Fix MAXCONNECTIONS
If it cannot find the config files you can specify them as command line args, try
#man ircd (Assuming you installed the man page!)
If there are no errors, check log and running process with
# tail -f logfile
[2003/04/29 08.01] Failed reading kline file /etc/dancer-ircd/kline.conf [2003/04/29 08.01] Failed reading dline file /etc/dancer-ircd/dline.conf [2003/04/29 08.01] Server Ready
This looks good, the k/dline files should be generated at runtime.
#ps aux | grep dancer-ircd
root 11642 0.1 1.2 8172 6508 ? S 00:38 0:00 dancer-ircd root 11645 0.0 0.0 1328 460 pts/6 S 00:39 0:00 grep dancer-ircd
Then start up a IRC client such as xchat and connect to the name you specified as the server, in this case it is just the default localhost. In the xchat window I saw the following.
--- Connecting to localhost.localnet (127.0.0.1) port 6667.. --- Connected. Now logging in.. --- AUTH :*** Looking up your hostname... --- AUTH :*** Checking ident --- AUTH :*** Found your hostname --- AUTH :*** Got ident response --- Welcome to the freenode IRC Network yagi --- Your host is localhost.[localhost./6667], running version dancer-ircd-1.0.31+maint8-fn6 --- yagi :*** Your host is localhost.[localhost./6667], running version dancer-ircd-1.0.31+maint8-fn6 --- This server was cobbled together Sun Apr 27 23:02:11 UTC 2003 --- localhost. dancer-ircd-1.0.31+maint8-fn6 abBcCdDeEfFgGhHiIkKlLmMnNopPrRsSUvVwWxXyYzZ0123459*@ bcdefFghiIklmnoPqstv --- There are 1 victims and 0 hiding on 1 servers --- I have 1 clients and 0 servers --- Current local users: 1 Max: 1 --- Current global users: 1 Max: 1 --- Highest connection count: 1 (1 clients) (1 since server was (re)started) --- MOTD File is missing --- yagi :*** Notice -- Server is currently split, channel modes are limited --- Administrative info about localhost. --- Example location --- My address --- Inept server admin <dancer@localhost> --- No channel joined. Try /join #<channel> --- Due to a network split, you can not obtain channel operator status in a new channel at this time.
The server is up and running, ;) but there is more work to be done. ;(
5) It time to edit the main configuration file, ircd.conf, which specifies the operators, servers and policies of the IRC server.
There is sufficient documentation for editing the config.h file in the operators guide found in the doc/ directory. This will be considerably simpler for a standalone server such as inferno.slug.org.
I couldn't get any passwords to work using a standard md5 encrypted password in an O:line, though it turns out that this was due to the inability of identd to validate the hostname on a local server. This should resolve when installing the IRCd on a server with a valid IP.
Oper passwords are encrypted with the crypt_shadow_md5 hash that is implemented by the mkpasswd command. This utility can be found in tools/ directory.
$mkpasswd encrypthis $1$YVSHRwD6$dFVDE2u47AAN0MTcNMEIn0
Password can also be encrypted using the MAKEPASS command that is issued from within a running dancer-ircd server.
/makepass apassword (/) inferno.slug.org NOTICE mak :*** Encryption for [ somestring ] is [ $1$PhaXnlfd$eO/niX/4pVKWvF6\ X7mSIZ. ]
The resulting hash can then be pasted into an O:line server and restarted.
It should be possible to get operator privileges on a running server with:
/oper <password>
It isn't necessary, especially on a small server, that an IRC server even have an Oper around to protect and serve the server. That way, no one can abuse such privileges. ;-)
6) Create a Message of the day for the server (motd) and for operators (omotd) and express any user guidelines and/or legal policies if it is going to be a publicly accessible server.
6) Read the operators guide and the users guide (and the source while your at it) make the users guide available to the users of the network.
7) Commence securing, I mean serving! Administering an IRC server is by nature a work in progress and things will have be continually tweaked to meet the demands of users and operators as well as changes in the software, network and security issues.
Good Luck!