Lil’ bit: Redirecting traffic out a given interface

2009/02/25 16:23:00

This is a relatively simple trick, but one that I thought was rather clever.

I needed to SSH into a target server ( that only allowed connections from a specific IP address ( I knew that the system holding that specific IP address was down, yet I still needed to SSH into the target.

To further complicate matters, I did not have physical access to the target network at the time. But, I did have remote access (and root) to another Linux box on the network.


So, all I needed to do was change the IP address of my one good box to the one expected by the target system, but if I changed the IP address on the main interface, then I would disconnect myself.

Enter virtual interfaces and routing.

I created a new virtual interface with ifconfig (assuming is the IP we want to come from):

/sbin/ifconfig eth0:1

This does not, however, mean that my SSH connection will come from this address, so I needed to change the routing table (assuming is what we want to connect to):

/sbin/route add -host eth0:1

Now, I will effectively be coming from my new interface when I connect to the target server.

Automatically Backing up Blogger

2009/02/14 00:26:00

In my continuing quest to use Google Apps as best I can, I’ve been reading up on the Google Blogger API.

I thought that automatically backing up a blog on Blogger would be easy, but it turned out to be a more complex script that I had originally thought.

Authentication was the part that I was missing. Using curl, I can acquire the authentication information like so:

curl -s -d -d Passwd=mypassword -d accountType=GOOGLE -d source=blog-backup -d service=blogger

From this line, you get output like so:


The line we’re interested in is the one starting with “Auth=”. This is what we will use to authenticate to blogger so that we can grab our blog backup.

Part two consists of downloading the XML backup of all of your posts.

I knew that I could go to the following URL to get a backup of my blog posts:

where I fill in blogid with the blogID supplied by your URL on Blogger. For example, as I type this, the URL in the address bar is

which tells me that my blogID is 6964696676319111700.

So, to download the blog backup, I use the following URL:

With the use of the tool curl and some Bourne Shell scripting, the following script can be used to automatically download my XML file containing a backup of my blog from Blogger.

# Authentication and authorization
export Auth=`curl -s -d -d Passwd=mypassword -d accountType=GOOGLE -d source=blog-backup -d service=blogger | grep "Auth="`
# Get the xml file and store it into blog-backup.xml
curl -H "Authorization: GoogleLogin ${Auth}" "" &gt; blog-backup.xml<span style="font-size: 85%;">

Now I set cron to run this script once a week and I will have a backup of my blog entries should something horrible befall blogger; or I choose another blogging service.