bloginfo('name');

bloginfo('description');

Archives Posts

How to setup HTTPS for your Apache2

Februar 23rd, 2009 by Blu:RayNe

Basic Information

First off, you need a SSL-Certificate for HTTPS. This certificates are usualy checked by your browser against SSL providers such as VeriSign for validity. If the outcame is invalid, some website may have been replaced with a fake-version by a hacker. The result is, that your browser warns you that the certificate for the site is invalid and it probalby was hacked or stuff like this (there was also a bug on creating invalid certificates on Debian-Linux some time ago *G*).

Anyway, you can still add the certificate as exception and get SSL-connection to the website, so no one is seeing what you are actually doing on that site or what data is beeing transferred (e.g. your E-Mail Client).

Basic Setup

The easiest way to setup this stuff is as of following (assuming using Debian/Ubuntu and Apache2):

$ apt-get install openssl
$ mkdir -P /etc/apache2/ssl/
$ openssl req $@ -new -x509 -days 365 -nodes -out server.crt -keyout server.key

Then add something like this to your Apache2-Configuration:

NameVirtualHost 443

<VirtualHost *:443>

SSLEngine on
SSLOptions +FakeBasicAuth +ExportCertData +StrictRequire
SSLCertificateFile /etc/apache2/ssl/server.crt
SSLCertificateKeyFile /etc/apache2/ssl/server.key
# SSLProtocol -all +TLSv1 +SSLv3
SSLProtocol all -SSLv2

[...]

</VirtualHost>

Basically, that’s it! Don’t forget to restart apache and also note that SSL2 is outdated and therefore unsecure. Be aware of that on using MSIE-Browsers from Microsoft! So i just disallowed it here in the example above. It also has opions set for using Basic HTTP-Auth on HTTPS and sets also some SSL-specific apache environmental veriables.

If Apache doesn’t start up look under /var/log/apache2/ for error messages!

Extended Setup

Some snippets if you already have a server key or want need to create your own, for having it signed and so on. If you set a password for a server key – which is indeed required for secuerity reasons – note, that Apache asks for it on startup.

Create a server key

openssl genrsa -des3 -out server.key 1024

You can convert the secure key to an unsecure („without password“):

$ openssl rsa -in server.key -out server.key.insecure

Create a basic  certificate for your key by using this:

$ openssl req -new -key server.key -out server.csr

Then sign it:

$ openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt

Same stuff with insecure key:

$ openssl x509 -req -days 365 -in server.csr -signkey server.key.insecure -out server.crt

Archives Posts

MSIE – Dante’s Inferno for Linux (or Web Developers)

Dezember 21st, 2008 by Blu:RayNe

ies4linux is a nice project that brings MSIE 5.0, 5.5, 6.0 and 7 to Linux under WINE.

Filed under Allgemein, Browser, Linux having No Comments »

Archives Posts

.htaccess zum Schutz gegen BND Terror-Kracken (Teil2)

November 13th, 2008 by Blu:RayNe

Nachdem gestern das BKA-Gesetz durchgewunken wurde, und uns einen Schritt näher an die Neue Weltordnung Banenrepublik DDR. 2.0 bringt, mal eine positive Nachricht: Soeben sind auf Wikileaks die IP Ranges des BND geleakt!

Endlich kann der Bürger sein virtuelles Hausrecht wieder etwas stärken. Nach der .htaccess zum BKA Terror-Bot, nun die .htaccess gegen den BND Terror-Kracken. Das hilft nur nix gegen Schäubles neue Schnüffelbehörde nach NSA Vorbild, aber seien wir wenigstens froh, dass unsere Bundeskanzlerin keine eigenen ihr unterstellten Geheimdienste á TALON & Co. hat  – oder doch?.

Alle anderen Stellen sind ja gott-sei-dank von inkompetenten Pack und Internetausdruckern besetzt. Tja, da klappt es dann doch nicht so schnell mit dem Polizeistaat ;)

# Deny access from BND Servers
# https://secure.wikileaks.org/wiki/T-Systems_BND_network_assignments%2C_13_Nov_2008

RewriteEngine on
RewriteCond %{HTTP_REFERER} bvoe [NC,OR]
RewriteCond %{HTTP_USER_AGENT} bvoe [NC,OR]
RewriteCond %{REMOTE_HOST} bvoe [NC,OR]
RewriteCond %{HTTP_REFERER} lvp [NC,OR]
RewriteCond %{HTTP_USER_AGENT} lvp [NC,OR]
RewriteCond %{REMOTE_HOST} lvp [NC]
RewriteRule ^.*$ http://www.google.de/search?hl=de&amp;q=fema+death+camps+bush+nazi+fascist [R=301,L]

Order Allow,Deny
Deny from 195.243.248.226/32
Deny from 195.243.248.228/32
Deny from 62.156.187.234/32
Deny from 62.156.187.236/32
Deny from 62.159.60.150/32
Deny from 193.159.228.32/29
Deny from 193.159.238.168/29
Deny from 194.25.184.16/29
Deny from 194.25.42.232/29
Deny from 195.145.128.56/29
Deny from 195.145.163.64/26
Deny from 195.145.182.96/28
Deny from 195.145.182.96/28
Deny from 195.145.31.252/30
Deny from 195.145.57.176/28
Deny from 195.243.157.184/29
Deny from 195.243.248.224/29
Deny from 212.185.184.224/29
Deny from 212.185.191.128/29
Deny from 217.7.155.168/29
Deny from 217.89.74.208/28
Deny from 62.153.59.192/27
Deny from 62.153.65.32/29
Deny from 62.153.80.208/29
Deny from 62.153.87.0/28
Deny from 62.154.211.152/29
Deny from 62.154.226.64/26
Deny from 62.156.187.232/29
Deny from 62.157.136.64/27
Deny from 62.157.144.0/26
Deny from 62.157.193.128/26
Deny from 62.157.193.192/27
Deny from 62.157.194.32/29
Deny from 62.157.194.32/29
Deny from 62.159.19.208/29
Deny from 62.159.104.160/28
Deny from 62.159.209.144/29
Deny from 62.159.209.152/29
Deny from 62.159.21.152/29
Deny from 62.159.60.144/29
Deny from 62.159.63.72/29
Deny from 62.225.139.248/29
Deny from 62.225.74.128/29
Deny from 80.146.198.88/29
Deny from 62.159.104.160/28
Allow from all

How to calculate CIDR:

#!/usr/bin/perl
use Net::CIDR;
$range = shift;
print (join("n", Net::CIDR::range2cidr("$range")) . "n" );

Usage:

$ ./iprange2cidr 192.168.0.0-192.168.0.255
192.168.0.0/24

Alternativ vll. ma auf diese Seite gucken:
http://www.ipaddresslocation.org/

Log-Files nach IPs durchsuchen:

grep -E ":(`cat bnd-ips.txt | sed 's/\./\\./g' | tr '\n' '|'`)"  access_log_2008-*

Archives Posts

Ubuntu: Is the intrepid ibex still jumping?

Oktober 31st, 2008 by Blu:RayNe

Or update day: it still jumps over the rocks, but seems it got one foot hurt: keyboard mapping doesn’t work for me anymore – the arrow keys are not mapped rightly.

At least Ubuntu is a big distro, so there are already tickets for it:

https://bugs.launchpad.net/ubuntu/+bug/255861

https://bugs.launchpad.net/ubuntu/+source/xorg-server/+bug/255008

Damn. I should have waited another week, but i don’t want to go back anymore. At least all other things still seem to work and my Nautilus now has tabs. The update took about 40mins and worked fine. Good job!

setxkbmap -model evdev
setxkbmap -model evdev -layout de -option lv3:ralt_switch

Hmmm.. works… partly :(

If i just knew that Fedora works now better. I tested out the latest version a month ago and it made up a very stable and fresh impression. Perhaps i’ll give it another try one day.

Well, i guess i’ll make up a new version of my xmodmap.rc now :/

Filed under Linux having No Comments »

Archives Posts

YouTube and transcoding video with vixy.net

August 12th, 2008 by Blu:RayNe

I hate all those low quality videos from YouTube. You know there is that trick to concenate &fmt=18 to YouTube-URLs to have it access the new servers with higher quality videos and better bandwidth performance, but still that does not makes me happy.

Having FLV is ok for me, although I dislike non-standard container formats. But the point is copying those FLVs for friends often ends up by them complaining not beeing able to play the files on their Windows or Mac. The same problem persists on the iPod or my mobile phone that just understands 3GP in the moment.

So i end up having to convert the files… or transcoding them.

Conversion vs. Transcoding

Converting usally means decoding the video to a full video-picture – probably with or without any post-processing– and loosing the visual information that was artifically added again by encoding. Also, most of the  bitstream-information on the decoded stream is also lost, because you only see a the picture and not what abstract data is behind.

That is the place where transcoding comes into play: It transcodes the data be going deep into the input stream directly translating it the the output stream. The “visual step“ between encoding and deocoding is skipped, because not necessary. In the end we have not only faster conversion process, but have also retained all possible quality. 

Ok, if input and output en/decoding algorithms differ too much or you wanna resize the video you still have to convert the videos. Point is that the algorithms used in input and output stream have to be similar to each other (beeing often MPEG4 on nowadays video material).

I discovered vixy (which is based on ffmpeg) und does a nice job on transcoding. On windows and Mac you have a GUI limited to YouTube. The Online-Converter itself seems to be always overloaded. So, time to compile our FLV 2 MPEG4 Tool ourselves (for Ubuntu/Debian):

$ apt-get install apt-get install libavcodec-dev libavformat-dev libavutil-dev ffmpeg subversion
$ apt-get build-dep ffmpeg
$ mkdir flv2mpeg4
$ cd flv2mpeg4
$ svn co https://vixynet.svn.sourceforge.net/svnroot/vixynet/trunk/flv2mpeg4/ .
$ cd src
$ gcc -O3 -o flv2mpeg4 avformat_writer.c dcprediction.c flv2mpeg4.c fetch.c flvdecoder.c m4vencode.c mp3header.c -lavformat -lavcodec -lavutil -I/usr/include/ffmpeg -L/usr/lib
$ cp flv2mpeg4 /usr/bin

A last word to YouTube. I don’t suggest uploading to it in no way!

  • They manipulate view counters on videos with strong political content (e.g. 200 views and 300 comments?)
  • Everything you upload, belongs to them! Read the terms!
  • Quality still sucks  (it’s for the american market; but we have broadband here in germany!)
  • Servers are often damn slow, espacially at 23:00 CEST+1 when all americans go on the site
Filed under Linux, Netzwelt having No Comments »

Archives Posts

„Sehr geehrter Kunde, Ihre Mail ist Spam!“

Juli 16th, 2008 by Blu:RayNe

Und das sag ich immer wieder, da es anscheinend noch unzählige Leute in der Druck/IT-Branche gibt, die eigentlich hier nichts zu suchen hätten. Ich erhalte immer noch viel zu Mails ohne Subject und ohne eindeutigen Bodytext, der mir beschreiben würde, um was es eigentlich geht. Manchmal fehlt sogar die Ansprache, oder Footer mit Firmenadresse.

Selbst ist man damit oft zu Rücksprachen gezwungen, die oft lange überflüssige Telefongespräche nach sich ziehen. Aber besser wenn der Kunde von selbst anruft, da gibt es noch andere Möglichkeiten…

–„Neee.. ich habe Ihre E-Mail nicht gesehen.. ich glaube ich hab da nichts bekommen… moment… ich guck mal… ah.. hier.. Spam.. naja.. die Mail is ja auch Spam…“
– „Wie! Spam?! Meine Mail ist doch keine Spam… !“ (sichtlich verblüfft)
– „Kein Subject, kein Inhalt und nur eine PDF als Anhang wäre unter meiner Sichtweise auch Spam… und schließlich ist die Absenderadresse fälschbar. Oder was würde sie unter Sichtweise des Anti-Spam-Programms sagen?“

Und dann gab es gestern noch die Frage an mich: „Warum hast du die UPS-Mail nicht bearbeitet, die ich dir weitergeleitet habe?“. Und ich sagte nur „UPS-Mails haben keine .EXE-Änhange und kommen nicht von tfds.vddseew@hotmail.com“ *seufz*

Hierbei handelte es sich wieder einmal um Vorgesetzte…

Filed under Berufsalltag, Browser, Fun, Linux having No Comments »

Archives Posts

1&1: Update versaut – GNU Database compat-Bibliotheken für Perl 5.8.8 fehlen!

März 5th, 2008 by Blu:RayNe

So und wieder mal Ärger mit 1&1 aka. „der Schlund?, was mir als Namensgebung weiterhin besser gefällt. Dieses mal geht es darum dass die Jungs beim Perl-Update eine compat-Lib vergessen haben.

Hallo,

Es geht um die Domain http://www.example.com/. Darauf liegt unter http://www.example.com/cgi-bin/tabellen.cgi?liga=Mayer-Bezirksliga ein
CGI-Skript was mit Perl2EXE in ein ELF-Binary konvertiert wurde.

Da es eine Auftragsarbeit ist und das File im Binary-Format, haben wir keine Chance, es noch zu ändern. Die Domain ist in diesem Zustand nämlich seit 5 Jahren online.

Unter dem 1&1 Control Panel/Admin-Bereich spuckt das „Script? unter CGI-Ausgabe folgende Fehlermeldung aus:

     127 CGI returned nonzero status /kunden/homepages/22/d27514621/htdocs/cgi-bin/tabellen.cgi: error while loading shared libraries: libdb.so.2: cannot open shared object file: No such file or directory

Eine ähnliche Fehlermeldung erhalte ich, wenn ich das Skript auf einen lokalen Debian/Etch (R3) Server ziehe:

     ./tabellen.cgi: error while loading shared libraries: libgdbm.so.2: cannot open shared object file: No such file or directory

Die Bibliothekn mit ldd gecheckt, sagt mir weiterhin noch folgendes:

 $ ldd ./tabellen.cgi         linux-gate.so.1 =>  (0xffffe000)libnsl.so.1 => /lib/tls/libnsl.so.1 (0xb7fad000)

libdb.so.2 => /lib/libdb.so.2 (0xb7f9d000)

libgdbm.so.2 => /usr/lib/libgdbm.so.2 (0xb7f97000)

libdl.so.2 => /lib/tls/libdl.so.2 (0xb7f93000)

libm.so.6 => /lib/tls/libm.so.6 (0xb7f6e000)

libc.so.6 => /lib/tls/libc.so.6 (0xb7e3c000)

libcrypt.so.1 => /lib/tls/libcrypt.so.1 (0xb7e0e000)

/lib/ld-linux.so.2 (0xb7fd4000)

Lokal konnte ich das Problem schnell durch Installation der Pakete libgdbmg1 und libdb1-compat beheben, wie mir auch die Debian-Paketsuche zeigte.

Auch wenn sysinfo.cgi auf betroffenem Server ausspuckt, dass folgende Libs eingebunden wurden -lgdbm -lgdbm_compat -ldb -ldl -lm -lpthread -lc -lcrypt -ldl -lm -lpthread -lc -lcrypt so scheinen also noch ein paar legacy files zu fehlen! Sie haben also wohl bei Ihrem letzten Server Update vergessen, die das compat-Paket mit zu installieren!

Ich möchte Sie also bitten auf dem System alles was in Zusammenhang mit GDBM (GNU Database) und libdb1-compat steht noch mit auf den Server zu packen. Im Einzelnen sind das wohl die Pakete gdbm, libdb1-compat, libgdbmg1, libgdbm-dev(falls nötig?) und libgdbm*.

Möglicherweise lässt sich das Problem so schnell lösen. Bitte geben Sie bescheid, wenn alles wieder funktioniert. Der Kunde wartet.

Im Voraus vielen Dank!

MfG
.mg

Sogar schon am 6. Tag gab es eine Antwort:

Sehr geehrter Herr **********,

vielen Dank für Ihre Anfrage die ich gerne beantworte.

Nach eingehender Prüfung liegen mir nun weitere Informationen zu Ihrem
Anliegen vor.

Leider können wir die gewünschten Libaries nicht zur Verfügung stellen
da diese in die globale Serverkonfiguration eingebunden werden müssten
und das technische Komplikationen hervorruft.

Wir können Ihnen lediglich anbieten Sie bis zum 08.04.2008 auf einen
Ausweichserver um zuziehen auf dem noch die alte Betriebssystemumgebung
installiert ist. Nach diesem Datum wird jedoch auch dieser Server
umgestellt. Auch kann keine Garantie dafür übernommen werden das Ihr CGI
auf diesem Server läuft. Falls Sie einen Umzug auf einen solchen Server
wünschen geben Sie uns bitte hierzu eine kurze, entsprechende
Information.

Eine langfristige Lösung kann aber nur dadurch gewährleistet werden das
die Binaries in Etch kompatibler Form erstellt werden.

Bei weiteren Fragen stehen wir Ihnen gerne zur Verfügung.

Mit freundlichen Grüßen

**********

So, und nun böse Antwort #1:

Hallo,

Sagt mal, arbeiten bei euch Übersetzer, die ansichtlich „Tech-Babble? in „Noob-Slang? mit einer Informationsdichte übersetzen?

Also, Ihr gebt zu, das Ding nicht installieren zu wollen, stattdessen die Page aber auf einen Server auszulagern, auf dem Ihr spätesten am 8.4. wieder nur einen Teil der Software, die zum reibungslosen Betrieb notwendig wäre installiert? Toll! Leider keine wirkliche Lösung.

Übrigens: Da diese restlichen Server ja wohl noch auf Debian 3.1 laufen, nur die Info dass die Security-Maintainance von Debian am 04.05. endet. D.h. ihr seid damit auf den letzten Drücker dran, und überschreitet die SOLL-Zeit auch noch um 4 Tage!

Leider können wir die gewünschten Libaries nicht zur Verfügung stellen
da diese in die globale Serverkonfiguration eingebunden werden müssten
und das technische Komplikationen hervorruft.

Komplikationen ja, Konflikte möglich, aber eher unwahrscheinlich, da euer System wohl zum großen Teil über Debian und sein Paket-Management läuft! Auf jeden Fall gibt es aber bei euch jede Menge Bürokratie!

Die langfristige Lösung heißt im Übrigen libdb1-compat ;) Desweiteren heiße ich auch nicht Herr **********, aber arbeite für diesen Mann.

Mit kleinen Providern gibt es im Übrigen bei solchen Dingen meist keine großartigen Probleme, obwohl die im Gegensatz zu euch, nicht der ganzen Welt einen Stempel aufdrücken wollen, wie toll ihr Service/Support ist.

Und ich weiß eh, dass es auf diese E-Mail keine Antwort gibt. Aber trotzdem, ich weiß wie Scheiße euer Job ist :( wechselt doch zu domainfactory, bei denen soll es soweit ok sein (laut Kumpel).

MfG
.mg

Ich wartete auf die Antwort sechs Tage, hackte nochmal mit einer E-Mail „Na, gibt’s Neuigkeiten?? nach, erhielt am abend des siebenten Tages folgendes:

Sehr geehrter Herr Geiger,

hier noch ein Vorschlag:

Sie könnten die benötigten Libraries selbst in einem Verzeichnis ~/lib
auf Ihrem Webspace installieren und mit Hilfe der folgenden .htaccess
-Anweisung in Ihre cgi-Skripte einbinden:

SetEnv LD_LIBRARY_PATH  /homepages/22/d27514621/htdocs/lib

Bei weiteren Fragen stehen wir Ihnen gerne zur Verfügung.

Mit freundlichen Grüßen
************

So der letzte Versuch die Jungs zur Installation zu bewegen:

Hallo,

zwar ein guter Vorschlag, der aber daran krankt, das die Environment Variable nur unter Apache gültig ist. Fehlermeldungen sehe ich leider hingegen leider nur unter dem CGI-Ausgabe-Monitor . Somit dürfte die Installation der Libs schwierig bis (nahezu) unmöglich sein.

Können sie sich nicht einfach doch dazu bewegen auf dem Server die libgdbmg1, libgdbm-dev und libdb1-compat zu installieren? Das würde nicht nur mein Problem lösen, sondern auch Ihres ? nämlich jenes dass mit mir haben. Und das Ansehen des Supports würde wieder ein paar Punkte auf meiner Skala steigen ;)

Viele Grüße!

MfG
.mg

Naja, die Ausgabe kann man ja eigentlich umleiten. Bisher hab ich nicht viel in Perl gemacht, also erstmal noch nem Error-Logger gesucht. Und dann auf die Idee gekommen, doch einfach das Script via einem system-call aufzurufen und die Ausgabe mit 2>&1 1>log.txt umzuleiten.

Die Environment-Variable zu setzen hat nicht geklappt, aber die Lib hat er auch im Execution-Driectory akzeptiert. Fünf Minuten später gab es eine Erfolgsmeldung:

Hallo,

Es muss natürlich heißen /kunden/homepages/22/d27514621/htdocs/lib. Zudem habe ich die Ausgabe von STDERR und STDOUT einfach umgeleitet, um mir die Diagnose zu erleichtern. Und ich darf Ihnen mitteilen, dass somit wieder alles läuft.

Wengistens danke, dass ihr auch Debian benutzt, weswegen ich mir nicht die Libs von sonstwoher ziehen musste.

MfG
.mg

UPDATE: Use setrpath-Utiltity to change ELF search paths.

Filed under Administratives having No Comments »

Archives Posts

Commonly used Debian repositiories

Juli 4th, 2007 by Blu:RayNe

Ok, here some often needed debian repositiories for your /etc/apt/sources.list. This article will get updated when needed.

# Unoffical packages that harm debian licenses
deb http://ftp.debian-unofficial.org/debian etch main contrib non-free restricted

# Distribution Mirror server from 1&amp;1
deb http://update.rootmaster.info/debian stable  main contrib non-free
deb http://update.rootmaster.info/debian-non-US stable/non-US main contrib non-free

# Distribution Mirror server from Strato
deb http://ftp.serverkompetenz.de/debian/ etch main contrib non-free

# Offical Debian
deb http://http.us.debian.org/debian stable main contrib non-free

# Debian security updates
deb http://security.debian.org/debian-security stable/updates main contrib non-free

# Up-to-date Apache, PHP and MySQL
# deb http://dotdeb.netmirror.org/ stable all
# deb-src http://dotdeb.netmirror.org/ stable all
deb http://packages.dotdeb.org etch all

# mplayer, ffmpeg and so on…
deb http://www.debian-multimedia.org etch main

# Mono
deb http://www.mindtouch.com/apt/ sarge main contrib non-free#

# Updates for viruses &amp; spam filters
deb http://volatile.debian.net/debian-volatile sarge/volatile main contrib
deb http://people.debian.org/~dexter php5.1 sarge
deb-src http://people.debian.org/~dexter php5.1 sarge
deb http://www.os-works.com/debian testing main

# Backports – if you really need them!
# deb http://www.backports.org/debian/ sarge-backports main contrib non-free
 

Filed under Allgemein, Linux having No Comments »

Archives Posts

Backup remotely via Perl

Mai 29th, 2007 by Blu:RayNe

Ok, i guess you love that cheap servers only with FTP and HTTP, and minimal PHP4-Timeout and lame CGI and no real possibility but to do a good backup job. Well, Perl was once a dominant language and can do much for you.

The benefits of following backup solutions are as follows:

  • Backup is done via calling an URL
  • that invokes the mysqldump utility to backup your database to a local director, that is preferable outside the webroot
  • the data is then gzipped
  • old backups are automatically deleted
  • and then backed up via FTP to another server
  • and while a second server gets the backup it is more secure than having all on a single server

Put this in you cgi-bin folder and remotely call it via CURL or test it via the browser. Don’t forget tot set chmod 755 for the files! If you backup to a directory in the webroot don’t forget to protect that directory by e.g. setting a up an .htacess-file!

#!/usr/bin/perl -w

use CGI;
use POSIX qw(strftime);
use Time::Local;

$query    = new CGI();
$file     = $query->param(‘file’);
$filename = $query->param(‘filename’);

print "Content-Type: text/plain\n\n";
# print "Content-type: application/octet-stream\n";
# print "Content-Disposition: attachment; filename=".$filename."\n";
# print "Pragma: no-cache\n";
# print "bash ".$file;

sub backupMysql
{
    my ($host)     = $_[0];
    my ($username) = $_[1];
    my ($password) = $_[2];
    my ($database) = $_[3];
    my ($title) = $_[4];

    $time = time;
    $filename = $title."-".$database."-".strftime("%Y%m%d-%H%S", localtime($time));
    print "Backup of \"".$title."\" (".$database.")…";
    system "mysqldump -e –add-drop-table –add-locks –allow-keywords -h".$host." -u".$username." -p".$password." ".$database." > ../../backup/".$filename.".sql";
    # print "GZip ".$filename."…\n";
    system "gzip ../../backup/".$filename.".sql";
    # print "Unlink ".$filename.".sql…\n";
    unlink "../../backup/".$filename.".sql";
    print "done.\n";
}

# Delete previous backups
if (-d "../backup/") {
    $where = "../backup/";
    while (defined($next = <$where/*.sql.gz>)) {
        unlink($next);
    }
}

backupMysql("<em>host</em>", "<em>username</em>", "<em>password</em>", "<em>database</em>", "<em>mybackupname</em>");

 

Optional .htaccess-File:

<Files ~ ".*(sql|gz|tar)">
    Deny from all
</Files>
 

Then call the URL by cronjob:

#!/bin/sh

remoteAddress="<em>ftp://user@yourftp.com</em> -p <em>password</em>"
localAddress="<em>/home/Backup/mybackupname</em>"

timeThreshold=15
mirrordirOptions="-v –keep-files  –no-chown –no-chmod  –num-backups 30 –mtime-threshold $timeThreshold "

echo "Backup to $localAddress — `date +"%a, %C.%B %Y"`"
echo -n "[`date +%H:%M:%S`] Killing runnung instances of mirrordir…"

/usr/bin/killall -9 mirrordir &amp;2>1 > /dev/null
echo "done."

mkdir -p $localAddress/htdocs > /dev/null

echo  "[`date +%H:%M:%S`] Backup of relevant databases…"
curl http://www.yourdomain.com/cgi-bin/backup/mysql.cgi
echo "done."

echo -n "[`date +%H:%M:%S`] Backup of remote FTP…"
/usr/bin/mirrordir $mirrordirOptions $remoteAddress $localAddress/htdocs
echo "done."

echo "[`date +%H:%M:%S`] Finished."
 

If you don’t have mirrordir or curl install it via aptitude install mirrordir curl on your debian box.

Filed under Allgemein, Datenbanken, Linux having No Comments »

Archives Posts

How to install Java and FOP on your linux box

Mai 20th, 2007 by Blu:RayNe

Debian or other Linux-Distributions do not include Java by default, so you first have to install the JVM. This is done in Debian by downloading the JVM binary distriubtion  from sun and then building a DEB-Package with the tools form java-package that you install by dpkg -i.

But let’s do that step-by-step:

Installing JAVA on your Debian box

  1. You’ll need the JavaVM, so get it at http://java.sun.com/ and search for the latest version. The filename should be something like jdk-1_5_0-linux-i586.bin.
  2. If not yet done, install the tools from java-package as root-user:
    apt-get install java-package

  3. Then build a DEB-Package from the downloaded file. This can and should be done only as standard user (no root!)
    fakeroot make-jpkg <java-binary-package-name>.bin

  4. If everything goes fine, you should see something like
    The Debian package has been created in the currentdirectory. You can install the package as root (e.g.dpkg -i sun-j2sdk1.5_1.5.0+update00_i386.deb).
  5. Then just install the package by ther given command:
    dpkg -i <created-package-name>.deb

  6. Check if it works by typing java -version. Following should be seen as standard and root user:
    java version "1.5.0"Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-b64)Java HotSpot(TM) Client VM (build 1.5.0-b64, mixed mode, sharing)

Installing Apache FOP on your Debian box

  1. Check if Java is installed and running.
  2. Get the latest binary from http://xmlgraphics.apache.org/fop/ . The file should be named something like fop-0.93-bin-jdk1.4.tar.gz.
  3. Extract the contents of the archive by tar -zxvf <fop-tarball>. This should results in a directory called fop-0.93.
  4. Move the directory to /usr/local/lib
    mv fop-0.93 /usr/local/lib
  5. Make a symlink for the directory without the version number
    ln -s /usr/local/lib/fop-0.93 /usr/local/lib/fop
  6. Make a symlink for the command line wrapper script in your /usr/bin
    ln -s /usr/local/lib/fop/fop /usr/bin/fop
  7. Edit /usr/bin/fop and put following at the beginning of the file (and below the header comment section!):
    export FOP_HOME=/usr/local/lib/fop

  8. Test the installation not only by typing fop -v, but instead by converting a fo file. This is necessary, because the command line wrapper is still very experimental:
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">

    <fo:layout-master-set>
      <fo:simple-page-master master-name="A4">
      <fo:region-body /><
      </fo:simple-page-master>

    </fo:layout-master-set>

    <fo:page-sequence master-reference="A4">
      <fo:flow flow-name="xsl-region-body">
        <fo:block>Hello World!</fo:block>
      </fo:flow>
    </fo:page-sequence>
    </fo:root>

More help

You can get in-depth installation guides and instructions here:

« Previous Entries