January 23rd, 2010
Due to recent hosting troubles I had to quickly deploy a backup MX for my primary mail server. This was quickly achieved using a VPS hosted by the Swedish webhost GleSys.
But since my customers needed to be able to read and reply to emails while the primary site was down, I couldn’t just let the backup system keep the incoming email in the queue and deliver them once the primary sit was up. I decided to deliver the emails locally but also keep a copy of all emails that passed through the system.
These archived emails were to be re-delivered once the primary site was up again, and here’s how I did it, step by step.
- Set up a VPS for the backup MX host.
- Set up the system using the same guide I used for the primary site, which was the great ISPmail tutorial by Christoph Haas.
- Added the option always_bcc to the Postfix config, pointing it to a new local mailbox.
- Once the primary server was up again, I set up getmail like this:
-
[retriever]
type = SimplePOP3Retriever
server = hostname_of_backup_mx
username = username_of_backup_account
password = secret
[destination]
type = MDA_external
arguments = ("-i", "-bm", "-t")
[options]
verbose = 2
Running getmailrc quickly restored all the emails on the primary host. Remember not to run it multiple times since the default is to re-download already processed messages.
The downsides of this setup:
- Deleted emails (like spam) are seen again by the users. POP users will receive duplicates of already retrieved messages. IMAP users will however have a mailbox which includes both old messages and the ones delivered to the backup server.
- The spam filter wasn’t used in delivery process. I realize this could be achieved with fetchmail (which includes the SMTP delivery option that getmail lacks) but I decided to use getmail anyway.
I realize there might be prettier solutions to the original problem (BOTH delivering emails locally and keeping them in a queue for a primary MX), but I couldn’t find out how and this proved to be a pretty solid solution. Feel free to suggest better ways to solve the problem!
Tags: getmail, postfix
Posted in Howto, Linux | No Comments »
August 29th, 2008
Windows XP might be fully cooperative if you want to connect to two different Samba shares on the same machine, using different user names. Here’s how to solve it.
Posted in Windows | No Comments »
June 20th, 2008
I visit Wikipedia and Last.fm several times daily, but recently grew tired of doing manual searches by editing the URL:s in my browser history. Adding the sites to the Firefox search bar was easy (especially with the great Mycroft service), but the downside was the extra step added by the search result page.
Since I usually know exactly what I’m looking for, I wanted to be able to go directly to a certain page when entering a search term, instead of searching for the term.
This is how you modify Firefox to behave that way:
- Add the search engines to Firefox through Mycroft or the official Add-on repository.
- Close Firefox.
- On XP, enter the directory
C:\Documents and Settings\YOURUSERNAME\Application Data\Mozilla\Firefox\Profiles\YOURPROFILE\searchplugins
- Open the xml files in a text editor.
- For Wikipedia, you need to change the following line
<os:Url type="text/html" method="GET" template="http://en.wikipedia.org/wiki/{searchTerms}&sourceid=mozilla-search">
into this:
<os:Url type="text/html" method="GET" template="http://en.wikipedia.org/wiki/{searchTerms}">
- I.e., change the URL so that it points straight at the article instead of the search function.
Tags: firefox, wikipedia
Posted in Computer related bits & pieces | No Comments »
December 13th, 2007
I recently installed Google’s Picasa, and even though I ultimately decided to use Photoshop Elements, I really liked the Picasa screen saver. It lets you display random images from multiple folders, and has some pretty nifty transition effects. Much better than the XP “My pictures” screen saver.
I was quite annoyed but the Google logos displayed every now and then on top of my pictures, and decided to try to remove them. It wasn’t hard, here’s how I did it.
- Install a resource editing program, such as the XN Resource Editor.
- Open up the Picasa installation folder and make a backup of the file Picasa2.scr, just in case you want to switch back to the branded screen saver again.
- Start the XN Resource Editor and open the file Picasa2.scr.
- Locate the two JPEG resources in the resource tree, in my case it was 111 and 114 (this might differ between different versions of the screen saver).
- Right-click on the resources and choose “Delete Resource”.
- Save the file.
- Done! The Google logos have now been removed from the screen saver!
A little tip: The same screen saver (atleast AFAIK) is available in the Google Pack, in case you don’t want to install the full Picasa suite. It’s called “Google Photos Screensaver”, but seems to be the same program that they bundle with Picasa.
Tags: google, picasa
Posted in Windows | 1 Comment »
December 12th, 2007
If you’re using the Mozilla Thunderbird extension Lightning for your calendar, here’s a quick howto on making it synchronize with your Sony Ericsson phone. It worked great on my W910!
- Install the excellent freeware program MyPhoneExplorer.
- Enter the Options (F2), choose Sync and then choose Thunderbird Lightning in the “Calendar” field.
- MyPhoneExplorer will automatically install the required Thunderbird plugin.
- Click on “Advanced” to choose which calendar to sync and what mode (merge calendars or let phone override Lightning or vice versa)
- Hit Ok, enter the Calendar and hit sync – done!
If you want to create a desktop shortcut to automatically start the sync – duplicate the shortcut to MyPhoneExplorer, enter the icon properties and add “action=sync syncitem=organizer” to the destination (after myphoneexplorer.exe). There are more command line options available in the English FAQ.
Hope this howto helps someone, it sure made my life a lot easier! Before I discovered this method, I was auto-exporting the calendar as an ICS file (through a dedicated Thunderbird extension) and then importing in manually into MyPhoneExplorer on a regular basis. Now I only need to connect the USB cable and click the dedicated shortcut – quite an improvement!
Tags: lightning, sony ericsson, thunderbird
Posted in Windows | 3 Comments »
October 9th, 2007
Getting Windows XP to remember the password for mounted network folders can be a real hassle, but here’s some help. I’m not sure if this is a Samba-specific problem or not, but it has happened to me several times now on both Windows 2000 and XP machines.
- Try using the “Manage my network passwords” window (accessed through the “User accounts” applet in the control panel)
- If that didn’t help:
- Make sure to enter the server name in the username box, example: MACHINE\username
- Try entering the IP address of the server instead of the host name (worked for me when everything else failed).
Tags: samba
Posted in Linux, Windows | No Comments »
December 16th, 2006
Guestbooks, as well as all public forms on the WWW, are constantly abused nowadays by spam bots trying to fill them with spam links. In the guestbook for my band, I had a ratio of 1/10 – about 9 spams for every valid post. Here are the spam filtering techniques I implemented that worked for me:
- First, a black list. I have an array with bad words (viagria, cialis, roulette, casino) which are common in spam posts and quite uncommon in valid guestbook entries. Every post is checked against the black list. The black list also contains a few URL:s that are often used by spammers (blogspot.com and hometown.aol.com) as well as the tag [url= which is probably BBcode.
- Link spamming. A quick check is made on the number of http:// links, if it’s above 5 – well, it’s most probably a spam!
- Cookie test. This is something I picked up on a mailing list a few weeks ago, and it works brilliantly. The idea is that spam bots aren’t valid browsers, they just look for forms and submit them. The trick is to set a cookie when the form is displayed, and then check for the existance of that cookie when the form is received, before it’s saved. If there’s no cookie – the post isn’t saved! This stops people with cookies disabled from entering posts, but it stops a LOT of spam.
BTW, here’s my entire black list as of today:
levitra,viagra,cialis,porn,roulette,casino,hometown.aol.com,blogspot.com,[url=
Tags: spam
Posted in Web development | 2 Comments »
December 8th, 2006
There seems to be a hard-coded maximum size for images uploaded in WordPress 2.0 – images larger than 3 Mpixels aren’t resized into thumbnails for some odd reason (maybe not to stress the web server?).
If you think your web host has enough horse power to resize large images, go ahead and modify line 89 in wp-admin/inline-uploading.php and change the number three to something higher:
if ( $imagedata['width'] * $imagedata['height'] < 3 * 1024 * 1024 ) {
This should be added to the WordPress Codex.
Tags: wordpress
Posted in PHP | No Comments »
October 4th, 2006
After restoring a maildir based mailbox from a backup, the user in question experienced some odd errors from SquirrelMail. When opening the inbox, the error “unknown response from server” was displayed by SquirrelMail.
I moved all files from the inbox to a temporary directory and started moving the back a few at a time, to isolate which emails that caused the problem. After about an hour of investigation, I noticed that there were a few duplicates with the same size and almost the same name. The only thing that differed was the Maildir “flags” after the comma.
The reason was probably that the user was viewing his mailbox while the backup was being restored, causing some files to be renamed and thus creating duplicates. The IMAP server (Courier in this case) was apparently confused by multiple files with the same timestamp but with different flags, and dropped the connection to SquirrelMail.
To isolate the duplicates, I used ls -1 and cut:
/bin/ls -1|cut -d "," -f 1|uniq -c|sort -n
Then I removed the duplicates, which were the files with file count > 2 in the list produced by ls.
Posted in Linux | No Comments »
May 18th, 2006
I’ve been plagued by comment spam in this weblog for a month or two now, and today I got really tired of deleting 3-4 spam comments every day.
When I investigated the originating IP:s, I noticed that all spam except ONE came from one of four C-nets. I quickly decided to block in the .htaccess file in the weblog directory.
Here’s what I added.
# DIE, SPAMBOTS, DIE!
order allow,deny
deny from 208.66.193
deny from 64.62.22
deny from 81.177.14
deny from 81.177.15
allow from all
I’m willing to take the very small risk that a valid user from one of these IP:s won’t be allowed to enter my weblog.
(Yes, I know that I could install a WordPress plugin, but this was quicker and less cumbersome. )
Posted in Linux | No Comments »