Winterschlaf beendet

Standard

So dann mal raus aus dem Winterschlaf und weiter gebloggt. *gaehn*. Habe festgestellt, das ich seit mehr als einem Monat nichts mehr vom Stapel gelassen habe. Muss an dem Winter Weltuntergang gelegen haben an dem wir hier nur so gerade vorbeigekommen sind.

Also, war ja recht amüsant was sich die letzten Wochen in der BRD, also ich meine natürlich die Bananen-Republik-Deutschland abgespielt hat.

Fangen wir mal bei den Geschäften der BRD mit Hehlerware an. Illegale Datensätze erwerben und damit die Staatskasse füllen, gleichzeitig an allen Ecken Firmen wegen Datenschutzverstößen und Datenmissbrauch an den Pranger stellen. Passt ja riesig zu einander. Dann diese riesige Ablenkungsaktion: “Google Streetview ist böse!”. Entschuldigt, aber ich gebe meine Daten lieber Google als derzeit irgend einem Staat, einer Versicherung oder Bank. Google sind bisher nämlich keine Daten abhanden gekommen. Und warum? Weil es deren Kapital ist. Google lebt davon Daten zu besitzen und aus deren Verarbeitung und nicht Weiterverkauf Kapital zu schlagen. Und für Streetview gibt es wohl ne handvoll Gesetzte in Deutschland die das ganze legalisieren als anders herum. BTW: Also den Schweizern gefällt das natuerlich gar nicht, dass deren Landsleute dazu verleitet werden reihenweise Daten illegal zu kopieren und als Hehlerware nach Deutschland zu verkaufen und so drohen die damit, mal die Konten deutscher Politiker in der Schweiz offen zu legen. Zum einen finde ich das absolut die richtige Reaktion, aber zum Anderen glaube ich, würde das noch mehr zum Vorschein bringen: Dann würde vermutlich recht schnell raus kommen, dass auf den bisher erworbenen CDs sicher auch schon deutsche Politiker gelistet waren, was aber “zufällig” übersehen wurde. Oder glaubt wirklich jemand, die Hehler in der Schweiz hätten darauf schon Rücksicht genommen?! Also ich nicht.

Backup With Bacula And LUKS Encrypted USB Disks – Part 2

Standard

As promised here comes part two of my “Backup with Bacula and LUKS encrypted USB disks” howto. In part one I explained how to prepare the disks for using them with autofs and how to configure autofs itself. Now we have a good basis for Bacula to use those disks as storage for the backups.
As I said I want to use those disks as virtual tapes in a virtual tape library. This gives us the most flexibility in changing the disks or not (holidays, etc.). With vchanger you get a nice tool to emulate such a virtual tape library. After installation the vchanger binary should be available at /usr/local/bin. I created a config file called vchanger.conf at /usr/local/etc with the following content:

# changer_name  -  [required] Name of this autochanger
changer_name = "usbchanger1"
# state_dir - Directory where virtual drive state and symlinks are created
#             [Default: /var/lib/bacula/]
state_dir = "/var/lib/bacula/usbchanger1"
# logfile  -  Path to a file where errors and debugging info will be logged.
#             [Default: none]
logfile = "/var/lib/bacula/usbchanger1.log"
# slots_per_magazine  -  Number of slots each of the autochanger's magazines
#                        will have. [Default: 10]
slots_per_magazine = 10
# virtual_drives  -  Number of virtual drives to use. [Default: 1]
Virtual_Drives = 1
# magazine  -  [Required] Gives the mountpoint directory of a magazine.
#              Multiple magazine directives may be specified to define
#              a multi-magazine autochanger. Each magazine has the same
#              number of slots, so the autochanger will have
magazine = "/mnt/usbchanger1/magazine"

To use that virtual device with Bacula, modify the configuration of the Bacula storage daemon.

[..]
Autochanger {
 Name = usb-changer-1
 Device = usb-changer-1-drive-0
 Changer Command = "/usr/local/bin/vchanger %c %o %S %a %d"
 Changer Device = "/usr/local/etc/vchanger.conf"
}
#---  drive 0 of the usb-changer-1 autochanger
Device {
 Name = usb-changer-1-drive-0
 DriveIndex = 0
 Autochanger = yes;
 DeviceType = File
 MediaType = File
 ArchiveDevice = /var/lib/bacula/usbchanger1/0/drive0
 RemovableMedia = no;
 RandomAccess = yes;
}
[..]

And add this device as storage to you Bacula director’s configuration.

[..]
Storage {
 Name = usbchanger1   # same as defined by 'baculasd' in vchanger config file
 Address = hostname.of.my.baculasd.system
 SDPort = 9103
 Password = "mysecretpasswort"
 Device = usb-changer-1  # name of the Autochanger resource defined in bacula-sd.conf
 Media Type = File
 Autochanger = yes;
}
[..]

Now we can start initializing the tape library by adding the tapes. For each disk run the following commands after it has been attached to the server.

chown bacula:disk /mnt/usbchanger1/magazine/
vchanger -u bacula -g disk /usr/local/etc/vchanger.conf initmag 1
bconsole << EOF
label barcodes
yes
2
quit
EOF

Now the virtual tape changer is married with Bacula and I am sure they will have a very good time together.

All other things you need to know, e.g. how to to configure Bacula to you needs, what a good backup strategy is, do apply to any other backup media as well. So I am not handling them in this howto. I hope this helped you somehow and feedback is always welcome.

Backup With Bacula And LUKS Encrypted USB Disks – Part 1

Standard

I think is is time again to share some interesting stuff with you.
A few month ago, I have set up a new backup solution with Bacula and USB disks as backup media. I am not going to argue why Bacula is our preferred backup software or why USB disks are great for backups. You will have to find it out on your own. So let’s get more into detail now.

As our company policies require all media to be encrypted, no excepetion was made for the backup media of cause. This were the requirements for the new system:

      1. Attached USB disks must be accessible by the system and backup software, without the need of manual actions by the backup operator
      2. The filesystem should be in an unmounted state when detaching the USB disk to prevent data corruption. Also, no manual actions should be needed.
      3. The disks have always to be mounted to the same location for Bacula to use them
      4. The backup should be as flexible as possible, e.g. it should not really matter if the disk was changed or not. This is really important on holidays, as I do not want to update volume attributes all the time.

    The solution for the first three requirements is a combination of LUKS encryption with a keyfile and an automounter like autofs. Encrypting with LUKS and a keyfile is really easy as you will see. To fulfill the last requirement I have chosen a Bacula configuration based on a virtual tape changer. But first we have to prepare udev with some config and scripts to make a device available for autofs.

    UDEV CONFIG & SCRIPTS

    /etc/udev/rules.d/99-unlock-lucks.rules
    This rules makes UDEV call /usr/local/bin/unlock-luks with the name of the new device and the name the decrypted device should get by the device mapper (here: bacula) as parameter.

    ACTION=="add",BUS=="usb",KERNEL=="sd?1",RUN+="/usr/local/bin/unlock-luks /dev/%k bacula"

    /usr/local/bin/unlock-luks
    This script takes care if a new device was attached to the system. If UDEV calls this script and the device mapper still sees the device, this is caused by the device mapper taking a long time before dropping a detached device from its database. In case the system still thinks the device is mounted, force an umount and close the crypto device before setting up the new crypto device. If this looks very strange to you, I can appease you, It’s working pretty well for month now. Of cause this script has to be made executable.

    (
      ISATTACHED=`dmsetup ls | grep ^bacula | wc -l`
      if [ $ISATTACHED -eq 1 ]
      then
        umount /dev/mapper/$2 --force
        cryptsetup luksClose $2
      fi
      cryptsetup --key-file=/etc/luks.key luksOpen $1 $2
    )
    

    Now that UDEV is prepared let’s create some fully encrypted USB disks:

    CREATING A KEYFILE
    First of all, we need to create a good keyfile. In 2010 a 4096 bit key should be enough. To create such a keyfile dd does a good job:

    dd if=/dev/random of=/etc/luks.key bs=1024 count=4

    ENCRYPTING THE DISK
    I suppose you only have one partition on your USB disk, so encrypt it. Usually USB disks are handled by the SCSI subsystem, so it device name starts with sd. Warning: The next step overwrites any existing data on that partition.

    cryptsetup luksFormat /dev/<sd?1> /etc/luks.key

    FORMATTING THE ENCRYPTED PARTITION
    Before you really can format the partition you should unplug the disk and reattach it to the system. If your UDEV configuration and scripts work as expected, you should see the device /dev/mapper/bacula. Finally put a filesystem onto the new device with

    mke2fs -j -T largefile -L "usbchanger1" /dev/mapper/bacula

    As you can see the filesystem also gets labled with usbchanger1. This is neccesarry for the automounter to identify the filesystem. I used the largefile flag, as each volume Bacula creates is a big file of several gigabytes.

    CONFIGURING AUTOFS
    I suppose there is nothing special about the two files for you. Just create the mountpoint /mnt/usbchanger1, modify or create the two files and restart the autofs daemon.

    /etc/auto.master

    /mnt/usbchanger1    /etc/auto.usbchanger1    --timeout=10

    /etc/auto.usbchanger1

    magazine  -fstype=auto,rw  :/dev/disk/by-label/usbchanger1

    That’s all for now. You should now be able to attach an USB disk with an encrypted filesystem on it to the system and access it through the path /mnt/usbchanger1/magazine. If nothing keeps the device open it will be unmounted after ten seconds. Now you are ready to configure Bacula. I am going to explain this in part 2 of this tutorial soon.

Windows 7 God Mode

Standard

Sorry, aber den muss ich bringen. Finde das einfach nur eine witzige Funktion und beweist das selbst bei Microsoft die Entwickler manchmal Humor haben. Den God Mode aktiviert indem man in Windows 7 einen neuen Ordner mit dem Namen “GodMode.{ED7BA470-8E54-465E-825C-99712043E01C}” erstellt. In dem Ordner findet man dann diverse Schnellzugriffe auf Einstellungen. In wie fern da jetzt Sachen bei sind die man nicht auch anders erreicht ist weiss ich nicht, aber schneller geht es so alle mal.

IMAP Server violating RFC with INTERNALDATE 2-digit year

Standard

Nice problem came up today when a customer informed us about a problem with his Tobit David.fx server. All mails arriving since the January 1st 2010 had the year changed to 2000. We just had a little debugging session what causes this and finally found out that the IMAP server returned:

[..]INTERNALDATE "05-Jan-10 13:33:52 UT"[..].

Following RFC3501 date-year must be a 4-digit field. Even in the old RFC2060 from 1996 date_year must be 4-digit field.

msg-att-static = "ENVELOPE" SP envelope / "INTERNALDATE" SP date-time \
"RFC822" [".HEADER" / ".TEXT"] SP nstring /
"RFC822.SIZE" SP number /
"BODY" ["STRUCTURE"] SP body /
"BODY" section ["<" number ">"] SP nstring /
"UID" SP uniqueid ; MUST NOT change for a message
date-time = DQUOTE date-day-fixed "-" date-month "-" date-year SP time SP zone DQUOTE
date-year = 4DIGIT

Jugenschutzueberpruefung

Standard

Schonmal jemand bei Real an den Selbstbedienungskassen eine Musik CD gekauft? Gerade mit einem Kollegen in der Pause dort gewesen und anscheinend scheint die Produktgruppe Musik CD eine manuelle Pruefung der Ware durch einen Mitarbeiter zu erfordern. Mein Kollege hat eine CD mit Weihnachtsliedern gekauft. Gut…da ist “Wham” drauf. In manchen Laendern wird das sicher auch zur Folter eingesetzt 😉

Mami, ich will dieses 1&1 Gemuese aber nicht essen!

Standard

Tja aufgrund des geschickten Schachzugs, nicht den Kundenstamm zu uebernehmen, sondern einfach die Freenet Breitband GmbH zu uebernehmen, bin ich jetzt also mit Internet und Telefon 1&1 Kunde und habe wohl auch keine Sonderkuendigungsrechte, weil ich ja eigentlich immer noch einen Vertrag mit der Freenet Breitband GmbH habe. Toll 1&1….der Provider zu dem ich nie im Leben wollte, weil die einen so beschissen schlechten Service haben (musste ich mich leider selber schon mehrfach von ueberzeugen).

Klar dass dann auch erstmal nix mehr ging als die mich umgestellt haben. Ich hatte in meinem System die Freenet DNS Server fest hinterlegt. Da die aber natuerlich keine Querys aus anderen Netzen beantworten funste DNS also nach draussen gar nicht mehr. Koennte man meinen waere ich ja selber Schuld, wenn ich die Nameserver fix eintrage. Tja hatte aber seinerzeit einen guten Grund: Als Freenet diesen Suchassistenten aktiviert hat, der eine nicht aufloesbare DNS Anfrage als Suchanfrage auf deren Portal umgeleitet hat, hats schonmal mein DNS geschossen bzw. inperformant gemacht. Die von Freenet in der Hilfe vorgeschlagene Loesung war halt die dort angegebenen DNS Server fix einzustellen. Denke mal ich werde also nicht der einzige gewesen sein mit diesem Problem. So hab mir jetzt erstmal einen pdns-recursor installiert der ueber die Root Zone aufloest. Das sollte in Zukunft sowas verhindern. Faengt ja alles hervorragend an.