Archive for the ‘Programming’ tag
vbackup – script to backup RHEL/CentOS/Fedora systems released
A long time ago I started writing a Bash script to create backups for my systems.
Over time this script has developed into something I and some collegues and friends find useful, so I decided to publish it and see if more people are interrested in using it. If so, I’ll try and maintain it.
The program is released under the GNU GPL v3.
My backup regime consists of making a full backup once a week and then a daily differential backup since the time of the full backup. This script obviously concentrates on that. If you need incremental backups, adapt the script to your needs.
The script was written for CentOS 4 and 5 systems, and most likely will run without a hitch on all Red Hat derivates like Fedora.
The main features of this script are:
- Option to exclude files and directories from the backup by specifying exclusions as regular expressions. Sound difficult? Isn’t! See the included example. Google “perlretut” for excellent documentation on learning regular expressions.
- Options to set the location of the backup files, temporary files, etc.
- Options to have backup files and/or log files stored uncompressed or compressed with gzip or bzip2.
- Option to have sha1 checksums generated and stored to check file integrity afterwards.
- Options to have custom commands executed right before and after the backup. You could use these to rsync files to an off site location, mail backup logs, whatever. See the script for some simple examples.
All options are documented withtin the script file. Open it, browse through them and change them before using the script!
Let me know when you find serious errors. Suggestions are always welcome. How to contact me is on the end of the README file. I may not get back to every single email, but I’ll try
You may download the script here: http://www.xs4all.nl/~vincentv/vbackup-1.0.0.tgz
Make sure you save the script as a .tgz file. Some browsers get the extension wrong.
Happy backupping
How to generate an RFC 822/2822 message ID
RFC 822 and RFC 2822 messages have to have a Message-Id header.
The format of this ID is:
<random characters@fqdn-of-sending-host>
So, for instance:
<2d258de11a15b737061fc77dc1fd95d60110063@mail.vive-id.nl>
The message ID is not meant to be human-readable and must be unique for the message.
So, how to generate a unique string?
Well, I use the current time with microseconds as a base; that’s unique enough. To convert that into a unique string, I create an SHA1 hash of that current time.
In PHP I do something like this:
$Message-Id = "<" . sha1(microtime()) . "@" . $fqdn_hostname . ">";
See http://www.faqs.org/rfcs/rfc2822.html for more info.
Including a message ID in your email lowers the score some spam filters give you, so it’s a good idea to do this (and it’s obligatory since RFC 2822).
Happy mailing!
SHA-1 crypto analysis paper available
In Februari Chinese researchers published a short statement on the fact that they had a way of finding collisions in the SHA-1 algorithm.
SHA-1 is a hashing algorithm, in short it takes some data and computes a large number that is absolutely unique for that data. When someone changes any part of the data, the outcome of the hasing function changes. This is used for instance to guarantee integrity of a message.
The Chinese researchers have found a way to find collisions; in the end that means that in theory someone could craft two messages with the same result from the hash function. I say “in theory”, because at this point in time it takes quite some computing power to do so, but time has proven that that will change.
Up until now the paper wasn’t available; it is now. For the mathematicians among you, you can find it here: http://cryptome.org/wang_sha1_v2.zip