IRCD

From Wikitech
(Redirected from IRC)

If you're looking for instructions on managing our IRC channels, please check the Freenode instructions.

This page discusses IRC notification for recent changes on Wikimedia wikis, with a particular focus on the setup of the server at irc.wikimedia.org. It also gives a simplified method to set up IRC notification on your own MediaWiki server.

Clients can instead use Socket.IO to connect to the RCStream service on stream.wikimedia.org as a modern alternative to monitoring IRC channel activity.

pmtpa

We use a patched version of ircd-ratbox (a fork of ircd-hybrid), running on ekrem. It can be started with:

su -c /usr/local/ircd-ratbox/bin/ircd irc

There's no need to run it in the background, it forks automatically. The RC bot works as follows:

  • RecentChange::save() sends UDP packets to ekrem. The data sent is IRC-ready, and prefixed with the channel name as specified by $wgRC2UDPPrefix (in InitialiseSettings.php)
  • udpmxircecho.py receives the UDP packets and connects to the local ircd. The oper password is inside udpmxircecho.py, so don't check it in to CVS. It's restricted by hostname so it's not a huge issue, it's just the principle of the thing.
ircd-ratbox-notalk.patch in our SVN

The configure line is:

./configure --enable-services --with-nicklen=50 --with-topiclen=300 --enable-ipv6 --prefix=/usr/local/ircd-ratbox

IRCD can be configured at runtime by changing /usr/local/ircd-ratbox/etc/ircd.conf and either restarting or sending the "rehash" command when logged in as an oper. Restarting has the disadvantage of disconnecting everyone, resetting the channel list, and possibly crashing mxircecho.py. Rehashing sometimes causes ircd to lock up with 100% CPU, requiring a restart.

Documentation for ircd-ratbox is poor. The best source for information about ircd.conf is apparently etc/example.conf. Some configuration variables can be changed by opers using /set. Quite a lot of server information is available with /stats. Documentation for oper commands is available with /help (/raw help in mIRC).

Starting the bot

After ircd is restarted, you will want to start up the bot if it is not running already.

/usr/local/bin/start-ircbot

will get it going.

Firewall

The UDP receiver needs to be firewalled to avoid allowing people to RC lines to it from external networks. Typical configuration with iptables:

iptables -A INPUT -p udp --dport 9390 -s 208.80.152.0/22 -j ACCEPT
iptables -A INPUT -p udp --dport 9390 -s 10.0.0.0/8 -j ACCEPT
iptables -A INPUT -p udp --dport 9390 -j DROP

Most distros provide a facility to set up firewall rules like these on startup, use the standard method.

How to do it on your own server

We get a lot of questions on how to set up IRC notification for non-Wikimedia wikis. Here is the procedure. You need two programs:

  • Some simple IRC client such as ircII with the -d switch.
  • A netcat which supports UDP receive, such as GNU netcat

Put this in your LocalSettings.php:

$wgRC2UDPAddress = '127.0.0.1'; # the host where the IRC client is running
$wgRC2UDPPort = 9390; # or whatever
$wgRC2UDPPrefix = '';

Now start your IRC client. Here's the command line for the above suggested configuration:

netcat -ulp 9390 | irc -d -c \#channelname nickname irc.example.com &

For multiple wikis, I suggest you use a different port number for each one, and a separate IRC connection. This should be OK for up to about 10 wikis. Wikimedia uses a more complex setup to multiplex IRC connections, but this should be unnecessary for small installations.