mount.at up again aka how to export ejabberd userdatabases from a harddrive connected to a different host

Posted on January 25th, 2008

by siyb

We decided to upgrade the hardware on mount.at today and therefore had to shutdown the server for several hours. Hades is running again now, but not all services are restored to their full extend, the jabber server (jabber.mount.at) has been recovered already and should be usable again. Due to the fact that the bootloader was installed on a hdd that had a total breakdown and I/O errors that prevented a reinstallation of bootloader on the system drive, we had to setup the server again.

The main problem was that our backups of the Mnesia database where outdated, they had to be recovered from the old hdd (the one not broken :>). This procedure turned out to be far more complicated / frustrating than expected. Due to the fact that the control interface ejabberdctl relies on RPC, which require a valid hostname to function properly, the recovery wasn’t as simple as calling the program from the host we connected the old harddrive to. I wrote a small howto for anyone stuck in the same situation:

Solution: chroot

Mounting the harddrive

mkdir /mnt/hdd && mount /dev/sdaX /mnt/hdd

Mounting proc

mount -t proc proc /mnt/hdd/proc/

Change the hostname on the box to the hostname of the machine Mnesia was used on (changing the hostname within the chroot didn’t work), this is necessary because RPC will not work if you do not use the hostname of your old box

$editor /etc/hostname

Chrooting

chroot /mnt/hdd

Starting up the ejabberd daemon and executing backup procedure

/etc/init.d/ejabberd start && ejabberd_ctl backup /tmp/ejabberd.backup

Exit the chroot and copy the backup from /mnt/hdd/tmp/ejabberd.backup to the box you wish to apply it to, use

ejabberd_ctl restore /tmp/ejabberd.backup

to finally restore the backup …

You may need to follow this tutorial when porting the database to a host with a different hostname -> http://www.ejabberd.im/migrate-host

Mount.at will be unavailable for some time tomorrow as well, because the hardware upgrade could not be finished in today’s session, please stand by and sorry for any inconvenience caused.

xMind ListonBeta6.1 r1

Posted on January 22nd, 2008

by siyb

After looking through all my projects today I realized that I haven’t been working on xMind in ages and that a lot of additions, changes and fixes planned for LB6.1 have already been committed, so that I decided to issue xmind_listonbeta6.1_r1. Due to a lack of time on my part there is no precise date for the next release, which is why LB6.1 is released now despite its incompleteness. The new .run archive installer has been tested and seems to work fine, nevertheless you may encounter errors when trying to compile Eggdrop, those errors are most certainly caused by missing requirements.

LB6.1 should work fine with tcl8.4 and tcl8.5, if there are any compatibility issues related to the tcl version you are currently using please submit it to our bug tracker so that the requirements and dependencies can be adjusted.

ListonBeta6.1 is shipped in two different formats, the well know .tar archive and the noobproof .run archive, which pretty much automates the installation procedure. Advanced user that wish to adept their xMind installation will prefer the .tar distribution everybody else should really stick to the automated installer, especially because the .tar installation method will not be supported by me any more. Check out the detailed installation instructions at the xMind wiki page, that we be updated in the following next few days in order to fully describe the new versions installation process.

xMind ListonBeta6.1 r1 .run
xMind ListonBeta6.1 r1 .tar

Asteroids 1.0

Posted on January 7th, 2008

by siyb

I have recently written a small POC / Demo game in TK and due to the fact that it has been quiet around here for some time, I decided write a small release post and attach the program for public use. The concept of Asteroids is simple, you are jammed in a asteroid belt and the only way to survive is to dodge incoming shrapnels. Increasings shunning skills will result in starship acceleration. Asteroids features 7 level that can be customized easily. New levels can be created in a similar manner (just in case you get bored).

I will probably not work on this game anymore, unless popularly demanded :P.

asteroids10.png
Asteroids1.0

Linux Games #6: Chromium

Posted on December 11th, 2007

by jesse
You are captain of the cargo ship Chromium B.S.U., responsible for delivering supplies to our troops on the front line. Your ship has a small fleet of robotic fighters which you control from the relative safety of the Chromium vessel. And you’re right in the battle.

Chromium is a fast paced, arcade-style, top-scrolling space shooter. Goal of the game is to survive the adrenalin peaks you get from playing get (*g*). You can read about the question why the game is so difficult: “Quitcher whinin’, you ninny! It’s supposed to be hard! Seriously, Chromium B.S.U. is intended to be a 15 minute adrenaline rush/mental cleanser. Frequent doses of explosions (even your own) can be very therapeutic.” which is pretty self-explanatory.

The rules are simple: every enemy ship that gets past the bottom of he screen will attack Chromium and you’ll lose a fighter. Besides shooting at them you can crash into the enemies or perform a strategic suicide which will kill every ship on the screen.

To make the game more fun you can grab two kinds of pickups: the skulls will supply you with weapons and ammunition, the shiny tuxes boost your shields, repare the ship or give you extra lifes.

Chromium uses SDL (1.1.6 or higher) and Hardware accelerated OpenGL or Mesa. One can find a precompiled Windows Binary, which is “100% unsupported” as well as the sources on the project page. Packages for the various linux distributions are available through the particular managers.

Fork Bombs verstehen und verhindern

Posted on November 29th, 2007

by jesse

Fork Bombs, gerade Linux Anfänger in gewissen IRC Channeln oder Foren (siehe ubuntuforums.org) fallen ihnen gerne zum Opfer, wenn sie eine der wichtigsten Regeln eines Anwenders missachten: niemals einen Befehl ausführen den man nicht versteht! Doch was steckt hinter den fiesen Sprengsätzen?

Eine Fork Bomb ist eine Form der Denial of Service Attacke gegen ein Computersystem, in dem Prozesse weitere laufende Prozesse erstellen können. Ziel dieser DoS Angriffe ist es, ein System handlungsunfähig zu machen indem man es mit verschiedensten Techniken an seine Grenzen bringt. Mit einer Fork Bomb startet man nun einen Prozess, der wiederum Kindprozesse startet die wiederum Kindprozesse ins Leben rufen. Dieser Spass geht solange weiter, bis auf dem System nichts mehr geht. Dem Anwender oder Admin bleibt nach kurzer Zeit nur noch die Möglichkeit, den Stecker zu ziehen.

Fork bomb principle by Dake

Die coolste und weitverbreitetste Fork Bomb ist wohl . ( ) { . | . & } ; . für die Bourne Again Shell. Was passiert im Detail, wenn man sie ausführt? Schön aufgeschlüsselt wird das im Packetfu Blog:

. () { . | . & } ; .
0 1  2 3 4 5 6 7 8 9

0 - Neue Funktion mit Namen definieren
1 - Die Klammern bezeichnen die Funktion, die ohne (optionale) Argumente auskommt
2 - Funktionsblock beginnt
3 - Ruft sich selbst, die gerade erstelle Funktion, rekursiv auf
4 - Öffnet eine Pipe zu einem weiteren Prozess
5 - Ruft sich selbst, die gerade erstelle Funktion, erneut rekursiv auf
6 - Der Fork (in den Hintergrund schieben)
7 - Funktionsblock wird geschlossen
8 - Beenden der Funktionsdeklaration
9 - Ausführen der Funktion

Oder wie von pimpmyshell.de dargestellt bedeutet das in ausgeschriebener Form:

forkbomb() {
forkbomb | forkbomb &
};
forkbomb

 

Klar soweit? Dann kommen wir automatisch zu der Frage, wie man sich gegen Fork Bombs und DoS Attacken im Allgemeinen schützen kann. Die Prophylaxe ist vor Allem dann wichtig, wenn man anderen Benutzern in irgendeiner Form Zugriff auf die eigenen Maschinen gewährt - ob mit root Rechten oder nicht. Besondere Bedeutung kommt da übrigens auch Webservern und den darauf laufenden Skripten zu. Weiss ein Angreifer, dass eine bestimmte Seite oder Webanwendung besonders viele Ressourcen benötigt, kann er durch gebündelte Zugriffe schon mit einem PC erhebliche Beeinträchtigungen erzeugen.

Abhilfe bietet Linux zum Beispiel mit den PAM Limits Modul an, das (meistens) in /etc/security/limits.conf konfiguriert wird. Auch hier erscheint einem auf den ersten Blick alles recht kryptisch. Zu tief in diese Datei eindringen macht mit Sicherheit für 90% der Leser keinen Sinn, daher gehe ich an dieser Stelle nur auf die wichtigsten und effektivsten Werte und Parameter ein.

Horizontal ist die Datei in <Domain>, <Type>, <Item> und <Value> unterteilt.

Domain kann hier Folgendes sein:

  • ein User,
  • eine Gruppe (mit @-Präfix),
  • die Wildcard * für den Standardeintrag,
  • die Wildcard % für das maxlogin Limit.

Type ist

  • 'soft' für das Erzwingen eines weichen Limits, das der User bei Bedarf anheben kann, oder
  • 'hard' für das Erzwingen eines harten, absoluten Limits, das nur der Superuser verändern darf.
  • Gibt man stattdessen ein '-' (Minus) an, gilt es für beide.

Und Item bezeichnet, was wir tatsächlich begrenzen möchten:

  • core: maximale Grösse in KB eines Core Files, welches vom Betriebssystem erstellt wird, wenn zum Beispiel ein Programm abstürzt
  • fsize: maximale Grösse in KB, die eine Datei haben darf
  • nofile: maximale Anzahl gleichzeitig geöffneter Dateien
  • rss: maximal verwendbarer Arbeitsspeicher (KB)
  • nproc: maximale Anzahl von Prozessen
  • maxlogins: maximale Anzahl der Logins für einen User
  • locks: maximale Anzahl von Dateisperren die ein User hält

In der Beispielkonfiguration sind wie erwähnt noch weitere Items vorhanden. Um beispielsweise einer Fork Bomb den Riegel vorzuschieben genügt es aber schon, nproc einen Wert zuzuweisen, also die Anzahl von Prozessen, die ein User ausführen darf, einzuschränken. Wir nehmen dazu an, dass alle Benutzer in der Gruppe users sind und legen folgenden Eintrag in der /etc/security/limits.conf an:

@users soft nproc 75
@users hard nproc 100

Ein User darf also 75 Prozesse laufen lassen. Bei Bedarf kann er sein Soft Limit auf 100 hochsetzen, da ist dann aber definitiv Schluss. Wo man die Grenze genau legt ist von System zu System unterschiedlich. KDE oder Gnome mit den zugehörigen Tools, dazu Firefox, Thunderbird, mpd und ein paar X-Shells, da kann es schonmal eng werden. Ausprobieren heisst die Devise. Anzeigen lassen sich die aktuellen Limits übrigens mit dem Befehl ulimit -a.

Weitere Informationen und Quellen:

yigg this


design: makequick.com | modificashuns and bugfixes by jesse
bottom