Educating the world

Our blog has over 10,000 readers a month

Loading VirtualBox snapshots

July 12th, 2010

VirtualBox allows you to take snapshots and restore them. It works some of the time and to be fair this has got a lot better in recent versions. The process for restoring a snapshot is unusually awkward to the point that I’m blogging it so it must be difficult to remember - either that or all those years of excessive fun at university are finally coming back to steal my sanity.

  1. Load VirtualBox application.
  2. Look at the Snapshots(n) tab on the right hand side.
  3. Highlight the snap shot you want.
  4. Click the “Restore Snapshot” icon and click “Restore” to confirm.
  5. A progress bar of “Restoring execution state” will appear then disappear.
  6. The writing on the left hand side under the machine operating system icon will switch to “Saved". On the right hand side the snapshot name will go bold and the “Current State” will move to just under the snapshot you had previously highlighted.
  7. Strangely the snapshot doesn’t appear, now you have to click “Start".
  8. A progress bar of “Restoring virtual machine…” will appear then disappear.

If you are lucky this will work and you will see the snapshot reformed in the state you left it. If you are unlucky there will be a brief flash of what should have been and the virtual machine will reset.

When you have finished don’t bother shutting the machine down just click the “X” to close the Virtual machine and select “Power off machine".

Upgrading Plesk 9.3.0 to 9.5.1 to 9.5.2

July 8th, 2010

There are always problems with upgrading server appliance software because of the amount of different configurations there are. So although this article is limited to Plesk the same would be true of any other appliance upgrade. This article is for any problems I encounter along the way and will become a table of contents to any additional software/blogs I write relating to bugs or shortcomings of the new Plesk 9.5.2 software.

Upgrading from 9.3.0 to 9.5.1

This update includes a Horde update which is about time. I’ve been awaiting for the extra sync’ing support that it has. A part from Plesk upgrades this version upgrade updates: Watchdog, Mailman and SpamAssassin.

  1. I highlighted all the packages I wanted to install and installed them. I went in to the 9.5.1 updates section again and Qmail had not been upgraded. I don’t remember seeing it during the first iteration. I may have missed it, but I’m pretty sure I didn’t. It must have appeared!

Upgrading from 9.5.1 to 9.5.2

This update addresses: Watchdog, Mailman, SpamAssassin, Horde, PHP5 and Qmail.

  1. The spamassassin daemon (spamd) did not start so needed to be started manually:

    /etc/init.d/psa-spamassassin restart

  2. Machine crashed a couple of days later, but I think it was just a coincidence, as it had the same disk errors we have been seeing for a while.
  3. Went into the updates section and the “Base packages of Plesk” was showing that there was a new version available. I know I have installed it already. So I installed it again. It now shows that it is up-to-date.
  4. I had made some changes to the httpd.conf for a particular domain. The upgrade over wrote my changes with a new copy. The new copy was the same as the old copy - thanks!

Let the games begin…!

Policially correct

July 7th, 2010

Just finished watching the first series of Seven Days, and I have to say it was pretty good. The story is based around the chrononaut Frank Parker who is a member of the BackStep team. Project BackStep use technology from the crashed Area 51 space ship to create a ship that can travel back in time up to 7 days. They use the ship to undo catastrophic events.

Funnily enough I’ve just been making my way through ABC of Relativity, and in spite of the time-travel relativity techno-babble things did seem to match up with the actual theory. Mind you after watching that last episode of Doctor Who - The Big Bang this program should present you with no problem at all!

Anyway, I digress. The team is speculating about a virus that has wiped out 98% of the world’s population and Frank has BackStepped to prevent it from happening. Ballard is the scientist, Donovan is the army man and Ramsey is head of security at the BackStep facility. I just liked the way he lists all the attributes that are basically true of 9/11. Maybe it was this comment, three years before, that pushed al-Qaeda over the edge.

Ballard: This may not be a natural occurrence, the data we have indicates this virus could well have been man-made.
Donovan: Who the hell would want to release something that kills everybody?
Ramsey: Arh, some suicidal, middle eastern, camel riding, malcontent, that hates us, look at the kamikazes in WW2.

What the world thinks of techies

July 1st, 2010

I’ve been in I.T. for all of my working life. I’m a geekie type but I have a personality underneath with friends to prove it. I’ve met a lot of techie people who are, quite frankly, really dull so I can see where the stereotype comes from. We are like policeman and lawyers - handy to have in your arsenal of friends but you probably won’t invite them out for a beer unless you need something.

One of my favourite programs is Garth Marenghi’s Darkplace which is a spoof TV “horror series from the early 1980s that was considered so groundbreaking and terrifying that it was promptly sat on by the company that commissioned it". In the fifth episode Scotch Mist, kilt wearing ghosts come back to Romsford to seek revenge on Dagg Douglas MD because of the less than flattering things he said in a chip shop after his plane was diverted to Prestwick airport. Anyway, Scotch Mist rolls in (very much like John Carpenter’s The Fog) and starts killing the hospital staff leaving there bodies on the moor covered in tartan patterns. The quote comes during one of the director-commentary-style inserts that broke up the show.

Dean Learner: We found out that the mist was poisonous when two techies died. Now I don’t like to see anyone die, but if someone has to die, it might as well be a techie… because another one comes along, it’s the same belt, it’s the same hammer in the tool belt, you can barely tell the difference.

Building redir (redir.c) from patched sources

June 22nd, 2010

There is a really handy utility for Un*x called: redir (redir.c). It is a user level program that does port redirection. It’s really handy if you want a quick and dirty way of making traffic on one port on your machine point to another port on another machine. I’ve used this technique to by-pass firewalls and bounce traffic through places it’s not supposed to go.

I could have used iptables or ipchains, but these require root access which you might not have. Under Un*x you need root privileges to open a port numbered less than 1000 but most of the time you are re-routing normal application services like Oracle Forms and jInitiator which opens a gazillion ports to various machines to do application server stuff.

Also using iptables or ipchains is so final, not to mention fiddly to set up! Besides another reason to use redir is that the program can be modified to allow you to watch or collect the traffic, which could be infinitely more useful &#59;)

Unfortunately, redir is no longer in a standard distro so it has to be built from scratch. The program itself hasn’t changed for about 10 years so it is only available in source and patched source. I’m going to describe below how to download, patch and build the redir application.

  1. Create a working folder and go into it.

    mkdir redir
    cd redir

  2. Go to http://redir.sourcearchive.com/ and find the latest version.
  3. At the time of writing this article the latest version is 2.2.1-9. Download those components.

    wget http://redir.sourcearchive.com/downloads/2.2.1-9/redir_2.2.1.orig.tar.gz
    wget http://redir.sourcearchive.com/downloads/2.2.1-9/redir_2.2.1-9.diff.gz
    wget http://redir.sourcearchive.com/downloads/2.2.1-9/redir_2.2.1-9.dsc

  4. Check the integrity of the downloads with md5sum and compare them against the values listed in the *.dsc file

    md5sum redir_2.2.1-9.diff.gz redir_2.2.1.orig.tar.gz
    e82abbecfa8ca5941e6601d61b84303d redir_2.2.1-9.diff.gz
    4342fadac30504c86c8db7beefe01995 redir_2.2.1.orig.tar.gz

  5. Uncompress the sources.

    gunzip redir_2.2.1-9.diff.gz
    tar -xvzf redir_2.2.1.orig.tar.gz

  6. The first patch expects the files to be in different places, so shift things around a little to make it match up, don’t worry about the mv/subdirectory warning.

    mv redir-2.2.1 redir-2.2.1.orig
    mkdir redir-2.2.1.orig/debian
    mv redir-2.2.1.orig/* redir-2.2.1.orig/debian

  7. Now apply the patch.

    patch -p0 -i redir_2.2.1-9.diff

  8. There’s no dpatch on Plesk so we will have to apply the patches by hand using the normal patch command. Change to the main source folder.

    cd redir-2.2.1.orig/debian

  9. The patches must be applied in order so list them out and build a patch script.

    ls patches/[0-9][0-9]_* | sed ’s/^/patch -i &/’ > do.patch

  10. Then run them all.

    sh ./do.patch

  11. Now that we have applied all the patches, we must clean and build.

    make clean
    make

Now we’ll test it. The following command listens to port 12345 and relays all connections to port 22 (on the same machine). So by talking to port 12345 we are actually talking to our SSH service listening on port 22.

  1. Launch the port redirector service in the background.

    ./redir –lport=12345 –cport=22 &

  2. Connect to the service.

    ssh -D 12345 localhost

  3. Log in and then log out.

    hostname
    exit

  4. Kill service.

    kill %1

Go play!