21 C
Texas
angeloma
Senior Writer and partner

Your own IRC Server with Inspircd on Debian 10

Hello, friends. In this post, you will learn how to deploy your own IRC server by installing Inspircd on Debian 10. The process is very easy and gives us many advantages that we can take advantage of in our institution.

First of all, it is important to remember that it is IRC. Internet Relay Chat is a real-time communications protocol. Using IRC, users should not establish communication beforehand, so that all users on a channel can communicate with each other, even if they have had no previous contact. Widely used for discussions and technical support of many open source projects.

Install Inspircd on Debian 10

The first thing to do is to connect to the server via SSH. After that, upgrading the system is always a good option.

sudo apt update
sudo apt upgrade
- Advertisement -

With the system upgraded, we can start the installation of Inspircd on Debian 10. Fortunately, the package is in the official Debian 10 repositories so to install it, just run

sudo apt install inspircd
Reading package lists… Done
 Building dependency tree
 Reading state information… Done
 The following additional packages will be installed:
   libmariadb3 libpq5 libtre5 mariadb-common mysql-common
 Suggested packages:
   sqlite3 default-mysql-server ldap-server postgresql gnutls-bin tre-agrep
 The following NEW packages will be installed:
   inspircd libmariadb3 libpq5 libtre5 mariadb-common mysql-common
 0 upgraded, 6 newly installed, 0 to remove and 26 not upgraded.
 Need to get 1,848 kB of archives.
 After this operation, 11.8 MB of additional disk space will be used.
 Do you want to continue? [Y/n]

This way, we will be able to use it and configure it for our instance.

Configuring Inspircd on Debian 10

The program as such is installed, but before using it we have to configure it.

First, on our system, we have to open ports 22 and 6667 where the application works.

Then, we have to examine the /etc/inspircd/inspircd.conf file which is where all the application configuration resides. It is a long file, but very well structured so we should have no problems editing it.

Before making any changes, make a backup of it.

sudo cp /etc/inspircd/inspircd.conf /etc/inspircd/inspircd.conf.bak

Now, yes, we can edit it.

sudo nano /etc/inspircd/inspircd.conf

In the server tab you have to configure the basics of the instance. In our chaos, we have left it as follows.

<server name="osradatest.ga"
    description="Example IRC Server"
    id="1AB"
    network="The osradar net">

Replace the name value with your domain and network with your network name. Set a description and leave the value of id as is.

Now in the admin tag create the admin user. Set a name, nickname, and email address.

<admin name="Example User"
    nick="example-user"
    email="[email protected]">

Then locate the bind tag and here we have the address values where the server will be available. If you leave it blank, it will be accessible from any host which is desired if you want it to be available via the internet. The other ports value is to define the listening port which by default is 6667 and in type leave it clients.

<bind address="" port="6667" type="clients">

The admin user can shut down or restart the server. But to do this he has to enter a password which we can define in the power tag in the diepass and restartpass values.

<power diepass="shutdown-password" restartpass="restart-password" pause="2">

After this, he creates an operator user in the oper tag. Again, in the host value he can define from which location he can log in. In my case, I have left it accessible from any host, but a good practice would be to limit it to localhost or a specific IP. Also, set a password and leave the type in NetAdmin.

<oper name="example-user"
    password="password"
    host="*@*"
    type="NetAdmin">

We won’t touch anything else, for now, so save your changes and close the editor.

Now, you should edit these two files. The first one is /etc/inspircd/inspircd.motd which will serve as the first message. And the other one is /etc/inspircd/inspircd.rules where you can set rules for behaviours that can be displayed from a client.

To apply the changes, you have to restart the program.

sudo systemctl restart inspircd

And you can check the status of it

sudo systemctl status inspircd
● inspircd.service - IRC server
    Loaded: loaded (/lib/systemd/system/inspircd.service; enabled; vendor preset: enabled)
    Active: active (running) since Fri 2021-07-09 18:26:07 CEST; 14s ago
      Docs: man:inspircd(1)
  Main PID: 2711 (inspircd)
     Tasks: 1 (limit: 2296)
    Memory: 2.1M
    CGroup: /system.slice/inspircd.service
            └─2711 /usr/sbin/inspircd --logfile /var/log/inspircd.log --config /etc/inspircd/inspircd.conf --nofork
 Jul 09 18:26:07 osradar systemd[1]: Started IRC server.
 Jul 09 18:26:07 osradar inspircd[2711]: Inspire Internet Relay Chat Server
 Jul 09 18:26:07 osradar inspircd[2711]: (C) InspIRCd Development Team.
 Jul 09 18:26:07 osradar inspircd[2711]: Developers:
 Jul 09 18:26:07 osradar inspircd[2711]:         Brain, FrostyCoolSlug, w00t, Om, Special, peavey
 Jul 09 18:26:07 osradar inspircd[2711]:         aquanight, psychon, dz, danieldg, jackmcbarn
 Jul 09 18:26:07 osradar inspircd[2711]:         Attila
 Jul 09 18:26:07 osradar inspircd[2711]: Others:                        See /INFO Output
 Jul 09 18:26:07 osradar inspircd[2711]: Loading core commands……………………………………………..
 Jul 09 18:26:07 osradar inspircd[2711]: InspIRCd is now running as 'osradartest.ga'[1AB] with 1024 max open sockets

Testing the installation

The best way to find out if everything went well is to run a client. In this case, we have chosen weechat as it is terminal and lightweight. Ideal for testing.

So, install it on Ubuntu and Debian running

sudo apt install weechat

Run it

weechat

Now add our server by running

/server add [server-alias] [your-domain]

When added, you can connect via

/connect [server-alias]
1.- InspIRC on debian 10
1.- InspIRC on debian 10
2.- Weechat working with InspIRC on debian 10
2.- Weechat working with InspIRC on debian 10

If you need to, you can connect as an operator user.

/oper [server-alias][password]

As you can see in the screenshots, everything went fine.

Recommended: Securing the server with SSL certification

To secure your communications you should obtain and add SSL certificates using Certbot.

So, install it.

sudo apt install certbot

and get a certificate for your domain

sudo certbot certonly --standalone --preferred-challenges http -d [your-domain]

And now to add it to the program and secure the connection, create a folder for it inside the program settings

sudo mkdir /etc/inspircd/ssl

Then, copy the obtained certificates to this folder

sudo cp /etc/letsencrypt/live/[your-domain]/fullchain.pem /etc/inspircd/ssl/cert.pem
sudo cp /etc/letsencrypt/live/[your-domain]/privkey.pem /etc/inspircd/ssl/key.pem

Now make the irc user the owner of that folder to prevent others from taking advantage of it.

sudo chown -R irc:irc /etc/inspircd

Now in the Inspircd configuration file, you need to add the following information

sudo nano /etc/inspircd/inspircd.conf

And under the bind tag add the following.

<gnutls
    certfile="/etc/inspircd/ssl/cert.pem"
    keyfile="/etc/inspircd/ssl/key.pem"
    priority="SECURE192:-VERS-SSL3.0">
<module name="m_ssl_gnutls.so">

In short, we are just indicating the location of the certificates.

Save the changes and restart the service

sudo systemctl restart inspircd

And now to connect, remove the previous alias in weechat.

/server from the [alias]

When using SSL the port to use is 6697 which you have to open in the firewall and add another alias as follows.

/server add [alias] [your-domain]/6697 -ssl

And then connect again.

So, enjoy it.

Conclusion

In this post, you learned how to install an IRC server using Inspircd. This way you can create one and manage it without any problems.

More info: Official Documentation

- Advertisement -
Everything Linux, A.I, IT News, DataOps, Open Source and more delivered right to you.
Subscribe
"The best Linux newsletter on the web"

LEAVE A REPLY

Please enter your comment!
Please enter your name here



Latest article