Archive for February, 2009

[NL] Rommelen met animated GIFs

Wednesday, February 11th, 2009

Zoals je hiernaast kunt zien, ben ik aan het spelen geweest met animated GIFs. Het maken ervan bestaat uit 3 stappen.

  • een filmpje opnemen.
  • het videobestand splitsen in afzonderlijke jpeg bestanden.
  • de afzonderlijke jpeg bestanden samenvoegen in een animated gif.

Een filmpje opnemen is niet zo lastig, dus deze stap sla ik voor het gemak even over. Hieronder zal ik de laatste twee stappen beschrijven.

Met behulp van mplayer kan je een videobestand opdelen in afzonderlijke jpeg bestanden. Met behulp van de -ss en -endpos opties van mplayer kun je ook een fragment van het videobestand opdelen.

$ mplayer -ao null video.mpg -vo jpeg:outdir=.

Als het goed is, heb je nu in de huidige directory een aantal jpeg bestanden staan. Nu kun je met het convert programma van ImageMagick de jpeg bestanden gebruiken om een animated gif te maken.

$ convert -delay 20 -loop 0 000*.jpg video.gif

Naast animated GIFs zijn nu ook animated PNGs (APNG) in opkomst. Helaas wordt APNG nog niet ondersteund door alle browsers

IPsec newhostkey failure in virtualized environment

Monday, February 9th, 2009

Currently I’m exploring the world of IPsec. In a VMware test environment I’ve created CentOS5 nodes and networks to simulate secure data exchange between two private networks via a public network.

Last week I’ve succesfully created a working IPsec tunnel with use of CentOS5 and the ipsec-tools package. This document describes how to create a IPsec Network-to-Network connection. I recommend to use paragraph 42.7.7.2 to create it manualy, instead of using a GUI.

Besides ipsec-tools, CentOS5 also includes OpenSWAN in its updates repository. While trying to setup an IPsec tunnel with use of OpenSWAN I quickly ran into problems. Following this tutorial one of the first steps is to create an IPsec public key using the ipsec newhostkey command. So, on one of my VMware Centos5 hosts I ran te command:

# ipsec newhostkey --output /etc/ipsec.d/ipsec.secrets

I waited and waited, but nothing seemed to happen. It just hung. Trying to figure out the problem, I ran the command on another non-virtualized CentOS5 host without any problems. After some more debugging I found out what was causing the problem. It seems that Virtual Machines have limited resources when it comes to the /dev/random device. And this device is being used when creating keys using the command ‘ipsec newhostkey’.

In this post the problem with /dev/random within Virtual Machines is described as follows:

“The root of the problem is actually that the Linux kernel relies heavily on interrupts for generating random numbers. In a virtualized environment a Linux kernel will be unable to generate random numbers due to being unable to access the hardware.”

In the same post you can also find some solutions to solve the problem. For me the workaround is simple; I’ll just create the keys on my none virtualized Centos5 box!