#!/bin/blog

January 7, 2012

Securitygewixe reloaded

Filed under: Security, UNIX/Linux/BSD — Tags: , — martin @ 11:13 am

Die WordPress-Referrer haben mir einen alten Beitrag über OpenBSD-Security nach oben gespült, in dem Linus Torvalds in seiner unnachahmlichen Art damit zitiert wird, daß er die OpenBSD-Entwickler für Securitywixer hält. Leider muß ich ihm zwischenzeitlich zustimmen.

Mich persönlich hat OpenBSD vor 2 Jahren beim Übergang von 4.6 zu 4.7 mit einer weitreichenden Änderung an der Firewallkonfiguration abgehängt, bei der Rewrite- und Filterregeln vereinigt wurden. Theoretisch betrachtet eine Vereinfachung. Praktisch leider mit dem Haken, daß es keinen Migrationspfad gab, um Regeln Zug um Zug umzustellen, denn mit Einführung der neuen Regeltypen waren die alten Regeln nicht mehr verfügbar. Die einzige Möglichkeit war, das gewachsene Regelwerk im Blindflug komplett umzustellen.

Die OpenBSD-Community zuckte mit den Schultern und verwies auf mein Testsystem, auf dem ich die Regeln ja testen kann. Was den Blindflug bei der Inbetriebnahme nicht minderte. Schade. Seitdem verzichte ich bei Installationen, die auch ohne Kopfschmerzen mal ein oder zwei Updates überstehen sollen, auf OpenBSD und greife lieber zu Debian Linux.

November 24, 2011

Dovecot LDA behind Procmail

Filed under: UNIX/Linux/BSD — Tags: , — martin @ 12:17 pm

I have millions of archived mails in my ~/Maildir/ and wanted to change local delivery from a fairly extensive Procmail configuration to the Dovecot LDA, in order to keep the Maildir properly indexed.

In order to do this, I globally enabled LDA and Sieve in the Dovecot configuration, migrated my ~/.procmailrc into a Sieve ruleset (manually, because the converters don’t cut it) and then replaced my trusty old ~/.procmailrc with:

DEFAULT=$HOME/Maildir/
LOGFILE=$DEFAULT/procmail.log
DELIVER="/usr/lib/dovecot/deliver"
DROPPRIVS="YES"
:0 w
| $DELIVER

This way, the global default of using Procmail remains unharmed, maintaining compatibility with other users. On delivery, all messages to me are redirected into the Dovecot delivery system, including Sieve filters.

July 24, 2010

How to get rid of the plus signs in Bonnie++ output

Filed under: UNIX/Linux/BSD — Tags: — martin @ 9:58 pm

I’m confident that many of you have seen this countless times when using the popular “standard” harddisk benchmarking tool, Bonnie++:

# bonnie++ -u root -d /mnt/1
Version 1.03d       ------Sequential Output------ --Sequential Input- --Random-
                    -Per Chr- --Block-- -Rewrite- -Per Chr- --Block-- --Seeks--
Machine        Size K/sec %CP K/sec %CP K/sec %CP K/sec %CP K/sec %CP  /sec %CP
grml             8G 51447  98 129399  39 56253  16 43505  97 136526  16 985.2   1
                    ------Sequential Create------ --------Random Create--------
                    -Create-- --Read--- -Delete-- -Create-- --Read--- -Delete--
              files  /sec %CP  /sec %CP  /sec %CP  /sec %CP  /sec %CP  /sec %CP
                 16 +++++ +++ +++++ +++ +++++ +++ +++++ +++ +++++ +++ +++++ +++

The manpage explains this as follows:

If a test completes in less than 500ms then the output will be displayed as “++++”. This is because such a test result can’t be calculated accurately due to rounding errors and I would rather display no result than a wrong result.

You will most likely see this for the lower “Create” section of Bonnie++. While the tests from the upper “Input/Output” section always make an educated guess and use twice the size of RAM, the “Create” tests have no way of guessing the proper number of files. Look for the word “files” near the left: Bonnie++ always defaults to this 16 x 1024 files for testing. Indeed, munging 16000 files in less than half a second sounds like no big task for a fast system.

Bonnie++ takes an option that instructs it to use more files for the “Create” tests, e.g. -n 128 tells it to test with 128 x 1024 files. In this second run, I’ll also disable the “Input/Output” tests by setting -s0:

# bonnie++ -u root -d /mnt/1 -s 0 -n 128
Version 1.03d       ------Sequential Create------ --------Random Create--------
grml                -Create-- --Read--- -Delete-- -Create-- --Read--- -Delete--
              files  /sec %CP  /sec %CP  /sec %CP  /sec %CP  /sec %CP  /sec %CP
                128 46336  84 +++++ +++ 31277  50 32574  65 +++++ +++ 12803  23

We now get values for file creation and deletion, but reads are still excessively fast. Since Bonnie++ discarded the measurement because it finished within less than 500 ms, it may be possible to estimate that the system is capable of performing at least (128 x 1024 x 2 = 262144) read operations per second.

Further increasing the number may not be possible due to lack of inodes on your filesystem. Also, such an extremely high number of files and file operations may decrease overall file system performance.

The system used for testing was a dual AMD Opteron 285 with a hardware RAID 0 of 3 UW320 disks @ 15k RPM.

December 11, 2004

SSH um die Ecke(n) bringen

Filed under: Notizen, Sicherheit, UNIX/Linux/BSD — martin @ 11:41 am

Die Ausgangslage

Auf einer bestimmten Baustelle muß ich, wenn ich an meine Mails kommen will, über zwei DMZ-Gateways (eins von der Baustelle und unser eigenes) sowie unseren im Rechenzentrum stehenden Webserver gehen, um schließlich auf dem Server im Büro zu landen. Als ich noch mit dem textbasierten Mutt gearbeitet habe, war das eine ganz einfache Sache, denn ich konnte mich immer der Nase nach per SSH über ein System nach dem anderen durchhangeln und dann auf der Kommandozeile des Zielsystems mutt starten:

martin@workstation:~$ cat bin/bring-mich-office.sh
#!/bin/sh
ssh -A -t dmzbox.baustelle.invalid \
 ssh -A -t webbox.example.com \
 ssh -A -t dmzbox.example.com \
 ssh officebox.example.com
martin@workstation:~$ bin/bring-mich-office.sh
martin@officebox:~$ mutt -y

Die Frickelvariante

Seit ich unter die Mausschubser gegangen bin, gestaltet sich das ganze deutlich schwieriger, denn über diese ganze Kette müssen jetzt die Ports 143 und 25 für IMAP und SMTP getunnelt werden. Dies soll geschehen, ohne daß diese Ports auf den in der Mitte der Kette befindlichen Systemen ansprechbar sind. Wenn auf den Zwischenstationen jedermann auf die weitergeleiteten Ports zugreifen könnte, hätte ich riesige unerwünschte Löcher in Firewalls gebohrt, und das will sicherlich niemand.

Um diesen Tunnel vollautomatisch aufbauen zu können, habe ich mich dann eine ganze Weile mit einer wüsten Konstruktion herumgeschlagen, bei der zunächst über alle beteiligten Funkhäuser ein “verlegter” SSH-Port durchgetunnelt wurde. In einer zweiten SSH-Sitzung habe ich über diesen dann meine beiden Applikationsports getunnelt:

#!/bin/sh
# Erste Verbindung
ssh -A -L 10022:localhost:10022 dmzbox.baustelle.invalid \
 ssh -A -L 10022:localhost:10022 webbox.examle.com \
 ssh -A -L 10022:localhost:10022 dmzbox.example.com \
 ssh -L 10022:localhost:22 officebox.example.com sleep 20 &
# Gedenkpause
sleep 10
# Zweite Verbindung
ssh -t -C -p 10022 -L 10025:localhost:25 -L 10143:localhost:143 127.0.0.1

Ich denke, ich muß nicht näher erläutern, warum das nicht nur furchtbar aussieht, sondern auch ganz schön bescheiden funktioniert hat. Bei fünf ineinandergestöpselten Port-Weiterleitungen ist die Wahrscheinlichkeit, daß alles klappt, wirklich nicht besonders hoch.
(more…)

October 14, 2003

In-place editing, ein für alle mal.

Filed under: Internet, Notizen, perl, UNIX/Linux/BSD — Tags: — martin @ 6:17 pm

So bearbeitet man mit Perl als sed-Ersatz Dateien und läßt dabei ein Backup zurück:

perl -i.bak -pe 's/lull/lall/g' file1 file2 file3 ... fileN

Die genannten Dateien werden so geändert, und die alte Version bleibt mit der Extension .bak jeweils zurück.

Theme: Shocking Blue Green. Blog at WordPress.com.

Follow

Get every new post delivered to your Inbox.