Category Archives: Tech

Postfix configuration: dealing with spam

Recently had an issue where everytime I tried to send an email, it was getting rejected by my smtp server. At the same time, it seemed like I was getting a barrage of spam hitting my inboxes, so I assumed I had been hacked.

To cut a long story short, turned out to be that my server had lost its configuration for DNS lookup, and the anti-spam rule reject_unknown_sender_domain was then being triggered! 3 fucking days to work that one out…the following two files should have contained some DNS info:

  • /var/spool/postfix/etc/resolv.conf
  • /etc/resolv.conf

I used dig to prove that I did not even have DNS lookup abilities. dig is a command-line tool for querying DNS name servers for information about host addresses, mail exchanges, name servers, and related information.

  • # get a list of yahoo's mail servers
    dig yahoo.com MX +noall +answer

In the end, I defined Google’s open DNS servers in the interfaces configuration file at /etc/network/interfaces: dns-nameservers 8.8.8.8 8.8.4.4 (ref : http://wiki.debian.org/NetworkConfiguration#Definingthe.28DNS.29Nameservers)

In the process, I learnt a lot about Postfix anti-spam config:

How to convert date format MM/DD/YYYY to YYYY/MM/DD using sed (Unix)

Damned Americans and their illogical data formats…trying to import a 100MB file into MySQL, and the date fields are in MM/DD/YYYY instead of the traditional YYYY/MM/DD that we all know and love…so I turned my hand to sed:

First, a quick test on the command line:

echo “MM/DD/YYYY” | sed -e “s_\(..\)\/\(..\)\/\(….\)_\3/\1/\2_”

=> YYYY/MM/DD

echo “textbeforeMM/DD/YYYYtextafter” | sed -e “s_\(..\)\/\(..\)\/\(….\)_\3/\1/\2_”

=>textbeforeYYYY/MM/DDtextafter

Then let’s let it loose on the file itself:

sed -e “s_\(..\)\/\(..\)\/\(….\)_\3/\1/\2_” test_in.csv > test_out.csv

Took a few seconds to run against a 100MB file ๐Ÿ™‚

Many thanks to Bruce Barnett for his Sed – An Introduction and Tutorial , an invaluable reference for a neophyte like me ๐Ÿ™‚

Installing Ubuntu Netbook on Acer Aspire One

I bought an Aspire One about a year ago, the intention being to surf and email from the comfort of my own sofa…so far, it’s been an unsatisfying experience due to the boot process freezing on startup if it’s previously died from lack of battery, and the interminable dropping of the wi-fi connection, not too mention the rather ridiculous Linpus operating system.

A year down the road, and I’m suddenly determined to turn this little thing into something useful, and after doing a little web-research, I’m going to attempt installing Ubuntu Network version onto my Acer Aspire One.

The starting point:

Acer Aspire One model AOA 150. Its an 8.9″ model with the Atom N270, 1GB RAM, and a 120GB hard drive, currently on the crappy BIOS version v0.3114, and the simplistic Linpus OS.

The process:

  1. First, I made sure the BIOS was up to date. There appear to be a lot of issues with the earlier version of the Aspire One BIOS, which I was still running. I followed macle’s excellent instructions, with the latest BIOS version v0.3310 downloaded from here
    • Failed at the first hurdle – turns out you need to make sure your USB drive does not have any spaces in it’s volume name….so, rename / remount…start again…
    • …Flash update successful – and yes, a quick system check shows that I’m now running with BIOS v0.3310 ๐Ÿ™‚
  2. Right, now to install Ubuntu Netbook
    1. Ok, an obvious step, but first I needed to download it – at 700MB, it took awhile, so I should really have downloaded this before I got started, to avoid thumb-twiddling….
    2. Then I had to root around for a 2GB-plus USB drive to copy Ubuntu onto, then followed Ubuntu’s instructions for creating a Ubuntu-bootable USB drive …which also took awhile..
    3. And finally, plugged in the USB stick into the Acer Aspire One, remembering to F12 to boot from the USB drive, and took Ubuntu for a test run…if I want to install it instead of run it off the USB, there’s a big fat “Install” button on the desktop…
  3. Things I’m going to keep an eye on
    1. Wireless connection
    2. Skype webcam – one main usage for my netbook is to Skype my kids in the UK, so it’s essential that the webcam works!
    3. Cisco VPN: sudo apt-get install network-manager-vpnc

Update: I managed about an hour before installing Ubuntu for good and wiping Linpus away for ever. My netbook has never been so happy!

This is a good reference for one man’s journey down this path.