#!/bin/blog

October 31, 2008

Bring on the goodies!

Filed under: UNIX & Linux — Tags: , , , — martin @ 8:49 pm

Ubuntu 8.10 – At last. ;-)
OpenBSD 4.4 – Early. :-)

OpenBSD 4.4 finally has support for my Huawei E220 UMTS/G3 modem (a.k.a. “T-Mobile Web & Walk Box Micro”) in the default installation. Granted, that’s at least one year late. Nevertheless, I have already used the E220 with an OpenBSD snapshot release, several months ago. The really good thing is that the OpenBSD implementation of the Huawei E220 serial interface runs circles around the shady E220 hack that is still required to get the thing up and running on Linux. :-)

October 29, 2008

Today’s agenda: “Extrapolate” statistics

Filed under: Egoblogging — martin @ 6:48 am

It’s the same everywhere.

They comply with their business processes, fanatically.

They adhere to their service level agreements, strongly.

True professionals.

Then there comes a day when they FAIL.

And this is when they ask you to forge their fscking numbers. Fast.

That day is today. ;-)

October 26, 2008

Old habits die hard

Filed under: Insanity Online — Tags: , — martin @ 7:27 pm

October 24, 2008

Gleich und gleich gesellt sich gern

Filed under: Egoblogging — martin @ 2:54 pm

Ich: “In diesem Laden hier gibt es derart viele blöde Wixer, daß man Angst haben muß, allein durch ihre Gesellschaft selbst zum blöden Wixer zu werden.”
Der G.: “Ja, aber da brauchst Du keine Angst haben.”
Ich: “Danke!”
Der G.: “Du warst nämlich schon immer ‘n blöder Wixer!”

Retrospektive: Kentucky Fried Movie

Filed under: Movies, fun — Tags: , , — martin @ 6:34 am

Aus gegebenem Anlaß: Catholic High School Girls in Trouble, Rex Cramer – Danger Seeker

“Show me UR nuts!”

October 23, 2008

Privatleute raus aus dem Internet!

Filed under: Paranoia — Tags: — martin @ 9:48 pm

Ich hab’s schon länger befürchtet – so in etwa seit es damit losging, daß es sich bei privaten Homepages um impressumpflichtige “geschäftsmäßige Dienste” handeln soll: Es gibt Kräfte in unserem Land, die daran arbeiten, private Inhalte aus dem Internet zu verbannen oder zumindest so weit zu regulieren, daß es sich niemand mehr leisten kann, unkontrolliert Informationen für die Öffentlichkeit ins Netz zu stellen.

Die sogenannte “Pflichtablieferungsverordnung” (siehe Heise von heute), praktisch unbemerkt mal eben eingeführt (oh Gott, wie ich dieses reaktive Bloggen hasse), ist der vielleicht wichtigste Hebel dafür: Entweder Du nimmst aktiv an einer staatlich gesteuerten Zwangsarchivierung der von Dir veröffentlichten Inhalte (Webseiten incl. Archive von Mailinglisten!) teil, oder Du gibst Dich der Rechtsunsicherheit hin (wer weiß denn schon, was eine “private Website” ist) und kannst jederzeit wegen Begehung einer Ordnungswidrigkeit rechts rausgewunken und mit 10.000 Euro Bußgeld zur Kasse gebeten werden.

Ich bin froh, daß wir hier in der Bundesrepublik Deutschland den Generationen vor uns moralisch so weit überlegen sind, daß solche Regelungen niemals außer Kontrolle geraten und willkürlich gegen das Volk verwendet werden können. Das darf man getrost für ausgeschlossen halten. Wir sind hier schließlich weder bei Adolf noch bei Erich.

Meine Vermutung ist, daß wir eine große Zeit von Overlaynetzen (im Sinne von z.B. Tor oder I2P) und geschlossenen Benutzergruppen (vielleicht im Sinne der Mailboxen der frühen 1990er Jahre) vor uns haben. Willkommen im Zeitalter der offenen, grenz- und völkerüberschreitenden Kommunikation!

October 20, 2008

OpenSSH: Going flexible with forced commands

Filed under: Security, UNIX & Linux — Tags: , — martin @ 9:32 am

As we all know, it is possible to use SSH not only for obtaining an interactive login session on a remote machine, but also for executing commands remotely. For instance, the following command will log on to myserver.example.com, execute “uname -a” and return to the local shell:

ssh myserver.example.com uname -a

(The local SSH client returns the exit code from the remote command, if you’re into this kind of detail.)

You might have some users (or scheduled automatisms) that you don’t want to be able to log on to that machine at all, but who should be permitted to execute only a given command. In order to achieve this, you can configure key-based authentication. Once this has been done, the key can be prefixed with a number of configuration options. Using one of these options, it is possible to enforce execution of a given command when this key is used for authentication.

In this example from ~/.ssh/authorized_keys, the user wants to look at the process list, so we set the command to “ps -ef”.

command="/bin/ps -ef"

Using this, when the user tries to log in, or tries to execute an arbitrary command, “/bin/ps -ef” is executed instead and the SSH session terminates.

In addition to enforcing a command, it is advisable to disable a number of advanced SSH features, such as TCP and X11 forwarding. Assignment of a pseudo terminal to the user’s SSH session may also be suppressed, by adding a number of additional configuration options next to the forced command:

no-port-forwarding,no-X11-forwarding,no-pty

Here’s what a full entry from ~/.ssh/authorized_keys might look like:

command="/bin/ps -ef",no-port-forwarding,no-X11-forwarding,no-pty ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAp0KMipajKK468mfihpZHqmrMk8w+PmzTnJrZUFYZZNmLkRk+icn+m71DdEHmza2cSf9WdiK7TGibGjZTE/Ez0IEhYRj5RM3dKkfYqitKTKlxVhXNda7az6VqAJ/jtaBXAMTjHeD82xlFoghLZOMkScTdWmu47FyVkv/IM1GjgX/I8s4307ds1M+sICyDUmgxUQyNF3UnAduPn1m8ux3V8/xAqPF+bRuFlB0fbiAEsSu4+AkvfX7ggriBONBR6eFexOvRTBWtriHsCybvd6tOpJHN8JYZLxCRYHOGX+sY+YGE4iIePKVf2H54kS5UlpC/fnWgaHbmu/XsGYjYrAFnVw== Test key

This is quite nice: We have successfully limited this user to requesting a process list.

This is called an SSH forced command.

So much for the introduction. :-D

Here’s what I’m really getting at today – What, if we want the user to not only execute a single command, but a number of commands, such as:

- Show process list (ps)
- Show virtual memory statistics (vmstat)
- Stop and start the print server (/etc/init.d/cupsys stop/start)

Following the approach described above, this would give us four key pairs, four entries in ~/.ssh/authorized_keys, and four entirely different invocations of SSH on the client side, each of them using a dedicated private key. In other words: An administrative nightmare.

This is where the environment variable $SSH_ORIGINAL_COMMAND comes in. (This nice facility was pointed out to me last week by G., who had read about it somewhere but wondered what it might be useful for.)

Until now, all we know is that with a forced command in place, the SSH server ignores the command requested by the user. This is not entirely true, though. The SSH server does in fact remember the command that was requested, stores it in $SSH_ORIGINAL_COMMAND and thus makes it available within the environment of the forced command.

With this in mind, it is possible to allow more flexibility inside forced commands, without the need to go crazy with countless key pairs. Instead, it is possible to just create a wrapper script that is called as the forced command from within ~/.ssh/authorized_keys and decides what to do, based on the content of $SSH_ORIGINAL_COMMAND:

#!/bin/sh
# Script: /usr/local/bin/wrapper.sh 

case "$SSH_ORIGINAL_COMMAND" in
	"ps")
		ps -ef
		;;
	"vmstat")
		vmstat 1 100
		;;
	"cups stop")
		/etc/init.d/cupsys stop
		;;
	"cups start")
		/etc/init.d/cupsys start
		;;
	*)
		echo "Sorry. Only these commands are available to you:"
		echo "ps, vmstat, cupsys stop, cupsys start"
		exit 1
		;;
esac

It is important to be aware of potential security issues here, such as the user escaping to a shell prompt from within one of the listed commands. Setting the “no-pty” option already makes this kind of attack somewhat difficult. In addition, some programs, such as “top”, for example, have special options to run them in a “secure” read-only mode. It is advisable to closely examine all programs that are called as SSH forced commands for well-meant “backdoors” and to find out about securing them.

It’s up to you to decide based on your own situation, whether you want to run this wrapper as the root user or if you prefer to use password-less “sudo” commands to raise privileges where needed.

If you encounter problems while debugging $SSH_ORIGINAL_COMMAND, please make absolutely sure that you are authenticating with the correct key. I found it helpful to unset SSH_AUTH_SOCK in the window where I do my testing, in order to prevent intervention from identies stored in the SSH agent.

October 16, 2008

Rechtspopulist

Filed under: Politics — martin @ 10:08 am

Ein Rechtspopulist internationalen Ranges fährt sich in seiner Luxuslimousine tot.

Mit 150 beim Überholen auf der Landstraße.

Mit 1,8 Promille im Blut.

Es würde mich nicht wundern, wenn sie uns derzeit verschweigen, daß auf dem Beifahrersitz auch noch ein minderjähriger Transvestit ums Leben gekommen ist.

October 11, 2008

Soso, “De-Mail”

Filed under: Paranoia — martin @ 8:14 am

Die Bundesregierung plant also, den E-Mail-Verkehr in gewissen Bereichen staatlicher Kontrolle zu unterwerfen.

Schön und gut. Und nicht weiter verwunderlich. Aber was soll denn dieser Quatsch:

Das Format einer De-Mail-Adresse beinhaltet die Attribute “Vorname.Nachname[.Nummer]@Diensteanbieter.zertIT.de”, also beispielsweise “Markus.Meier2@web.zertIT.de”.

Sowas uninspiriertes habe ich wirklich noch nie gelesen. Sogar meine Kindergartenkinder haben doch schon eine staatliche Personenkennziffer. Die könnte man doch genau zum Zweck der Bildung einer eindeutigen Mailadresse verwenden. Für kompromißlose und doch einfache Lösungen wie diese sind die Super-Consultants von T-Systems aber wohl nicht empfänglich. Pfeifen.

October 10, 2008

Untote Exploits

Filed under: Security, UNIX & Linux — Tags: , , , — martin @ 5:55 am

Jahrelang habe ich auf dem K. herumgehackt, weil “sein” IPS immer Verbindungen unterbrochen hat, nachdem es Bytefolgen auf der Leitung gesehen hatte, mit denen man vor etlichen Jahren mal irgendwelche archaischen Exploits (konkret erlebtes Beispiel: Sendmail decode vulnerability) triggern konnte. Denn mal ehrlich: Wie obskur kann’s noch werden?

Heute bin ich in gewisser Weise einen Schritt weiter, denn bei einem Kunden wurde ein SLES9 aus dem Internet gecrackt, weil der Angreifer sich über einen PHP-Exploit die /etc/passwd herunterladen konnte und darin Passwort-Hashes vorgefunden hat, die ein Administrator beim Anlegen von Usern per Copy&Paste dort eingebaut hat. Die hat er dann auf dem üblichen Weg mit etwas Geduld per Brute-Force geknackt. Ein Szenario aus den 1980ern. Ekelhaft.

Older Posts »

Blog at WordPress.com.