Mac user phase 2: Fight for supremacy

September 3rd, 2008

On my second day as a Mac user, I entered the staring contest phase. This will probably last for a couple of weeks, where I try to out-stare the mac while it tries to out-stare me, until I get used to the weird key combinations and get some of the basic tasks automated as I have on Linux.

I learned:

  • Installing firefox is easy, including my favourite plugin (Morning Coffee).
  • Installing OpenOffice is complicated and it requires a working X server, which I do not seem to have, although an X server is installed. I didn't solve that today, that will have to wait.
  • Something called NeoOffice exists which one can install instead. I haven't tried it on any actual documents or excel spreadsheets yet.
  • The pipe sign is found on Alt + i, and ps ax | grep Open> does give the openoffice processes, and the "kill" command works. (Anything less and sweet Macbook could have kissed me goodbye and have been kicked back downstairs faster than it could say "command timed out...")
  • Applications goes in places like "/Applications/Firefox.app/Contents/MacOS/firefox-bin" and "/Applications/Utilities/Terminal.app/Contents/MacOS/Terminal" and can actually be started from the command line this way.
  • I haven't figured out where the firefox settings go.
  • It has rsync and chmod works.
  • If I ctrl+d a shell the window stays open saying "process finished" or something like it. But Swedish Sightseeing + q closes the window.

My first day as a Mac user

September 2nd, 2008

Is is almost true to say that I have never touched a Mac before. I did once in the terminal room at a Nordu or bsd conference somewhere just after the first unix based MacOS came out. But I never really tried a Mac before.

So today when I got to borrow one for a while was my first real Mac experience. Perhaps I cheated a bit since what I basically did was to open 6 terminal windows with ssh to my laptop and my appserver (although I also opened a browser). But the only way for me to get to know the thing is to try using it as my primary workstation for a while, and that was the work I needed to do...

Here is what I learned:

  • You find the terminal in the top menu under "Go -> Utilities".
  • When you are inside the terminal window or another application the top menu (of the screen) is the applications menu.
  • Clicking the terminal icon again only puts your existing terminal window in
    focus. You can start a new terminal window by pressing what I think they call
    the command key (the one with the Swedish sightseeing symbol) and "n".
  • The external mouse needs to be on a dark surface.
  • The network card is called /dev/en0 and there is an ifconfig command. But the network can also be configured by clicking the wireless symbol in the top right menu and selecting "Open Network Preferences". And it configures more or less by itself, but still. We need to be in control, even on a Mac ;)
  • Copying and pasting from one terminal to another can be done by selecting with the mouse, pressing "Swedish sightseeing + c", changing to the other terminal, and pasting with "Swedish sightseeing + v". (I know I am not a real Mac user until I learn the official names for the keys. Somehow I can live with that).
  • Changing between the open terminal windows can be done with "Swedish sightseeing + 1" for first window, "Swedish sightseeing + 2" for second window etc. The keyboard shortcut dialog claims that it should be possible to cycle the windows with "Swedish sightseeing + ' " or perhaps ` but neither worked for me.
  • When I needed to print from within the Safari browser it found my networ
    printers quite by itself from within the print dialog. Safari does not seem to have any "print only selected text" function.
  • Virtual desktops are called spaces. There is a space icon in the icon menu at the bottom of the screen, if you click it you can enable spaces. You can change space with "crtl + arrow" where you use the arrow keys to go to the space above or below or left or right.
  • I cannot find a focus follows mouse option. That is probably not desired behavior for a Mac.
  • It has vim. Haven't tried it since the files I needed to edit was on another machine.
  • The only keyboard problem I experienced was when logging in to my home machine via ssh and reattaching a "screen" where I have a running irssi. The backspace key did not work in irssi. But "ctrl + h" did.

No more Mac sightseeing today. I'll be Bach...

Getting John the ripper to run with LDAP SSHA passwords

August 26th, 2008

To get john the ripper to run on an ordinary shadow file, I just ran

apt-get install john

and then

john /etc/shadow

To get it to run on ldap passwords with SSHA:

Make script to extract passwords from ldap:

#!/usr/bin/perl
# This script is getpwfromldap.pl
use strict;
use Net::LDAP;
my $ldap = Net::LDAP->new( '127.0.0.1' );
my $mesg =$ldap->bind('cn=ldapadmin,dc=whatever,dc=example, dc=com',
                      password => 'ldappassword'
                      );

$mesg = $ldap->search(
                      base => "dc=whatever,dc=example,dc=com",
                      filter => "(uid=*)"
                      );

$mesg->code && die $mesg->error;

foreach my $entry ($mesg->entries) { 
  print  $entry->get_value('uid') . ":" .  $entry->get_value('userPassword') . ": \n " ;
}
$mesg = $ldap->unbind;  
# take down session

Run the script:

./getpwfromldap.pl > ldappasswdfile

The content of the file should look like this:

user:{SSHA}971E3Lf01ZxHlIt5gK8f3MU8ubPPOyzG:

(no this is not one of my passwords).

Install SSHA compatible john:

wget http://btb.banquise.net/bin/myjohn.tgz
tar xvzf myjohn.tgz\ncd john/src
cd make linux-x86-any
cd ../run 

Run john on the file you made:

./john ldappasswdfile

Getting it to work with mixed SSHA and crypt from ldap:

Problem: You have a file with mixed entries

user:{SSHA}971E3Lf01ZxHlIt5gK8f3MU8ubPPOyzG:
user2:{crypt}IUHjbpfAE9dHQ:

Solution: You have to run twice.

  • Do as above for SSHA (with myjohn).
  • Remove {crypt} from the crypt lines and run john (from myjohn) again.

MRTG performance with rrdtool and fastcgi

July 29th, 2008

Update on MRTG on HP switches:

I had some performance issues with MRTG when I started running it on all 56 switches, which I more or less resolved with rrdtools and fast-cgi:

http://people.binf.ku.dk/~hanne/technotes/mrtg/#performance

Book: Father Brown - The Essential Tales

July 20th, 2008

G. K. Chesterton: Father Brown - The Essential Tales.

Following references again... Tommy and Tuppence playing detectives at some point plays "Father Brown". So I picked up a Father Brown book on my latest trip to London to see what it was.

It is rather cosy nice detective stories but a bit to fantastic to really make you imagine that it could happen. The hero is off course Father Brown who is a Roman Catholic priest with an unusual ability to see through things and find the truth about all the little mysteries that comes his way.

Sometimes he talks the criminal into being good and he also has some comments about atheism. I can recommend it to the detective story fan or the curious reader, but I shall probably not buy more Father Brown books unless a for long flight or like.