Dienstag, 28. Mai 2013

Eigenen IRC Server aufsetzen

In kleineren Softwareentwickler-Teams ist ein schneller Austausch von Informationen, Code-Snippets oder auch Passwörtern wichtig.
Möchte man diese Kommunikation nicht über einen externen Anbieter wie z.B. Skype oder ICQ laufen lassen, bietet sich als schlanke und schnelle Lösung ein eigener IRC (Internet Relay Chat) Server an.

Die Beschreibung der Installation erfolgt als Beispiel auf einem Ubuntu Linux System incl. SSL Verschlüsselung. Als IRC-Server wird UnrealIRCd (http://unrealircd.com) verwendet.

Aktuelle Version herunterladen und anschließend entpacken
wget http://www.unrealircd.com/downloads/Unreal3.2.10.1.tar.gz  
tar xfz Unreal3.2.10.1.tar.gz  

Die Dateien befinden sich jetzt unter ~/Unreal3.2.10.1

Starten der Konfiguration und kompilieren des Quellcodes von UnrealIRCd
./Config


Anschließend startet ein wirklicher Konfigurations-Marathon :-)

Jeder Wert muss durch bestätigen mit der ENTER-Taste bestätigt werden.






Hier muss jetzt der Pfad zu den eben entpackten Dateien noch mal angegeben werden. Stimmt das angezeigte Verzeichnis, dann einfach mit bestätigen.
What directory are all the server configuration files in?
[/home/shemel/Unreal3.2.10.1] ->

What is the path to the ircd binary including the name of the binary?
[/home/shemel/Unreal3.2.10.1/src/ircd] ->

Diesen default-Wert bestätigen!
What should the default permissions for your configuration files be? (Set this to 0 to disable)
It is strongly recommended that you use 0600 to prevent unwanted reading of the file
[0600] ->

Für den SSL-Support des IRC-Server hier bitte YES eintragen!
Do you want to support SSL (Secure Sockets Layer) connections?
[No] -> YES
Leer lassen, wenn man nicht weiß wo OpenSSL auf dem System liegt!
If you know the path to OpenSSL on your system, enter it here. If not
leave this blank (in most cases it will be detected automatically).
[] ->
Die restlichen Abfragen können bestätigt werden.
Do you want to enable IPv6 support?
[No] ->

Do you want to enable ziplinks support?
[No] ->

Do you want to enable remote includes?
This allows stuff like this in your configuration file:
include "http://www.somesite.org/files/opers.conf";
[No] ->

Do you want to enable prefixes for chanadmin and chanowner?
This will give +a the & prefix and ~ for +q (just like +o is @)
Supported by the major clients (mIRC, xchat, epic, eggdrop, Klient,
PJIRC, irssi, CGI:IRC, etc.)
This feature should be enabled/disabled network-wide.
[Yes] ->

What listen() backlog value do you wish to use?  Some older servers
have problems with more than 5, others work fine with many more.
[5] ->

What listen() backlog value do you wish to use?  Some older servers
have problems with more than 5, others work fine with many more.
[5] ->

How far back do you want to keep the nickname history?
[2000] ->


What is the maximum sendq length you wish to have?
[3000000] ->

How many buffer pools would you like?
This number will be multiplied by MAXSENDQLENGTH.
[18] ->

How many file descriptors (or sockets) can the IRCd use?
[1024] ->

Would you like to pass any custom parameters to configure?
See  `./configure --help' and write them here:
[] ->

Ist kein Openssl installiert, erscheint folgende Meldung:
checking for openssl... not found

Apparently you do not have both the openssl binary and openssl development libraries installed.
You have two options:
a) Install the needed binaries and libraries
   and run ./Config
OR
b) If you don't need SSL...
   Run ./Config and say 'no' when asked about SSL
   (or pass --disable-ssl to ./configure)
Eine Anleitung zum Installieren von SSL finden Sie z.B. hier: http://www.postfix-howto.de/installation/openssl.htm

Wurden die Einstellungen wie gewünscht vorgenommen, erfolgt anschließend die Kompilierung des UnrealIRCd. Mit dem Befehlt "make".
Sollten bei der Kompilierung Fehler auftreten, dann muss gegebenenfalls die ./Config noch mal angepasst werden.
 __________________________________________________
| Compile is now complete.                         |
| You should now read the documentation and learn  |
| how to configure your IRCd.                      |
|                                                  |
| If you really like UnrealIRCd, and would like to |
| make a donation, please read the Donation file in|
| this archive. :)                                 |
|                                                  |
| Thanks for using Unreal IRCd! If you are in need |
| for any kind of help regarding the IRCd please   |
| read the Unreal.nfo file.                        |
|__________________________________________________|
Die Kompilierung wurde erfolgreich beendet.

Vor dem Starten des Servers, müssen an der Einstellungsdatei unrealircd.conf noch einige wichtige Einstellungen vorgenommen werden!!! Für den Einstieg ist die Beispieldatei von irc-guide.de sehr gut: http://irc-guide.de/wiki/Main/UnrealIRCdBeispielkonfigurationsdatei

Folgende Anpassungen habe ich an der Beispieldatei vorgenommen:

me {
        name "www.deinserver.de";
        info "IRC - Server von DEINNAME";
        numeric 1;
};

admin {
        "Sebastian Hemel";
        "BENUTZERNAME";
        "deine@mail.de";
};

/* Passworded allow line 
 * Nur Benutzer von einer bestimmten IP-Range und Hostnamen zulassen
 * zusätzlich muss ein Passwort eingegeben werden.
*/
allow {
        ip             *@130.83.*.*;            # Besucher von dieser IP ...
        hostname       *@*.t-online.de;         # ... bzw diesem Host  ...
        class           clients;
        password "xxxxxxxxxxxxxxx";             # ... brauchen ein Passwort zum Verbinden ...
        maxperip 2;                             # ... und dürfen im Gegensatz zu allen anderen ...
                                                # ... nur einmal pro IP/Host verbinden!
};

allow channel {
        channel "#team-chat";
        channel "#raum1";
        channel "#raum2";
};

set {
        auto-join "#team-chat";
};

oper shemel {
 ...
};

/* Server linken. Wenn das nicht gewünscht ist, dann diese Zeilen
 * auskommentieren oder löschen! */
/*
 * listen               123.45.67.8:7001        // Auf Port 7001...
 * {
 *      options
 *      {
 *              serversonly;            // Nur Server, keine Clients.
 *      };
 * };
 */

 /*
  * link hub.mynet.com {
  * ...
  */

 /*
  * tld {
  * ..
  */ 

deny channel {
   channel "*";
   reason "Wir unterstützen keine frei waehlbaren Channels";
}

/* Network configuration */
set {
        network-name            "IRC";
        default-server          "deinserver.de";
        services-server         "deinserver.de";
        stats-server            "deinserver.de";
        help-channel            "#help";
        hiddenhost-prefix       "hrz";
        /* prefix-quit          "no"; */
  
...

        /* Richtiges SSL-Zertifikat hinterlegen!*/
  ssl {
                /* certificate server.crt.pem; */
                certificate server_cert-xyz.pem;
                /* key server.key.pem; */
                key server.priv;
                /* trusted-ca-file class3.crt; */
                trusted-ca-file rootcert.crt;
        };
};


Folgende "Welcome" Dateien können noch erstellt werden:
vi motd.conf
vi rules.conf
Mit den beiden Dateien kann man angeben welche Regeln auf dem IRC-Server gelten und verbindlich sind. Bekannt ist dies auch als "Message of the Day". Ein Generator für schöne Logos im ASCII Format findet sich hier: http://patorjk.com/software/taag

Jetzt lässt sich der IRC Server mit dem folgenden Befehl starten
./unreal start

Starting UnrealIRCd
 _   _                      _ ___________  _____     _
| | | |                    | |_   _| ___ \/  __ \   | |
| | | |_ __  _ __ ___  __ _| | | | | |_/ /| /  \/ __| |
| | | | '_ \| '__/ _ \/ _` | | | | |    / | |    / _` |
| |_| | | | | | |  __/ (_| | |_| |_| |\ \ | \__/\ (_| |
 \___/|_| |_|_|  \___|\__,_|_|\___/\_| \_| \____/\__,_|
                           v3.2.10.1
                     using TRE 0.8.0 (BSD)
                     using OpenSSL 1.0.1e
                     using zlib 1.2.3.3

* Loading IRCd configuration ..
* Configuration loaded without any problems ..
* Loading tunefile..
* Initializing SSL.
* Dynamic configuration initialized .. booting IRCd.
---------------------------------------------------------------------


Glückwunsch zum eigenen IRC Server!
Passende Clients sind z.B. Mirand IM oder auch der Opera Browser.

Programmier-Beispiele in Python um IRC-Services anzusprechen, findet man hier:
Raspberry Pi: Einstieg und User Guide (mitp Professional)

1 Kommentar:

  1. IRC Bot getestet mit diesem Server
    http://sasonikolov.blogspot.de/2013/05/irc-bot-mit-nodejs.html

    AntwortenLöschen