Qmail : Trick

If you are using vpopmail and qmail to host virtual domains, you can get a list of all the aliases in a domain by using valias. The syntax is
valias -s DOMAIN_YOU_WANT_TO_LIST_ALIASES

If you want to list the users (and NOT aliases) in a domain, you can use vuserinfo. The syntax is
vuserinfo -D DOMAIN_YOU_WANT_TO_LIST_USERS

Chatting at 35000 feet!!

I flew Lufthansa, on my recent trip to India and was very impressed by the hospitality and the services offered. One of the coolest service on the flights was “Wi-Fi” hotspots offering Internet service. While the service was a bit expensive at $10.00/hour, I tried it out just to satisfy my geeky urgings. It was a blast chatting with friends and telling them that I am doing it from 35000 feet in the air ;). For anyone wanting to try this, I would reccomend getting the “unlimited” access for the entire duration of the flight for $29.95. I would love to look at the technology behind this setup. I am sure they are using satellites for the Internet access. Just interesting how they make sure that the connection stays steady while the flight is moving, since satellite service is very dependent on “point-of-view” access to the satellite.

Please ~sound horn~ Please

I went in India for a (very) short trip this week. I was literally there for only 4 days to attend a wedding. For anyone who travels between US and India, you will realize that this is a SHORT trip :). I ended up spending more time in the airports than with my family. In fact, I am writing this post from the business lounge in the Frankfurt airport. How I got into it is another story :).

I spent a lot of my time during this trip on the road travelling between cities for the various wedding ceremonies. It was a lot of fun, but pretty tiring. During my last trip to India in February, I came back with a vision of a country on the verge of moving on to the next level. It looked like there was unlimited potential everywhere you look. This euphoria certainly came down during this trip. The rural countryside has been mostly left behind from the benefits of the “Internet” explosion. This might pose a big problem to the country if there is no immediate focus on developing the infrastructure. For comparisions..travel time in the US between two cities ~200 miles apart would be ~4 hours. The same distance took me ~9 hours in India. And not to mention the numerous times you get a heartattack from vehicles parked in the center of the road without any visual signs or the cows that wander onto the road without a bother :). And every truck/bus has a “Please ~Sound Horn~ Please” printed on the back of them. Just imagine the sound pollution when everyone in the world seems to be honking at the same time. It is so bad that people seem to have stopped responding to the horns. I know that a lot of people have nostalgic feelings about this situation, but unfortunately, if we want to move from a “developing” nation to a “devloped” nation, we have to get better infrastructure.

I wanted this post to be a reflection of my nostalgic feelings of the “do as you wish” country that India was (is) and how we need to get more organized, even if it means giving up this luxury of being a laid back country. But as usual, I seem to have made a mess of expressing my thoughts :). More posts on this topic soon….

Scan UDP ports using NMAP

NMAP is an open source network scanning utility. It has tons of options and is a very powerful tool that every administrator needs to know about. Recently, we were checking if UDP port 88 was open on a certain server. NMAP to the resuce :)..

nmap -sU -p 88 DESTINATION_SERVER_IP did the trick. The “-sU” option forces nmap to only scan UDP ports and “-p” forces nmap to only scan the specified port.

The "sticky" cucumber

I loaned “Spirited Away” to one of my colleagues at work and she watched it with her children. The kids loved the movie and wanted to draw a thank you note for me.. My colleague asked them to draw the note and stick it to a cucumber from their kitchen garden so that she can give it to me as a gift. So she wakes up in the morning and here is what the kids come up

They really stuck the note to the cucumber :). Here it is after the tape was cleared up

Thx for the cute note guys 🙂

Cheesy pickup lines :)

On of my friend sent me an e-mail with the top 10 pickup lines.. I thought they were hilarious and wanted to publish them here

Was your father a thief? Because he stole the stars from the sky and put them in your eyes.
Didn’t it hurt when you fell from heaven?
You must be tired, because you’ve been running through my mind all day.
Excuse me, I seem to have lost my phone number. Could I borrow yours?
Do you believe in love at first sight, or shall I walk by again?
Excuse me, do you kiss strangers? No? Well let me introduce myself.
Do your legs hurt from running through my dreams all night?
I’m new in town. Could you give me directions to your apartment?
Do you have a map? I keep getting lost in your eyes.
The only thing your eyes haven’t told me is your name.

Command Line and Scripting in all their glory!!

Challenge: You are asked to update ~500 records on your DNS servers running Windows 2003 SP1.

Solution : Spend hours and hours updating the entries using the pretty MMC based GUI
or
use some creative scripting to do the work for you. Here is the recipe

1) Download the Windows Support Tools for SP1 from here. The support tools contain a useful utility called “dnscmd”. The tool allows one to add/update/delete entries for Windows DNS servers through a command line interface. DnsCmd /help returns the following

Usage: DnsCmd []:
IP address or host name — remote or local DNS server
. — DNS server on local machine
:
/Info — Get server information
/Config — Reset server or zone configuration
/EnumZones — Enumerate zones
/Statistics — Query/clear server statistics data
/ClearCache — Clear DNS server cache
/WriteBackFiles — Write back all zone or root-hint datafile(s)
/StartScavenging — Initiates server scavenging
/ResetListenAddresses — Set server IP address(es) to serve DNS requests
/ResetForwarders — Set DNS servers to forward recursive queries to
/ZoneInfo — View zone information
/ZoneAdd — Create a new zone on the DNS server
/ZoneDelete — Delete a zone from DNS server or DS
/ZonePause — Pause a zone
/ZoneResume — Resume a zone
/ZoneReload — Reload zone from its database (file or DS)
/ZoneWriteBack — Write back zone to file
/ZoneRefresh — Force refresh of secondary zone from master
/ZoneUpdateFromDs — Update a DS integrated zone by data from DS
/ZonePrint — Display all records in the zone
/ZoneResetType — Change zone type
/ZoneResetSecondaries — Reset secondary\notify information for a zone
/ZoneResetScavengeServers — Reset scavenging servers for a zone
/ZoneResetMasters — Reset secondary zone’s master servers
/ZoneExport — Export a zone to file
/ZoneChangeDirectoryPartition — Move a zone to another directory partition
/EnumRecords — Enumerate records at a name
/RecordAdd — Create a record in zone or RootHints
/RecordDelete — Delete a record from zone, RootHints or cache
/NodeDelete — Delete all records at a name
/AgeAllRecords — Force aging on node(s) in zone
/EnumDirectoryPartitions — Enumerate directory partitions
/DirectoryPartitionInfo — Get info on a directory partition
/CreateDirectoryPartition — Create a directory partition
/DeleteDirectoryPartition — Delete a directory partition
/EnlistDirectoryPartition — Add DNS server to partition replication scope
/UnenlistDirectoryPartition — Remove DNS server from replication scope
/CreateBuiltinDirectoryPartitions — Create built-in partitions

As you can see, there is ton of stuff you can do with this utility. I am mainly interested in the /RecordAdd function for this example.

2) Write a small perl script to massage your raw data into the form you want. In this case, I was given the hostname and the IP address in an excel spreadsheet. I exported the spreadsheet to a command delimited file and the following perl script finished the job for me

#!/usr/bin/perl -w
# use strict;
my (@File, @Column, @HostID, @NetworkID, $Line);
my $infile = ‘NetworkCore.csv’;
my $outfile = ‘NetworkCore_Processed.txt’;

open(READ,”$infile”)
or die “Couldn’t open $infile for reading: $!\n”;
@File = ;
close READ;

open(OUTPUT,”>$outfile”)
or die(“Unable to open my $outfile: $!”);

foreach $Line(@File)
{
chomp($Line);
@Column = split(/,/,$Line);
@NetworkID = split(/\./, $Column[0]);
@HostID = split(/\./, $Column[1]);
print OUTPUT “dnscmd DNS_SERVER /RecordAdd DOMAIN_TO_ADD $HostID[0] A $Column[0]\n”;
print OUTPUT “dnscmd DNS_SERVER /RecordAdd xxx.xxx.in-addr.arpa $NetworkID[3].$NetworkID[2] PTR $Column[1]\n”;
}
close OUTPUT
;

Note : The DNS_SERVER, DOMAIN_TO_ADD and xxx.xxx.in-addr.arpa need to be replaced with your own values

3) Open a command prompt on the DNS server and copy and paste the contents of the file that the perl file spits out.. Did, I say that I love technology?? :)..

Gmail musings.

I have been maintaining my @kudithipudi.org address for some time now. I had all my E-mail from 1998 saved on my laptop until I had a hard drive disaster (ALWAYS BACKUP YOUR DATA), and lost all that E-mail. Ever since then, I have been trying to come up with a method to make my E-mail “crash” proof. I could have moved to using any of the popular free mail platforms (hotmail, yahoo, gmail etc.), but I didn’t want to loose the ability to send E-mail from my personal @kudithipudi.org address.

Google to the rescue – I was checking the settings on gmail the other day and noticed that I could setup a different E-mail address (which has to be verified) as my default “from address”. So I started forwarding E-mail from my domain to gmail. The problem now was to upload all the E-mail I have in Thunderbird up to gmail. That way, I would have all my E-mail in one single place and allow me to search through it. Google to the rescue again :), a query for “upload mail from thunderbird to gmail” returned this cool utility by Mark Lyon. It allows you to specify the source of your email and uploads the mail to your gmail account.

The next challenge was to find the directory/file where Thunderbird stores all the email. Google to the rescue again. You can get the location of the mail files from the account settings screen –> Local Folders in Thunderbird.

I am in E-mail bliss now. Use Gmail for all my messaging purposes. Next task would be to start using the Google Calendar.

Reprocess existing e-mail

Ran into an issue at work, where we had to reprocess all e-mails for a particular user on a Linux server. The email was stored in the standard mailbox format in /var/mail and all the e-mail was supposed to be sent to a different e-mail address. Here’s how we solved the issue

1) Use formail to split the mailbox into seperate messages and pipe it to sendmail. Command used was

formail -Y -n -s� sendmail -odq NAME_OF_USER < /var/mail/NAME_OF_USER

2) Force sendmail to process the queue and send the e-mail to the new address. Command used was

sendmail -v -qRNEW_EMAIL_ADDRESS

You can also edit the .forward file in the users home directory to forward e-mail to the new address and then you don’t have to specify the new e-mail address in the second command.