Month: April 2009

Quick data pipeline for encryption and decryption

In the need for a quick pipeline to encrypt and decrypt data, gpg can be quite handy, for example it can be used in this way to encrypt  some backup before transferring it to a third part hosted  storage:

cat backupfile.tgz | gpg -c --cipher-algo=BLOWFISH > backupfile.tgz.gpg

(you’ll be asked for the Passphrase to use for encryption)and for decryption:

cat backupfile.tgz.gpg |gpg -d --cipher-algo=BLOWFISH > backupfile.tgz

(you’ll be obviously asked for the Passphrase again, don’t forget it and save it in a safe place!)To use it inside a script (batch process) the useful --passphrase switch can be employed:

cat backupfile.tgz | gpg -c –cipher-algo=BLOWFISH --passphrase abcdefghi1234567890 > backupfile.tgz.gpg

in this case, do not forget to set 700 the file for avoiding unwanted reading…

Clear the whole Postfix mail queue

To clear the whole Postfix mail queue you can use this command:

~# for i in `mailq|grep '@' |awk {'print $1'}|grep -v '@'`; do postsuper -d $i ; done

Thomas Sewell from contributed with this helpful notes:you could also just do:

postsuper -d ALL

to clear all mail queues or even

postsuper -d ALL deferred

to just get rid of deferred mail from the queue.Thanks Thomas! 🙂

Quick System Backup via Netcat

Sometimes a backup is needed but the server storage is not enough, in this case you must backup your data on the fly via the net, without the facility of storing locally and then transfer the data.There are many methods to backup your data on the fly, using rsync via ssh is one for example, but this post is about using netcat for a quick solution.Listening side, where the backup data will be stored, or destination:

~# mkdir /whatever_the_name_of_your_backup_dir~# cd !$~# netcat -l -p 12345 | pv | tar xjf -

Sending side, where the original data are, or source:

~# cd /~# tar cjf - --ignore-failed-read bin boot cdrom dev/ etc/ home/ initrd* lib/ root/ sbin/ usr/ var/ vmlinuz*  | pv | netcat -q 2 <YOUR_DESTINATION_IP> 12345

Don’t forget to create: /bin /media /mnt /opt /proc /selinux /srv /sys /tmpand chmod 1777 /tmp(This FHS is for a Debian Etch, please take care of different directories in your setup)

Eucalyptus Cloud Computing in Ubuntu 9.04


Ubuntu 9.04 Server Edition makes it easy to experiment with cloud computing. Eucalyptus, an open source technology which is included in Ubuntu as a technology preview, enables you to use your own servers to deploy, experiment and test your own private cloud that matches the Amazon EC2 API. You can dynamically create virtual machines, configure multiple clusters into a single Cloud and even provide an EBS (elastic block storage) equivalent and an S3 compatible storage manager.