Quantcast
Channel: LinOxide
Viewing all articles
Browse latest Browse all 1287

Introduction to IRC with XChat, Irssi and UnrealIRCD on CentOS 7.0

$
0
0

Hi tuxman, this time we are going to talk about the Internet Relay Chat, or simply IRC. In the first part of this article we will review this protocol, how to use Irssi or XChat to connect on Freenode and other IRC networks,enter on channels and talk to people. After that, you will see how to start your own IRC service with UnrealIRCd.

Table of contents

  • Introduction
  • Connecting on IRC
  • Basic IRC commands
  • Serving IRC with UnrealIRCd

Introduction

You may remember the IRC chats, when there was no such thing as Facebook Google+ or LinkedIn and our social networks were IRC chat channels. Today we have a lot of alternatives to talk to someone on the internet, along with the social networks we have many popular messaging services, such as Whatsapp, Skype, Hangouts and so on.

However, despite IRC is not the main communication program on the internet, it is still alive and a great tool. It is a lightweight, widely deployed and  standardized protocol, originally created on 1988 by BBS users as a replacement and improvement for the talk program and that by its characteristics, saw the birth and death of many other messaging systems.

Connecting on IRC

To connect to an IRC network, you will need a client software. Here are some good clients for Linux.

Irssi

Irssi is a curses based IRC client, it is pretty great, customizable, allows the use of scripts and dismiss the need of a X server.

Install

yum install irssi

Connect to a network with the -c flag,

irssi -c irc.freenode.org

To switch between Irssi windows can be a little tricky at the first time,  you can use [Ctrl+n] to go to next window and [Ctrl+p] for the previous. the /window command.

/window [ next | previous ]

Use the list parameter to display a list with the open windows

/window list

You can then jump to the listed window number with [Alt+#], where # is the window number between 1-9. Another way to do this is with the goto parameter

/window goto [1-9]

You can also find good tips on how to use Irssi on quadpoint website.

XChat

XChat simplify the process for new comers by giving you point and click options to commands and most actions.

You can install XChat with yum

yum install xchat

Connect to IRC networks, using the dialog presented to you when you just start XChat, also accessible from  menu XChat->Network List [Ctrl+s]

Connect to IRC networks on XChat

Connect to IRC networks on XChat

As you sucessfully connect to the network, you can select one of the options to join to channels. You can also use the menu Server->List of Channels.

IRC join Freenode XChat

IRC join Freenode XChat

Basic IRC commands

Now you have a client ,here are some commands that you can use on IRC. When you first connect on a network, you will be given a nickname based on your system login by the client, and to change your nickname to Tuxman for instance, try this.

/nick Tuxman

With a new, you may want to enter on a channel. To list channels related to development try

/list #devel*

Once you find the channel you are interested on, try to join with /join #channelname.

/join #linux

OK, you are on a channel, you can start talking now, to know who is on the channel, do this with names

/names

Maybe you want to know more about who is someone on the network, try whois.

/whois MrRobot

Want to a chat window with someone? query.

/query MrRobot

Register you nick

You don't need to create an account to chat on IRC networks. However, if you want to prevent your nickname of being be used by someone else, you must register you nickname on the network. This will also give you access to resources that require registered nicknames, such as cloaking and access to more channels.

Let's suppose that you want to register the Tuxman nickname on Freenode. Ask the NickServ to REGISTER your nickname

/msg NickServ REGISTER password me@email.com

After that you must get your verification code that was sent to the email you provided and send it to NickServ

/msg NickServ VERIFY REGISTER nickname verifycode

You have registered your nickname, now you can identify yourself to the network

/msg NickServ IDENTIFY password

Connect and identify at Irssi startup with -n and -w flags.

irssi -c irc.freenode.net -n nickname -w password

You should also change your password from time to time, use the following command

/msg nickserv set password newpassword

Installing UnrealIRCd

Among other Ircd implementations there is the UnrealIRCd. It is fully featured, modular and highly documented, also the most implemented IRC server nowadays, corresponding to more than 50% of the currently running IRC servers.

Extra Requirements

Here is some requirements to get best of your UnrealIRCd, despite it is not required, it is strongly recommended as you will see.

Ntp - You must have correct time and date, ntp is your best choice to maintain time and date correct.

Install ntp

yum install ntp

Enable ntpd

chkconfig ntpd on

OpenSSL - This is also optional,  this will be used if you want SSL/TLS support.

yum install openssl

Zlib - This will let you to compress the network packets and reduce the load over the links.

yum install zlib

Get UnrealIRCd

Download Unrealircd.

wget --no-check-certificate https://www.unrealircd.org/downloads/Unreal3.2.10.5.tar.gz

Extact the tarball

tar zxvf Unreal3.2.10.5.tar.gz

Enter the sources tree

cd Unreal*

Enable chroot irc user and irc group (recommended)

This step is optional but strongly recommended as it will allow you to drop superuser rights and run UnreadIRCd under an unprivileged user account, inside a chrooted environment, and thus will make the whole setup much safer.

To do this you must edit include/config.h file within the sources directory.

Chroot environment feature is defined by the following directive

/* #define CHROOTDIR    */

Define the IRC_USER constant

/* #define IRC_USER  "<user name>" */

Define the IRC_GROUP constant

/* #define IRC_GROUP "<group name>" */

enable-user-chroot

Create group for ircd

groupadd ircd

Create ircd user and add it to the ircd group.

useradd ircd -s /bin/false -g ircd

Set the password for the ircd user to make sure no one can enter.

passwd ircd

Configure the build

At this point you follow the questions on the screen,  and you can use default settings most of then, however, I advice you to answer Yes when asked to enable ssl support.

./config

Configuring UnrealIRCd build

Configuring UnrealIRCd build

Build the sources

make

Install files

make install

If you enabled the ircd user, group and chroot features, you should now change the ownership of UnrealIRCd directory.

chown -R ircd:ircd /home/ircd/UnrealIRCd

Configure

It is time to make your IRC daemon work. For this edit the unrealircd.conf, the configuration file for UnrealIRCd. You can find the well documented file doc/sample.conf under your UnrealIRCD directory tree, it may help you in your journey. I created this working snippets with a brief description.

me - This block sets some basic server settings, name, basic info and the numeric value that must be unique across server on the same network.

me {

name "irc.localhost";
info "My Server";
numeric 1;

};

admin -  Here you set who is the server administrator, its name, nickname and email.

admin {

"George Jedi"; /* Name */
"geroge";/* Nick Name */
"george@heaven.net"; /* Email */

};

class clients/servers - This sets how clients and other servers are handled by the our server respectively. ping frequency, maximum of clients connections, frequency of reconnection tries, receive and send queues.

class clients {

pingfreq 90;
maxclients 500;
sendq 100000;
recvq 8000;

};'

class servers {

pingfreq 90;
maxclients 10; /* Max servers we can have linked at a time */
sendq 1000000;
connfreq 100; /* How many seconds between each connection attempt */

};

allow - Define who can connect to the server and how. First block allows user connections from any IP or hostname and limits the connections to 5 per IP. Second block allows only one authenticated connection to people from ugly.people.com

allow {

ip *;
hostname *;
class clients;
maxperip 5;

};

allow {

ip *@*;
hostname *@*.ugly.people.com;
class clients;
password "jayajaya";
maxperip 1;

};

listen - Which ports to listen for connections. On the block we are listening at port 6697 for user clients connecting over secure socket layer (SSL). Note also the line simple statement for plaintext connections at port 6667

listen *:6697 {

options {

ssl;
clientsonly;

};

};
#listen *:8067;
listen *:6667;
#listen *:6660-6669;

oper - Operator attributes, in this example we use an operator nicknamed george that can connect from anywhere with the "fuba" password

oper george {
class clients;
from {
userhost *@*;
};

password "fuba";
flags {

netadmin;
can_gkline;
can_kline;
can_unkline;
can_gzline;
can_zline;
can_restart;
can_die;
can_rehash;
global;

};

swhois "Example of a whois mask";
snomask cFfkoSsqNG;

};

loadmodule - Loads modules, these are the minimum recommended

loadmodule "modules/commands.so";
loadmodule "modules/cloak.so";

log - How log files will be written, on the example we log events flagged as errors, kills and so

log ircd.log {

maxsize 5MB;
flags {

errors;
kills;
oper;
tkl;

};

};

set - You may set many other things here, in our example we have a network at domain gaia.net called gaianet, that connect people to the #welcome channel, we set 3 different alphanumeric cloak keys, set the hosts on the network, create a #help  channel and other options that are detailed on nrealircd.org.

set {

kline-address my@email.address;
auto-join #welcome;
op

options {

hide-ulines;

};

maxchannelsperuser 10;
services-server         "services.gaia.net";
default-server              "localhost";
network-name                "gaianet";
help-channel                "#help";
hiddenhost-prefix           "gaia";

cloak-keys {

"aoAr1O6fh3Q6w4Hnl3J7hVz4Zb7x4YwpW";
"andaoAr1HnR6gl3sJ7uhVzO6fh3Q6w4oN3";
"a2Ja2JO6fh3Q6w4oNs7O6fh3Q6w4oN3s7";

};

hosts {

local           "locop.gaia.net";
global          "ircop.gaia.net";
coadmin         "coadmin.gaia.net";
admin           "admin.gaia.net";
servicesadmin   "csops.gaia.net";
netadmin        "netadmin.gaia.net";
host-on-oper-up "no";

};

};

Start UnrealIRCd

With all things in place, you can start your IRC daemon now.  Add the following command on rc.local to start UnrealIRCd when your system starts.

/home/ircd/UnrealIRCd/unreal start

It should run with no problems, however if face any problem during the startup, read the error messages on the terminal and also on the ircd.log file to figure out what is wrong.

Conclusion

You are done for now, your client and server should be running now, you can talk to people worldwide using some of the global networks or using your own network. However, it is a good idea to learn more on the IRC protocol, how to manage networks, channels and users, etc. The following documents should help you.

RFC documents

The following RFC defines the standards for the IRC protocol. You should read this before you can get best of IRC.

RFC-1459, RFC-2810, RFC-2811, RFC-2812, RFC-2813, RFC-7194

UnrealIRCd support and docs

Refer official documentation of UnrealIRCd to acquire more information. It contains all details that are not described on this document. You can also get help from IRC by connecting on irc.unrealircd.org:6667 on the #unreal-support channel. Thanks for reading!

The post Introduction to IRC with XChat, Irssi and UnrealIRCD on CentOS 7.0 appeared first on LinOxide.


Viewing all articles
Browse latest Browse all 1287

Trending Articles