Blog

We offer the articles below in the hope that they will be useful, but we cannot accept liability for any problems caused by the instructions that they contain. If you have a problem, question or feedback relating to one of our articles, please post a comment so that other readers can benefit. We regularly review comments and reply or update the articles, to ensure their continued usefulness. All articles are provided free, without any advertising or tracking, for the benefit of the technical community.

If you require paid commercial support, please contact us for assistance.

How to encrypt files using OpenSSL

Here’s how to encrypt a single file using a password and a salt:
openssl aes-256-cbc -salt -in filename -out filename.enc -base64
Type a strong password when prompted.

Here’s how to decrypt the same file:
openssl enc -d -aes-256-cbc -a -in filename.enc -out filename
You’ll need to re-enter the passwod that you used to encrypt it.

If you want to encrypt multiple files, combine them into a tar or zip archive before encrypting them.

Building a Linux cluster using PXE, DHCP, TFTP and NFS

Building a small Linux cluster is a lot simpler than I thought it would be. That said, there are a number of snags and pitfalls along the way, and it’s hard to find a comprehensive and up to date set of instructions online. There are also different approaches, either doing everything manually or using a system such as LTSP. This post describes my experiences setting up a cluster manually.

IPsec VPN connections require matching MTU

After spending a long time trying to work out why some pings were randomly dropped between hosts on different segments of a virtual LAN connected by a transparent IPsec VPN tunnel, I discovered that the MTU for the underlying connection on both ends of the VPN should be set the same. The default for ADSL is usually 1492, whereas 1500 is frequently used for other connection types such as cable or fibre. When I changed the settings at both ends to 1442 (allowing some overhead for IPsec) then the random ping loss stopped.

Python mutable default function arguments are static

This particular quirk of Python has been discussed in various places before, but I think it bears repeating as it’s different to the behaviour that you might intuitively expect and consequently catches a lot of people out when writing class methods. When declaring a function or a class method, any default arguments are only evaluated at the point when the function is declared, not when the function is called. For mutable default arguments such as lists or dictionaries, this has the effect of making them static. Consider the following example: