Articles in the Digital Life category

Verzeichnisse nur über SSL erreichbar machen - und das benutzerfreundlich!

Die Anforderung:
Ein Verzeichnis auf einem Apache-Webserver (genauer das Admin-Frontend von Django) sollte nur via SSL erreichbar sein. Wenn jemand via HTTP auf (schützenswerte) Unterverzeichnisse zugreift, dann soll er "passend" umgleitet werden. Letztendlich kommt noch dazu, dass dieser Location-Container mit vielen anderen Einstellungen per Include-Anweisung in 2 virtuelle Hosts (HTTP und HTTPS) geladen wird. Für einige ist es OK, dass sie sowohl per HTTP als auch HTTPS ausgeliefert werden, für andere eben nicht. Da neben Django noch mehrere Tools auf diesem Web-Server laufen, gibt's dafür einen extra Location-Container:


SetHandler python-program
PythonHandler django.core.handlers.modpython
PythonPath "['/PFAD/ZUM/PROJECT/'] + sys.path"
PythonAutoReload On
SetEnv DJANGO_SETTINGS_MODULE PROJEKT.settings

Lösung 1:
Im Modul mod_ssl gibt es die Direktive SSLRequireSSL On, mit der man sicherstellen kann, dass es eben nur via SSL ausgeliefert wird.
Nachteil: Kommt ein Benutzer via HTTP bekommt er nur "Du kummst hier net rein!". Effektiv, aber nicht wirklich schön.


SetHandler python-program
PythonHandler django.core.handlers.modpython
PythonPath "['/PFAD/ZUM/PROJECT/'] + sys.path"
PythonAutoReload On
SetEnv DJANGO_SETTINGS_MODULE PROJEKT.settings

SSLRequireSSL On

Lösung 2:
Mit Hilfe von mod_rewrite bzw. dessen Direktiven RewriteCond und RewriteRule wird getestet, ob die Anfrage per HTTP kam und wenn ja an die selbe URL nur mit HTTPS weitergeleitet:


SetHandler python-program
PythonHandler django.core.handlers.modpython
PythonPath "['/PFAD/ZUM/PROJECT/'] + sys.path"
PythonAutoReload On
SetEnv DJANGO_SETTINGS_MODULE PROJEKT.settings

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule .* https://%{HTTP_HOST}/%{REQUEST_URI}

Et voilà! ;-)

Seitdem ich bei dieser Firma bin...

"... habe ich auch schon mitbekommen, dass Du in Bezug auf Nahrung ein schwarzes Loch bist"

Danke, Herr Kollege ;-)

Links ohne Ende...

... gibt's ja bei der LUSC im Chat - meistens auch von einer Person. Allerdings muss ich mal ausnahmsweise sagen, dass ich das Filmchen (gut in dem Fall geht's wirklich mehr um den Ton) gleich mehrfach hintereinander hab laufen lassen.

Fluch der Karibik - auf der Gitarre

PS: Nein, ich werde jetzt nicht anfangen, jeden Link hier zu veroeffentlichen ;-)

Extend host search in Nagios navigation frame

Just a small patch to add

Step by Step:

* Download my small patch file ["Nagios_Nav_Autocomplete.diff" (from source, no custom paths)](/static/Nagios_Nav_Autocomplete.diff) or ["Nagios_Nav_Autocomplete.Debian.diff" (for Debian packages)](/static/Nagios_Nav_Autocomplete.Debian.diff)

* `cd` to `/usr/local/nagios/share/` for self compiled Nagios or `/usr/share/nagios3/htdocs/` (Debian)

* If `patch --dry-run </path/to/download/Nagios_Nav_Autocomplete.diff` gives you no error try without "`\--dry-run`"

* If PNP is **not** in `/nagios/pnp/` (URL!) change `side.html`'s paths to PNP in lines 24, 25 and 212.

* Reload left frame of Nagios

* Enter at least 3 characters

* Be happy ;-)

If it doesn't work:

* Check if you **reloaded** the left frame and your browser knows the patched `side.html`

* Make sure there are no 404 (file not found) errors in your Apache logfiles (correct paths to PNP)

Shortcuts in Firefox einrichten

Auf Nachfrage ein kleines Mini-HowTo:

Ein paar Bilder, wie man Shortcuts mit Firefox einrichtet gibt's unter http://velt.de/gallery/v/Diverses/Screenshots/Firefox_Shortcuts/[

Eine ausfuehrliche Beschreibung folgt noch... hust ;)

check_netappfiler.py - Nagios-Plugin for FAS systems by NetApp

Some people asked me at NETWAYS Nagios Konferenz if my check_netappfiler plugin is dead.

No, it's not!

With ONTAP 7.3 NetApp added support for SNMP v2c and v3! W00t!

Get the plugin (and some minimal documenation - you have been warned! ;) on http://people.teamix.net/~svelt/check_netappfiler/!

And PLEASE send me feedback (yes, "it's wonderful!" IS feedback ;) if you're using it!

Rsync mit restricted SSH-Keys

Rsync wird ja gerne im Zusammenspiel mit SSH verwendet, um Daten zu syncen bzw. Backups zu machen. Mehr als nur "häufig" habe ich dabei bisher gesehen, dass dies mit SSH-Keys ohne Passphrase eingerichtet wurde. Soweit nichts schlimmes dabei. Wenn dann allerdings die SSH-Verbindung auf "root" geht und der Key nicht in seiner Funktionalität eingeschränkt wird, wird's unschön. Deswegen hier eine kleine (undokumentierte) Step-by-Step-Anleitung zum Einrichten von Rsync-über-SSH mit kastriertem Key.


0. Ausschalten des SSH-Agents
MASTER:

svelt@MASTER:~ % unset SSH_AGENT_PID
svelt@MASTER:~ % unset SSH_AUTH_SOCK

1. Erzeugen des neuen Keys
MASTER:

svelt@MASTER:~ % ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/home/svelt/.ssh/id_rsa): /home/svelt/.ssh/rsync_rsa
Enter passphrase (empty for no passphrase): ENTER
Enter same passphrase again: ENTER
Your identification has been saved in /home/svelt/.ssh/rsync_rsa.
Your public key has been saved in /home/svelt/.ssh/rsync_rsa.pub.
The key fingerprint is:
49:25:af:f7:16:a4:eb:b7:5b:66:07:37:7c:85:0c:84 svelt@MASTER

2. Kopieren des Keys auf den Server
MASTER:

svelt@MASTER:~ % ssh-copy-id -i .ssh/rsync_rsa svelt@BACKUP.DOMAIN.de
0
Password: PASSWORT
Now try logging into the machine, with "ssh 'svelt@BACKUP.DOMAIN.de'", and check in:

.ssh/authorized_keys

to make sure we haven't added extra keys that you weren't expecting.

3. Initialer rsync mit dem Key
MASTER:

svelt@MASTER:~ % rsync -avv -e 'ssh -i /home/svelt/.ssh/rsync_rsa' Doku svelt@BACKUP.DOMAIN.de:tmp/
opening connection using ssh -i /home/svelt/.ssh/rsync_rsa -l svelt BACKUP.DOMAIN.de rsync --server -vvlogDtpr . tmp/
building file list ...
16 files to consider
delta-transmission enabled
Doku/
[...]
total: matches=0 hash_hits=0 false_alarms=0 data=1977241

sent 1978440 bytes received 324 bytes 1319176.00 bytes/sec
total size is 1977241 speedup is 1.00

4. Setzen des "command" in der authorized_keys
BACKUP:

svelt@BACKUP:~ % cat .ssh/authorized_keys
ssh-rsa AAAA...T7XQ== svelt@MASTER

svelt@BACKUP:~ % vi .ssh/authorized_keys

4a. Aus obigem rsync-Aufruf ableiten

Vorher: % rsync -avv -e 'ssh -i /home/svelt/.ssh/rsync_rsa' Doku svelt@BACKUP.DOMAIN.de:tmp/
Nachher: % rsync -a -e 'ssh -i /home/svelt/.ssh/rsync_rsa' Doku svelt@BACKUP.DOMAIN.de:tmp/

4b. Genau wissen wollen
BACKUP:

svelt@BACKUP:~ % cat .ssh/authorized_keys
command="set | grep SSH >/tmp/XXX" ssh-rsa AAAA...T7XQ== svelt@MASTER

MASTER:

svelt@MASTER:~ % rsync -a --delete -e 'ssh -i /home/svelt/.ssh/rsync_rsa' Doku svelt@BACKUP.DOMAIN.de:tmp/
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: error in rsync protocol data stream (code 12) at io.c(453) [sender=2.6.9]

BACKUP:

svelt@BACKUP:~ % cat /tmp/XXX
BASH_EXECUTION_STRING='set | grep SSH >/tmp/XXX'
SSH_CLIENT='194.150.191.251 35877 22'
SSH_CONNECTION='194.150.191.251 35877 194.150.191.2 22'
SSH_ORIGINAL_COMMAND='rsync --server -logDtpr --delete . tmp/'

=> siehe SSH_ORIGINAL_COMMAND

5. authorized_keys setzen
BACKUP:

svelt@BACKUP:~ % cat .ssh/authorized_keys
command="rsync --server -logDtpr --delete . tmp/" ssh-rsa AAAA...T7XQ== svelt@MASTER

6. Testen
MASTER:

svelt@MASTER:~ % rsync -a --delete -e 'ssh -i /home/svelt/.ssh/rsync_rsa' Doku svelt@BACKUP.DOMAIN.de:tmp/
svelt@MASTER:~ % echo $?
0

MASTER:

svelt@MASTER:~ % touch Doku/FIXME
svelt@MASTER:~ % rsync -avv --delete -e 'ssh -i /home/svelt/.ssh/rsync_rsa' Doku svelt@BACKUP.DOMAIN.de:tmp/
opening connection using ssh -i /home/svelt/.ssh/rsync_rsa -l svelt BACKUP.DOMAIN.de rsync --server -vvlogDtpr --delete . tmp/
building file list ...
done
Doku/
Doku/FIXME
total: matches=0 hash_hits=0 false_alarms=0 data=0

sent 439 bytes received 48 bytes 324.67 bytes/sec
total size is 1977241 speedup is 4060.04

Again and Again: Fixing SuSE 10.3

Die QA bei SuSE hat mal wieder versagt - und ich wundere mich, warum ich Courier-IMAP mit SSL (und den POP3-SSL) nicht ans laufen bekomme.

Könnte man Scripten, die man einbindet (automatisches Erzeugen von Zertifikaten, wenn noch keines existiert) nicht einfach mal testen? Angefangen von den Pfaden zu openssl, über den Pfade zu den PEM-Files kann da eigentlich gar nix klappen.

Anbei ein kleines Shell-Snippet, welches per sed die entscheidenden Stellen wieder geradezieht.

(M)Eine Konfigurationsdateien für Mutt

Ich wurde ja schon häufiger darauf angesprochen, wie ich denn eigentlich meine Mails lese bzw. wie ich mutt konfiguriert habe.

Allgemein vorausgeschickt sei, dass alle Dateien bei mir im Homeverzeichnis unter ~/.mutt/ liegen. Dazu gibt es dort ein _var-Verzeichnis, um dort Dateien abzulegen, die ich nicht im VCS haben will.

Als erstes die allgemein Config, die auch gelesen wird, wenn ich mutt mal anders (z.B. um mit mutt -f archiv.mbox ein MBox-File zu lesen) aufrufe:
Download muttrc

ignore * unignore from: subject to cc message-id mail-followup-to date user-agent x- newsgroup

alternates -group GRUPPE1 REGEXP-FUER@ABSENDER.1DE

subscribe -group LISTE LISTE@ADRES.SE

source "~/.mutt/alias"

set alias_file="~/.mutt/alias"
set autoedit=no
set attribution="%n wrote:"
set charset="locale | grep -qi utf-8 && echo utf-8 || echo iso-8859-15"
set certificate_file="~/.mutt/_var/certificates"
set edit_headers=yes
set editor="vim +/^$"
set envelope_from=yes
set fast_reply=yes
set header=yes
set header_cache="~/.mutt/_var/headercache/"
set honor_followup_to=yes
set include=yes
set index_format="%4C|%Z|%2N|%[%y%m%d-%H%M]|%-20.20L|%?l?%4l&%4c?|%s"
set maildir_mtime=yes
set mark_old=no
set mask=""
set move=no
set pager_context=1
set pager_index_lines=9
set postpone=ask-no
set postponed="~/.mutt/_var/postponed"
set print_command="/usr/bin/xpp"
set realname="ECHTER NAME"
set rfc2047_parameters=yes
set save_history=100
set history_file="~/.mutt/_var/history"
set signature="~/.signature"
set sort=date
set sort=reverse-score
set use_8bitmime
set use_from=yes

my_hdr X-Operating-System: uname -a|sed "s/\#/\\\#/"

score ~F 10
score ~O 20
score ~N 50

color header brightgreen default ^From:
color header brightcyan default ^To:
color header brightcyan default ^Reply-To:
color header brightcyan default ^Cc:
color header brightwhite default ^Subject:
color header brightred default ^Delivered-To:
color header brightyellow default ^Newsgroups:

color index brightyellow default ~N
color index yellow default ~O
color index magenta default ~D
color index brightwhite magenta ~F
color index black white ~T

folder-hook . set sort=threads

folder-hook "INBOX|Unsure" set sort=date
folder-hook "INBOX|Unsure" set sort=reverse-score

macro compose 1 "ECHTER NAME \n"
macro compose 2 "ECHTER NAME \n"

vim: ft=muttrc

Für IMAP(S)-Server allgemein habe ich auch eine Config angelegt, da ich auf mehr als nur einen IMAP(S)-Server zugreife:
Download common.imap

set folder_format="%2C|%t%5N|%f%> |%d"
set imap_check_subscribed=yes
set imap_idle=yes
set imap_keepalive=30
set imap_list_subscribed=yes
set maildir_mtime=no
set record="=INBOX.Sent/"

vim: ft=muttrc

Natürlich will man sich nicht alle E-Mail-Adressen merken, deswegen gibts alias

alias kurzname Vornamen Nachname

Und last but not least die Config-Datei, mit der ich mutt normalerweise aufrufe ( mutt -F ~/.mutt/server1 bzw. ein alias in der Shell darauf). Wie schon gesagt, da ich auf mehrere Mail-/IMAPS-Server zugreife, gibt's diese Datei unter mehreren Namen bei mir.
Download server1

source "~/.mutt/muttrc"
source "~/.mutt/common.imap"

set folder="imaps://USERNAME@IMAPS.SERVER/"
set from="ABSENDER1@ADRES.SE"
set record="=INBOX.Sent/"
set signature="~/.signature"
set smtp_url="smtps://USERNAME@IMAPS.SERVER/"
set spoolfile="=INBOX.IN"

set pgp_sign_as="GPG_ID_HERE"

send-hook . 'set from="ABSENDER2@ADRES.SE"'
reply-hook .
'set from="ABSENDER2@ADRES.SE"'

send-hook '~C LISTE@DOMAIN.DD' 'set from="ABSENDER3@ADRES.SE"'
reply-hook '~C LISTE@DOMAIN.DD' 'set from="ABSENDER3@ADRES.SE"'

vim: ft=muttrc

Friedls Schnitzel...

(updated )
by Sven Velt

Weil ich schon mehrfach gefragt wurde:

* Der Bericht über das [Weltrekord-Schnitzel](http://youtube.com/watch?v=G-5IsZLKoz4)

* Die Adresse:

3 Linden
Bahnhofstr. 13
90537 Feucht
Tel.: 09128 - 15959

SambaXP 2008 Conference - Day 1

* **Schlomo Schapiro - The Simple High Available Linux File Server**


  * Real hardware as primary server, "virtual cold stand-by server"

  * Local storage and SAN

  * GPT for Partitions bigger than 2TB

  * Nice implementation of cold stand-by cluser




* **Oliver Tennert - Parallel NFS**


  * HPC: More and more data

  * More nodes, more nodes, more throuput

  * Not a good solution: Cluster NFS

  * Distributed File Systems: IBM's GPFS, SGI's CXFS, PanFS, PVFS2, ...

  * NFSv4 includes everything a network file system needs (NFSv3 does NOT)

  * pNFS optional part of NFS 4.1

  * Separtion of metadata path/server and data path/server

  * SAP (Storage Access Protocoll) not specified, incompatible clients get data from metadata server

  * Current state: "should work", many layouts on the way




* **Steve French: From DFS to Kerberos: Update on Linux CIFS client**


  * Kerberos support on way into the kernel

  * Apple symlinks over CIFS are the 4th way to do it

  * Setting up all stuff needed and/or supported by NFSv4 is a pain in ...




* **Jelmer Vernooij, Andrew Bartlett: Samba 4, where are we now?**


  * Samba 4 Alpha 3 released 2 weeks ago, announcement mail gets eaten...

  * More than TechPreview, basic features completed, useable for SOME environments, needs more testers

  * No more EJS, Python rulZ! ;-) And GNU Make

  * Much work done in LDB subsystem/internal database: Subtree rename, sort of grouo policy, (some) schema validation

  * Autoconfiguration of backend (OpenLDAP)

  * SWAT disabled due to JS->Python, SoC project

  * MMC works and some group policy

  * Beta at end of THIS year! AD DC, file search, AD Member

  * What would stop YOU using Samba 4?




* **Andrew Bartlett: The little shop of horrors: AD's notation of LDAP**


  * AD "based on" LDAP, an IETF standard protocol to access a standard X.509 directory

  * AD's schema is different: AD CN is not LDAP CN (multi values), AD top hast 75 new elements, ...

  * No DNS and NTP in Samba 4 but ideas how it could/should work




* **Volker Lendecke: Samba 3.2 Infrastructure changes**


  * Un-/Marshalling code moved to PIDL

  * One overall cache for nearly everything

  * 3.2 is slower than 3.0 (much more malloc())

  * Solution: remove malloc() calls, use talloc_*() instead




* **Jelmer Vernooij: RPC scripting using Python**


  * Samba 3.0 had already Python bindings

  * Switch now to stop people from coding EJS (may be removed later)

  * More potential developer with Python

  * PIDL generates Python bindings

  * Python/SoC: smbclient, SWAT, Samba-GTK

  * At the moment use "smbpython"

  * python-ldb/python-tdb already in Debian/Ubuntu

  * Jelmer: "Next version of Perl has unicode operators..."

  * Tridge: "I have a purpose in life! Telling people how to resize fonts in xterms!"

SambaXP 2008 Conference - Day 0

OK, here I am at Göttingen. Just waiting for the first talks.

I'll try to report continuously so check back later.

*

Welcome notes and Key note

  * John Terpstra talking about Samba history: "We become fat, dump ... and happy. It's a little bit like life, isnt it?"

  * John Terpstra: "When will Samba 4 be released, Andrew?" - Andrew Bartlet: "End of the year!" - Masses: "Which year?"

  * Volker Lendecke asked Dirk Hohndel "Please plug in the beamer cable!" - "No, turn off the beamer! I have no slides! This here (pointing to his laptop) is only for monitoring the stock exchange when market opens..."

  * Dirk Hohndel: "80% of open source projects have 1-3 developers... and 1-3 users..."

  * Dirk Hohndel about licenses: "What are 10 lawyers at bottom of sea?... Yes, you're right: a good start!"




*

Tridge - Samba and the PFIF
Title changed to "Samba and Microsoft"

  * Good cooperation with M$ in 1990's, bad/less cooperation starting in about 1999

  * M$ does more than they have to (releases documentation publicly! Open cooperation)

  * PFIF (Protocol Freedom Information Foundation) makes documentation (incl. updates for at least 5 years) availably under NDA - but GPL compatible

  * "5 years is a long time. Maybe Google bought M$ by this time... who knows?"

  * M$ has to cope with Samba bugs - in appliances and embedded devices

  * Now: technical cooperation, lawyers are now sidelined. Both sides participating in numberous events

  * Skill set required which is needed to develop Samba has changed. Documentation of the protocoll is available now!

  * ... but it takes at big bunch of time to implement all the information




*

Wolfgang Grieskamp (M$) - Model-Based Quality Assurance of the SMB2 Protocol Document
I saw some of the slides before the talk... OMG! What will happen to the people in here? This will be a REAL Power Point Picture Show :o(
Yes, the slides are a kind of... "marketing" but the information he gives seem to be really good!

  * 250 protocols, about 30k pages of documentation

  * Writing documentation, vendor developing model and test suite (no internal knowledge). Usability of documentation proven.

  * SMB2: 300 pages documentation, 3000 requirements for the test suite

  * No deadlines! There's something to fix? Fix it! Don't release!

Looks like M$ is interessted in producing high quality documentation for their protocols!

*

Julien Kerihuel - When OpenChange assimilates the Borg

  * OpenChange: OSS implementation of the Exchange server and protocols. Interoperability and documentation. Build upon Samba4 infrastructure

  * libmapi as client side library ("Outlook replacement")

  * OpenChange server implements MAPI/NSPI providers but no message storage yet

  * As a client nearly everthing (most common) works with Exchange 2007(?)

  * Main focus on providing libraries, helping other projects with libmapi (Evolution-Plugin, KDE4)

  * No Thunderbird (at the moment!), Google SoC: fetchmail, Akondai

  * Libmapi API fully documented! And more documentation!

  * Libmapiadmin for administrating user on Exchange server

  * MOCABOX as application box, integration with other OSS

  * Now: more time to code on OpenChange server

Who watches the watchman - err... Nagios? Part II

As many people only read my RSS content feed (but not the comment feed) I decieded to repeat this script here as new content ;-)

The previous solution has some drawbacks (only one check, so sometimes you get false negatives). So here we go:

!/bin/sh

CMD="/usr/lib/nagios/plugins/check_nagios -F /var/cache/nagios3/status.dat -e 1 -C nagios3"
EMAIL=foobar@...spambox.com

OUTCHECK=$CMD

if [ $? -ne 0 ]
then
sleep 300
OUTCHECK=$CMD
if [ $? -ne 0 ]
then
OUTPROC=ps ax | grep "/usr/sbin/nagios3" | grep -v grep
if [ $? -eq 0 ]
then
(
echo -e "Output of check_nagios_check:\n| $OUTCHECK\n\n"
echo -e "Output of ps:\n| $OUTPROC"
) | /usr/bin/mail -s "[NAGIOS] Log file stale, but process found" $EMAIL
else
(
echo -e "Output of check_nagios_check:\n| $OUTCHECK\n\n"
echo "NO output of ps, Nagios process is NOT running"
) | /usr/bin/mail -s "[NAGIOS] Log file stale, NO process found" $EMAIL
fi
fi
fi

exit 0

Same script (hope so...) in german/Script mit deutschen Ausgaben

Kommentare - in Python, Perl und Ruby

Durch einen Artikel im aktuellen Linux-Magazin (04/2008) bin ich auf das Portal Ohloh aufmerksam geworden. Das schöne an diesem Portal ist, dass sie die eingestellten Software-Projekte analysieren. Je Sprache kann man sich diverse Statistiken ansehen. Besonders lachen musste ich über die Anzahl der Kommentare in den 3 angesprochenen Sprachen:

* [Python](http://www.ohloh.net/languages/9): 11,8%

* [PERL](http://www.ohloh.net/languages/8): 20,9%

* [Ruby](http://www.ohloh.net/languages/12): 20,8%

Fangen wir mal mit meiner Interpretation bei PERL an:

Der Code ist klein (durch die schon angesprochenen Sonderzeichen...), dafür muss der Code einigermaßen ausführlich kommentiert werden, damit selbst der Programmierer nach 14 Tagen noch weiss, was er denn da angestellt hat.

Bei Python wird die Kommentierung am Anfang der Methode/Funktion vorgenommen, was das Ding gesamt macht. Eine Kommentierung des Codes ist nur an besonderen Stellen notwendig, da der Code für sich selbst spricht, man kann ihn sofort sinnentnehmend lesen. (Oder wie man es auch ausdrücken könnte: "Du musst Deinen Code kommentieren, damit jemand anders weiß, was Du da tust? Dann verwende die Zeit besser darauf, Deinen Code ordentlich zu schreiben!")

Die Interpretation für Ruby spare ich mir hier mal, sonst gibbet noch mehr Haue ;-)

Weitere Zahlen: C/C++: 20,0%, PHP: 27,9% - passt auch irgendwie ;->

Vim Syntax-Highlighting für Nagios

Zwar nicht ganz auf dem aktuellen Stand, aber trotzdem durchaus ganz hilfreich:

http://dev.gentoo.org/~ramereth/vim/syntax/nagios.vim oder die lokale Kopie.

« 1 2 3 4 5 6 7 8 9 »