domain (especially email) hosting from home

Bill Mullen moon at lunarhub.com
Fri Jul 15 14:22:01 EDT 2005


On Fri, 2005-07-15 at 08:06, Paul Lussier wrote:
> Greg Rundlett <greg.rundlett at gmail.com> writes:
> 
> > I receive my email through rundlett.com, and a healthy dose of spam
> > through freephile.com; both of which are externally hosted through a
> > web hosting provider that includes email service and easy-to-manage
> > web-based administration of user accounts/aliases/forwards and even
> > lists.  How would I go about moving those services to my local machine
> > (offering email accounts to family too) with the least amount of
> > hassle and worry?
> 
> It should be a matter of just changing your MX records to point to
> your new mail server[1].  Of course, if you're using DynDNS.org[2], be
> forewarned, that you can't use your own domain name unless you pay
> them for services.

Common MX gotcha: Ensure that the hostname to which the MX records point
is defined as an A record, and not a CNAME one. I use a free subdomain
from no-ip.com, which is conveniently updated by my SmoothWall system in
those rare cases when my IP address changes. I also use that as the mail
server's Postfix hostname, which doesn't have to match the actual FQDN
of the box itself (in this case, one which does not resolve externally).

Example:

Set up an auto-updateable "A" record with a dynamic DNS provider (the
"ez-ipupdate" client supports several of them). Let's say that you go
with no-ip.com, and the name you get from them is "freephile.sytes.net".

Set the MX record for each one of your *.com domains to point to
"freephile.sytes.net". Configure Postfix's primary configuration file,
"/etc/postfix/main.cf", thusly:

myhostname = freephile.sytes.net  # how Postfix will identify itself
mydomain = rundlett.lan   # or whatever you're using locally
myorigin = rundlett.com   # the default DN for addresses without one
mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain,
realhostname.$mydomain, rundlett.com, freephile.com
# this postulates "realhostname.rundlett.lan" as the system's FQDN

[snip]
> [2] Be aware that as soon as you start hosting your own e-mail and
>     probably using your own MTA to send mail from, you'll start
>     getting rejection messages from the MTAs of domains you connect to
>     which blacklist dynamic IP addresses.  For example, anone you send
>     to at an aol.com account will require you relay through an MTA
>     with a static address.

Two ways to do this with Postfix:

1) Globally (all outbound mail is routed via your ISP's SMTP server).

/etc/postfix/main.cf:
relayhost = [smtp.comcast.net] # your ISP's SMTP server, in brackets

2) Case-by-case (most outbound mail is delivered directly, mail to
specific domains is routed via your ISP's server).

/etc/postfix/main.cf:
#relayhost =        # leave undefined
transport_maps = hash:/etc/postfix/transport

/etc/postfix/transport (create this file, if necessary):

aol.com		smtp:[smtp.comcast.net]
.aol.com	smtp:[smtp.comcast.net]
*		:

The first two entries define domains that go via your ISP ("*@aol.com"
and "*@*.aol.com", respectively); other such domains should follow that
pattern, and should come before the final entry, which is a catchall.
After creating or altering the transport file, you'll need to run
"postmap /etc/postfix/transport", and then run "postfix reload".

Aliases go into the /etc/postfix/aliases file; after changing it, run
"newaliases", then run "postfix reload". Be sure to set a destination
for mail addressed to "root" in there - it should point to a real user.

Common Postfix gotcha: On many distros, Postfix is configured by default
to run in a chroot jail; on Mandr{ake,iva} systems, this will be in the
"/var/spool/postfix" dir. You will find an "etc/" dir within it, which
contains copies of certain /etc/ files (hosts, resolv.conf) that the
chrooted daemon needs to be able to access. Ensure that after updating
any of the original files (the ones in /etc/), you then copy those new
versions into $CHROOT/etc/ and run "postfix reload".

As for the MailScanner stuff to which Bill referred, I use amavisd-new
to link in SpamAssassin and ClamAV with Postfix, and it works quite
well. The Mandr* RPM for amavisd-new makes the requisite changes in the
"/etc/postfix/master.cf" file for you, which is a real hassle-saver. ;)

HTH!

-- 
Bill Mullen
RLU# 270075




More information about the gnhlug-discuss mailing list