Tag Archives: Server

Quick server backup

mount /dev/xxxx -o remount-ro /mnt
tar -cvjpf serverbackup.tar.bz2 /mnt

then unpack the behavior of permissions

tar -xvjpf serverbackup.tar.bz2

here my script with mysql backup. backup.sh

  1. # create backup catalog
  2. mkdir /backup
  3. # clean
  4. aptitude clean
  5. rm /var/log/*.gz
  6. rm /var/log/apache2/*.gz
  7. rm /var/log/apt/*.gz
  8. rm /var/log/clamav/*.gz
  9. rm /var/backups/*.gz
  10. # start archive
  11. tar -cvjpf /backup/backup_bin.tar.bz2 /bin
  12. tar -cvjpf /backup/backup_home.tar.bz2 /home
  13. tar -cvjpf /backup/backup_lib.tar.bz2 /lib
  14. tar -cvjpf /backup/backup_root.tar.bz2 /root
  15. tar -cvjpf /backup/backup_usr.tar.bz2 /usr
  16. tar -cvjpf /backup/backup_etc.tar.bz2 /etc
  17. tar -cvjpf /backup/backup_lib64.tar.bz2 /lib64
  18. tar -cvjpf /backup/backup_sbin.tar.bz2 /sbin
  19. tar -cvjpf /backup/backup_var.tar.bz2 /var
  20. # backup mysql
  21. mysqldump -u root -p<PASSWORD> --all-databases > /backup/all_databases.sql
  22. # archiving of all backups to a single file
  23. tar -cvjpf /backup_`date +"%F"`.tar.bz2 /backup
  24. # send backup to another server
  25. scp /backup_`date +"%F"`.tar.bz2 user@server:/home/backup
  26. # remove local backup
  27. rm -R /backup /backup_`date +"%F"`.tar.bz2

update
backup from remote server 192.168.0.100 to local /mnt

mount /dev/sda1 /mnt/
rsync -aHxv root@192.168.0.100:/* /mnt --exclude=/dev --exclude=/proc --exclude=/sys --exclude=/tmp

Own IRC Server on Debian with Anope and MySQL

** Pre-Installation **

First, download the UnrealIRCd source, located hier

wget http://www.unrealircd.com/downloads/Unreal3.2.10.1.tar.gz
wget http://www.unrealircd.com/pgp/Unreal3.2.10.1.tar.gz.asc

After you install it, run a few checks on the gzip file to make sure it is the secured version.

gpg --keyserver keys.gnupg.net --recv-keys 0x9FF03937
gpg --verify Unreal3.2.10.1.tar.gz.asc Unreal3.2.10.1.tar.gz

Next, we have to extract the contents of the compressed file. Type

tar zxvf Unreal3.2.10.1.tar.gz

** SSL Support

If you want users to be able to connect to your IRC server via a secure connection, you will need to install a package called libcurl4-openssl-dev. This is a bundle that includes everything needed for SSL, plus what is needed for remote includes which are discussed below.

You will need to install the packages as root. Type these:

apt-get install build-essential
apt-get install openssl
apt-get install libcurl4-openssl-dev

You now have what is required for SSL connections to your server.

**Ziplinks Support

Ziplinks reduce the amount of bandwidth used by your servers by compressing data before it is sent to another server.
zlib1g is the library required for ziplinks, which is usually installed already, so you don’t have to do anything.

** Remote Includes Support

A remote include is pretty much like a normal include, the difference being that remote includes are obtained from a remote FTP server. This makes it so there could be one central FTP server with most of the configuration files that are not server-specific. This will make updates to the configuration files much easier, since you only have to update the files on the FTP server, then rehash all of the IRC servers.

For remote include support, we will need libcurl, which is already installed with the libcurl4-openssl-dev package above.

** Installation **
We are now ready to install UnrealIRCd. Switch back to the account that you will be installing UnrealIRCd on, and navigate to the Unreal3.2 folder. Type:

./Config

… answers to questions that ask configurator …
with SSL support!
And type make

** Anope **
Download Anope Services.

Decompress them
tar zxvf anope-1.8.8.tar.gz

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

Configuration answers:

install binaries to? I suggest /path/to/Unreal3.2.10.1/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:

cd /path/to/Unreal3.2.10.1/services
cp example.conf services.conf
Open services.conf in your favorite editor and modify/add these values:
IRCDModule "unreal32"
RemoteServer 127.0.0.1 6667 "services"
ServerName "services.yourdomain.com"
ServicesRoot "YourNicknameHere"

** Configuration **
Copy the example configuration file
cd Unreal3.2.10.1/
cp doc/example.conf unrealircd.conf

Lines that start with # are my comments so you don’t have to add them to the config file.

/* FOR *NIX, uncomment the following 2lines: */
loadmodule "src/modules/commands.so";
loadmodule "src/modules/cloak.so";

Set your IRCD info:

me
{
name "irc.yourdomain.com";
info "your IRC network name";
numeric 1;
};

Show users you’re the admin

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

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

link services.itunix.eu
{
   username   *;
   hostname    192.168.0.100;
   bind-ip    *;
   port       7070;
   hub             *;
   password-connect "password";
   password-receive "password";
   class           servers;
   options {
      };
};
listen         *:6697
{
	options
	{
		ssl;
		clientsonly;
	};
};

listen *:7070
{
	options
	{
		serversonly;
	};
};
link            hub.itunix.eu
{
	username	*;
	hostname 	127.0.0.1;
	bind-ip 	*;
	port 		7029;
	hub             *;
	password-connect "password";
	password-receive "password";
	class           servers;
		options {
			/* Note: You should not use autoconnect when linking services */
			autoconnect;
			ssl;
			zip;
		};
};

You can edit the ulines block already there

ulines {
	services.itunix.eu;
	stats.itunix.eu;
};

Network configuration is the most important part
You can use the block already there

/* 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 {
"J7hVz4Zb7x4YwpWaoAr1HnR6gl3s";
"OH877h87UGU90jioIOjhiUI898hgF";
"UHUHij89IOjiojiio8990KJBBKU898";
};
/* 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

/* 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;
};

** Anope
Corrected that but in services.conf where i had:

RemoteServer 192.168.0.100 7070

MysqlHost “127.0.0.1”
MysqlUser “user”
MysqlPass “pass”
MysqlName “anope”
MysqlSock “/tmp/mysql.sock”
MysqlPort 3306

and import tables.sql to mysql

Save and close the config file
Start Anope IRC Services with debug mode enabled in order to spot:

./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:

./services

Start your new IRCD server by typing:

./unreal start

Nginx proxy_pass

From synchtube.itunix.eu:1337 to synchtube.itunix.eu

  1. server {
  2. #  listen      66.225.195.83;
  3.    server_name synchtube.itunix.eu;
  4.    access_log  /var/log/nginx/access.log;
  5.    error_log   /var/log/nginx/error.log;
  6.  
  7.    location / {
  8.         proxy_pass  http://synchtube.itunix.eu:1337;
  9.         proxy_next_upstream error timeout invalid_header http_500 http_502 http_503 http_504;
  10.         proxy_redirect off;
  11.         proxy_buffering off;
  12.         proxy_set_header        Host            static.example.com;
  13.         proxy_set_header        X-Real-IP       $remote_addr;
  14.         proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
  15.     }
  16. }

Own XMPP/Jabber Server on Debian

  1. Installing ejab­berd:

    aptitude install ejabberd
  2. Configuration:

    nano /etc/ejabberd/ejabberd.cfg
  3. Find and change the line:

    {acl, admin, {user, "YOURNAME", "YOURDOMAIN"}}.
  4. Append a little below your domain:

    {hosts, ["YOURDOMAIN"]}.
  5. Restart ejabberd:

    ejabberdctl restart
  6. Register an account for yourself:

    ejabberdctl register YOURNAME YOURDOMAIN YOURPASSWORD
  7. If the ejabberd is on a different server set SRV records:

    jid.YOURDOMAIN.TLD. A IPSERVEREJABBERD
    _xmpp-client._tcp.YOURDOMAIN.TLD. SRV 10 0 5222 jid.YOURDOMAIN.TLD.
    _xmpp-server._tcp.YOURDOMAIN.TLD. SRV 10 0 5269 jid.YOURDOMAIN.TLD.