Minggu, 21 September 2008

Building Your Own IRC Server with Services

This tutorial will cover the basic setup of an Unreal IRC server with Anope services. At this time, the latest version of Unreal is 3.2.5, while Anope has last released version 1.7.17 of IRC services. Before continuing, you should check whether newer versions of these packages are available, because - in most of the cases - newer = better.
Let's get started.


NOTE: Before you start:
- You should first change dir (cd) to the location you want them to be installed in (/opt for example)
- You should create a subdomain which will be accessible from the Internet (eg: irc.yourdomain.com). If you don't have a domain.com, feel free to use a DNS subdomain service such as afraid.org, which is free. There, create what ever subdomain you want, but keep in mind to use the IP address for the Linux box you are installing IRCD on. Moreover, the IP address used there MUST be accessible from the Internet (so don't use the LAN IPs as the subdomain address).
- If you intent to enable SSL support, you will need to have OpenSSL and Kerberos5 installed correctly.
- Unfortunately, the CODE boxes don't show spaces which are crucial to both unrealircd and services config files. You will have to pay a little bit more attention.

- Download the latest source packages:
■ Click HERE for UnrealIRCD
■ Click HERE for Anope Services.

- Decompress them (x.x.x is the latest version number):
CODE
tar xfz Unrealx.x.x.tar.gz
tar xfz anope-x.x.x.tar.gz


Installing and Configuring UnrealIRCD

- Compile UnrealIRCD (x.x is the latest version number):
CODE
cd Unrealx.x
./Config

■ Answers you should use during the install process:
CODE
anti-spoof protection? No
directory with configuration files? hit enter
path to ircd binary? hit enter
hub or leaf? Hub
hostname? Type the subdomain created earlier
default permissions? 0600
SSL support? No (or Yes if you are a security addict)
IPv6 support? No
enable ziplinks? No (unless you're linking with another IRCD)
enable remote includes? No (again, unless you're linking)
enable prefixes? Yes (totally up to you)
listen backlog? 5 is fine, hit enter
nickname history? 2000 is fine, hit enter
max
SendQ length? hit enter
buffer pools? hit enter
file descriptors? hit enter
more parameters? hit enter

- Type make to complete the compile process
- Copy the example configuration file:

CODE
cp doc/example.conf unrealircd.conf

- Open unrealircd.conf with your favorite text editor.
NOTE:
- Every variable in this configuration file is explained in detail. There's no point for me to explain each of them all over again so I'll go only through the most important ones. Do NOT modify other variables unless you know what you're doing.
- Lines that start with # are my comments so you don't have to add them to the config file.
CODE
/* FOR *NIX, uncomment the following 2lines: */
loadmodule "src/modules/commands.so";
loadmodule "src/modules/cloak.so";

# Set your IRCD info:
CODE
me
{
name "irc.yourdomain.com";
info "your IRC network name";
numeric 1;
};

# Show users you're the admin
CODE
admin {
"Your Name";
"Your Nickname";
"your@email.addr";
};

# Add an O:Line for yourself
# You can edit the one already there
# O:Lines define the IRCops
CODE
oper YourNickHere {
class clients;
from {
userhost *@*;
};
password "YourPassHere";
flags
{
netadmin;
can_zline;
can_gzline;
can_gkline;
g lobal;
};
};

# Add a C/N Line for IRC Services
# Don't edit the link block already there.
# C/N Lines allow other IRCDs or IRC Services to link with you
CODE
link services.yourdomain.com
{
username *;
hostname 127.0.0.1;
bind-ip *;
port 7029;
hub *;
password-connect "services";
password-receive "services";
class servers;
options {
};
};

# Comment this out with /* */
CODE
/*
link hub.mynet.com
[..etc..]
options {
/* Note: You should not use autoconnect when linking services */
autoconnect;
ssl;
zip;
};
};
*/

# Add the U:Line for the IRC Services
# You can edit the ulines block already there
CODE
ulines {
services.yourdomain.com;
stats.yourdomain.com;
};

# Comment this out with /* */
CODE
/*
tld {
mask *@*.fr;
motd "ircd.motd.fr";
rules "ircd.rules.fr";
};
*/

# Network configuration is the most important part
# You can use the block already there
CODE
* Network configuration */
set {
network-name "YourNetworkNameHere";
default-server "irc.yourdomain.com";
services-server "services.yourdomain.com";
stats-server "stats.yourdomain.com";
help-channel "#help";
hiddenhost-prefix "hidden";
/* prefix-quit "no"; */
/* Cloak keys should be the same at all servers on the network.
/* [..etc..]
*/
cloak-keys {
"aoAr1HnR6gl3sJ7hVz4Zb7x4YwpW";
"90jioIOjhiUIOH877h87UGU898hgF";
"IOjiojiio8990UHUHij89KJBBKU898";
};
/* on-oper host */
hosts {
local "locop.yourdomain.com";
global "ircop.yourdomain.com";
coadmin "coadmin.yourdomain.com";
admin "admin.yourdomain.com";
servicesadmin "csops.yourdomain.com";
netadmin "netadmin.yourdomain.com";
host-on-oper-up "no";
};
};

# Server configuration
# You can edit the block already there
CODE
/* Server specific configuration */

set {
kline-address "VALID.mail@address.here";
auto-join "#lobby";
modes-on-connect " ixw";
modes-on-oper " xwgs";
oper-auto-join "#opers";
dns {
nameserver Your.DNS.IP.Here;
timeout 2s;
retries 2;
};

- Test your new IRCD server by typing:
CODE
./unreal start

- If you get some warning messages, it's safe to ignore them. If you get error messages, you'll have to get to the bottom of them, alone. Otherwise, if Unreal started OK, it's time to install the services.


Installing and Configuring Anope IRC Services

- Change to anope directory and start the installation:
CODE
cd ../anope-x.x.x
./Config

- Configuration answers:
CODE
install binaries to? I suggest /path/to/Unrealx.x/services
create dir? yes
install data files to? hit enter
group? hit enter
default umask? hit emter
MD5 passwd encryption? no (unless you really want it)
auto-check for mysql libs? hit enter

- Type make and make install to complete the compilation process
- When everything is done, cd to the services directory and copy the example conf:
CODE
cd /path/to/Unrealx.x/services
cp example.conf services.conf

- Open services.conf in your favorite editor and modify/add these values:
NOTE:
■ These are the values you've chosen in unrealircd.conf, in the link, u:line and network configuration blocks.
■ These are the values you have to edit in order to get the services quickly up and running.
CODE
IRCDModule "unreal32"
RemoteServer 127.0.0.1 6667 "services"
ServerName "services.yourdomain.com"
ServicesRoot "YourNicknameHere"

- Save and close the config file
- Start Anope IRC Services with debug mode enabled in order to spot:
CODE
./services -debug -nofork

- If the services didn't show any errors in the console and connected (and stayed connected) to the IRC server, it's safe to run them normally:
CODE
./services

- You can find the services commands (nickserv register etc) and general help either on the anope website, or by typing /msg nickserv help and /msg nickserv help AcommandHERE. This applies for other services as well, like ChanServ, MemoServ and so on.
- UnrealIRCD help cand also be found on it's official website.

That's all to it. Remember to allow incoming connections on ports 6667, 6697 and 8067 using iptables.

Enjoy your IRC server.











Tidak ada komentar: