I've never had much luck installing mail servers, they're just too complicated, and not something everyone installs, so the documentation is pretty thin. This was no exception as I spent much of Saturday trouble-shooting the mail system. I have a pretty unusual setup as well, which doesn't help things. Basically, I have an email gateway on servy that receives mail from the internet, and acts as a SMTP relay for my internal network. Mail that servy receives from the internet it forwards on to pal which acts as the main mail system, accessible from within the network with IMAP. Then pal also hosts two webmail apps, squirrel mail (webmail for nuts) and Open Exchange Community Edition.
The goal for the weekend was to transfer all of the mail system off of pal and onto the new mail server 'posty'. Ubuntu 10.10 comes with postfix and dovecot for SMTP server and IMAP server. The standard installation was filled with typing, and simply didn't work. Perhaps I mistyped something, or missed a step, or made some other mistake. In the end I simply focused on getting the SMTP server postfix to work, and finally got that to work simply by copying the configuration files from pal and doing a little editing.
SMTP and IMAP have a per user mail box, so posty needs to have home directories for each mail user. Currently the only people using the kamradtfamily.net email are me and my mom (and mom probably uses it because no one has told her she could just get a free gmail or yahoo mail account). Last weekend's project was to set up LDAP for authentication, so that was already available. I still had to set up posty to authenticate via LDAP. That was pretty straightforward using the instructions from my last post when I setup pearl to be LDAP authenticated. Once that was done, and I could logon as any of the users in my LDAP directory, I had to create home directories, by copying the /etc/skel directory to the /home directory with the users name. That is where the mail box will go (in the form of a Maildir directory).
I ended Saturday's fun by finally getting SMTP on posty to deliver an email to a mailbox, and looking at the mail that was delivered with cat. In order to simulate the actual routing, I updated the berkeley.local DNS on namer with an MX line, which says to what server mail with the address whatever@berkeley.local should be delivered to. Then I setup postfix on posty to have berkeley.local as one of the addresses it should be authorized to deliver. Then I sent an email from pal via squirrel mail to randysr@berkeley.local, and it was routed to servy, which relayed it back to posty as directed by the local DNS server, which accepted it and stuck it in my new mail box. Here's the full header (with email addresses slightly altered):
Return-Path: <randysr(AT)kamradtfamily.net>
X-Original-To: randysr(AT)berkeley.local
Delivered-To: randysr(AT)berkeley.local
Received: from localhost (localhost [127.0.0.1])
by posty (Postfix) with ESMTP id EA1AB2C094E
for <randysr(AT)berkeley.local>; Sat, 30 Oct 2010 17:22:13 -0700 (PDT)
X-Virus-Scanned: Debian amavisd-new at posty.berkeley.local
Received: from posty ([127.0.0.1])
by localhost (posty.berkeley.local [127.0.0.1]) (amavisd-new, port 10024)
with ESMTP id cNbHn6HkjuK1 for <randysr(AT)berkeley.local>;
Sat, 30 Oct 2010 17:21:30 -0700 (PDT)
Received: from servy (servy.berkeley.local [192.168.1.1])
by posty (Postfix) with ESMTPS id 902472C094B
for <randysr(AT)berkeley.local>; Sat, 30 Oct 2010 17:21:29 -0700 (PDT)
Received: from Pal (pal.berkeley.local [192.168.1.3])
by servy (Postfix) with ESMTP id 21AF21FDBB
for <randysr(AT)berkeley.local>; Sat, 30 Oct 2010 17:22:06 -0700 (PDT)
Received: from localhost (localhost [127.0.0.1])
by Pal (Postfix) with ESMTP id F07D2808002
for <randysr(AT)berkeley.local>; Sat, 30 Oct 2010 17:21:22 -0700 (PDT)
X-Virus-Scanned: Debian amavisd-new at kamradtfamily.net
Received: from Pal ([127.0.0.1])
by localhost (mail.kamradtfamily.net [127.0.0.1]) (amavisd-new, port 10024)
with ESMTP id gqpQi8C6sAVi for <randysr(AT)berkeley.local>;
Sat, 30 Oct 2010 17:21:20 -0700 (PDT)
Received: from [192.168.1.3] (localhost [127.0.0.1])
by Pal (Postfix) with ESMTP id A107F808001
for <randysr(AT)berkeley.local>; Sat, 30 Oct 2010 17:21:20 -0700 (PDT)
Received: from 192.168.1.1 (proxying for 131.191.87.73)
(SquirrelMail authenticated user randysr)
by 192.168.1.3 with HTTP;
Sat, 30 Oct 2010 17:21:20 -0700
Message-ID: <0e326e30d8386c0c9df3d6895539367d.squirrel@192.168.1.3>
Date: Sat, 30 Oct 2010 17:21:20 -0700
Subject: test
From: randysr(AT)kamradtfamily.net
To: randysr(AT)berkeley.local
User-Agent: SquirrelMail/1.4.20
MIME-Version: 1.0
Content-Type: text/plain;charset=iso-8859-1
Content-Transfer-Encoding: 8bit
X-Priority: 3 (Normal)
Importance: Normal
So that was about 10 hours just to get SMTP working. Time for a break with a few hours playing WoW.
Sunday I was still hopeful that I could get everything transfered to posty. I started by installing a basic dovecot system, after uninstalling the one I screwed up yesterday. I just need a IMAP server to allow my webapps to be able to access the mail boxes through a standard protocol. I'm not planning on exposing IMAP to the internet, so I wasn't too worried about security, since it would all be inside the firewall. I discovered that the standard apt-get command that installs and removes packages from ubuntu systems doesn't remove the configuration by default on a remove command. So after re-installing, my configuration was still hosed. Finally I found the --purge option for apt-get that will remove configuration (sort of a 'terminate with extreme prejudice' command for packages), and started with a fresh installation. Soon I had the evolution mail client on pal reading the IMAP servers on posty.
Next step the mail webapps, which would need to be installed on the new LAMP server, cloudy. Currently I use squirrelmail and open-exchange 6 as webmail on pal. I installed squirrel mail, and after I found the installation directory in /usr/share/squirrelmail instead of /usr/local/squirrelmail like the instructions say, I had it hooked up to apache and able to serve up mail. Open exchange is a little more complex, it has several layers that need to be set up, all via command line, so a fair amount of typing. I'm sure the commercial version is easier to setup, but I'm way too cheap to shell out money for it (and if I had to, I'm sure I'd just switch back to squirrel mail). The only thing is that after all this configuration, I didn't have the heart to tackle getting open exchange talking with LDAP, so I still need to configure users manually. That's a project for another weekend.
After getting the webapps installed an running at a basic level, I decided to take a break and go visit the tiger cubs at the point defiance zoo. I got there just in time for feeding java one of the big male tigers, who got a huge beef shank for lunch, which the wimpy zoo keeper could barely hurl across the moat.
Still to do for next weekend, the final move of mail from pal to posty. I will have to move both mailboxes on pal to posty, so the mail boxes are unchanged, export the contacts in ox6 over to posty, setup all users in ox6 on posty, and finally set servy to forward all mail to posty, and all webmail to cloudy.
No comments:
Post a Comment