Boston Linux & Unix (BLU) Home | Calendar | Mail Lists | List Archives | Desktop SIG | Hardware Hacking SIG
Wiki | Flickr | PicasaWeb | Video | Maps & Directions | Installfests | Keysignings
Linux Cafe | Meeting Notes | Linux Links | Bling | About BLU

BLU Discuss list archive


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

SOLVED setting up mail forwarding/address rewriting for a home network



About six weeks ago, I posted this question to the discuss list:

> I have three machines at home (horse-nettle, petunia, and eggplant),
> all running Linux and sendmail.  I also have a domain (ropine.com),
> and an ISP (shore.net) providing virtual hosting and a POP box; one
> of
> my machines (horse-nettle) connects to that ISP with a modem and
> PPP....
>
> ....what I want is for horse-nettle to properly forward all of my
> mail
> to petunia, and for me to be able to send mail from petunia to the
> rest of the Net, and for that mail to get its return address
> properly
> rewritten to [whoever]@ropine.com.

A few people emailed me saying they were interested in solving the
same problem, so I figure I might as well post the solution that I
discovered.

First, you know how everyone says that sendmail configuration is a
sysadmin's nightmare?  Everyone is right.  I finally uninstalled
sendmail and installed postfix.  (I should have read the postfix
documentation before uninstalling sendmail, though.  The proper way to
do this is to rename some of the sendmail links, install postfix,
clear out sendmail's mail queue, *and then* uninstall sendmail.)

Then, after perusing the postfix documentation, I tweaked
/etc/postfix/main.cf on the gateway machine (horse-nettle) and the
client machines (eggplant and petunia) in slightly different ways,
like so:

[on horse-nettle]
*** main.cf Fri Jan 28 09:44:47 2000
--- /etc/postfix/main.cf Mon Sep  4 18:51:07 2000
***************
*** 52,57 ****
--- 52,58 ----
  #
  #myhostname = host.domain.name
  #myhostname = virtual.domain.name
+ myhostname = horse-nettle.ropine.com

  # The mydomain parameter specifies the local internet domain name.
  # The default is to use $myhostname minus the first component.
***************
*** 59,64 ****
--- 60,66 ----
  # parameters.
  #
  #mydomain = domain.name
+ mydomain = ropine.com

  # SENDING MAIL
  #
***************
*** 71,76 ****
--- 73,79 ----
  #
  #myorigin = $myhostname
  #myorigin = $mydomain
+ myorigin = $mydomain

  # RECEIVING MAIL

***************
*** 111,116 ****
--- 114,120 ----
  #mydestination = $myhostname, localhost.$mydomain $mydomain
  #mydestination = $myhostname, localhost.$mydomain, $mydomain,
  # mail.$mydomain, www.$mydomain, ftp.$mydomain
+ mydestination = $myhostname, localhost.$mydomain, $mydomain

  # REJECTING UNKNOWN LOCAL USERS
  #
***************
*** 137,147 ****
--- 141,155 ----
  #
  # Insert text from sample-canonical.cf if you need to do address
  # rewriting, or if you need username->Firstname.Lastname mapping.
+ append_at_myorigin = yes
+ empty_address_recipient = MAILER-DAEMON
+ masquerade_domains = $mydomain

  # ADDRESS REDIRECTION (VIRTUAL DOMAIN)
  #
  # Insert text from sample-virtual.cf if you need virtual domain
support.

+
  # "USER HAS MOVED" BOUNCE MESSAGES
  #
  # Insert text from sample-relocated.cf if you need "user has moved"
***************
*** 171,176 ****
--- 179,185 ----
  #alias_maps = hash:/etc/aliases
  #alias_maps = hash:/etc/aliases, nis:mail.aliases
  #alias_maps = netinfo:/aliases
+ alias_maps = hash:/etc/aliases

  # The alias_database parameter specifies the alias database(s) that
  # are built with "newaliases" or "sendmail -bi".  This is a separate

***************
*** 181,186 ****
--- 190,196 ----
  #alias_database = dbm:/etc/mail/aliases
  #alias_database = hash:/etc/aliases
  #alias_database = hash:/etc/aliases, hash:/opt/majordomo/aliases
+ alias_database = hash:/etc/aliases

  # ADDRESS EXTENSIONS (e.g., user+foo)
  #
***************
*** 209,214 ****
--- 219,225 ----
  #
  # mail_spool_directory = /var/mail
  # mail_spool_directory = /var/spool/mail
+ mail_spool_directory = /var/spool/mail

  # The mailbox_command parameter specifies the optional external
  # command to use instead of mailbox delivery. The command is run as
***************
*** 321,326 ****
--- 332,338 ----
  #
  #mynetworks = 168.100.189.0/28, 127.0.0.0/8
  #mynetworks = $config_directory/mynetworks
+ mynetworks = 192.168.1.0/24

  # SHOW SOFTWARE VERSION OR NOT
  #
***************
*** 379,381 ****
--- 391,397 ----
    xxgdb $daemon_directory/$process_name $process_id & sleep 5

  # Other configurable parameters.
+ disable_dns_lookups = yes
+ relayhost = relay.shore.net
+ defer_transports = smtp
+ transport_maps = hash:/etc/postfix/transport

[on petunia]
*** main.cf~ Mon Sep  4 14:23:39 2000
--- main.cf Mon Sep  4 18:26:11 2000
***************
*** 52,57 ****
--- 52,58 ----
  #
  #myhostname = host.domain.name
  #myhostname = virtual.domain.name
+ myhostname = petunia.ropine.com

  # The mydomain parameter specifies the local internet domain name.
  # The default is to use $myhostname minus the first component.
***************
*** 59,64 ****
--- 60,66 ----
  # parameters.
  #
  #mydomain = domain.name
+ mydomain = ropine.com

  # SENDING MAIL
  #
***************
*** 71,76 ****
--- 73,79 ----
  #
  #myorigin = $myhostname
  #myorigin = $mydomain
+ myorigin = $mydomain

  # RECEIVING MAIL

***************
*** 111,116 ****
--- 114,120 ----
  #mydestination = $myhostname, localhost.$mydomain $mydomain
  #mydestination = $myhostname, localhost.$mydomain, $mydomain,
  # mail.$mydomain, www.$mydomain, ftp.$mydomain
+ mydestination = $myhostname, localhost.$mydomain

  # REJECTING UNKNOWN LOCAL USERS
  #
***************
*** 134,139 ****
--- 138,149 ----
  #
  # Insert text from sample-rewrite.cf if you need to do address
  # masquerading.
+ append_at_myorigin = yes
+ empty_address_recipient = MAILER-DAEMON
+ # the FAQ says masquerade_domains is only for the gateway machine
+ # masquerade_domains = $mydomain
+
+
  #
  # Insert text from sample-canonical.cf if you need to do address
  # rewriting, or if you need username->Firstname.Lastname mapping.
***************
*** 171,176 ****
--- 181,187 ----
  #alias_maps = hash:/etc/aliases
  #alias_maps = hash:/etc/aliases, nis:mail.aliases
  #alias_maps = netinfo:/aliases
+ alias_maps = hash:/etc/aliases

  # The alias_database parameter specifies the alias database(s) that
  # are built with "newaliases" or "sendmail -bi".  This is a separate

***************
*** 181,186 ****
--- 192,198 ----
  #alias_database = dbm:/etc/mail/aliases
  #alias_database = hash:/etc/aliases
  #alias_database = hash:/etc/aliases, hash:/opt/majordomo/aliases
+ alias_database = hash:/etc/aliases

  # ADDRESS EXTENSIONS (e.g., user+foo)
  #
***************
*** 209,214 ****
--- 221,227 ----
  #
  # mail_spool_directory = /var/mail
  # mail_spool_directory = /var/spool/mail
+ mail_spool_directory = /var/spool/mail

  # The mailbox_command parameter specifies the optional external
  # command to use instead of mailbox delivery. The command is run as
***************
*** 321,326 ****
--- 334,340 ----
  #
  #mynetworks = 168.100.189.0/28, 127.0.0.0/8
  #mynetworks = $config_directory/mynetworks
+ mynetworks = 192.168.1.0/24

  # SHOW SOFTWARE VERSION OR NOT
  #
***************
*** 379,381 ****
--- 393,398 ----
    xxgdb $daemon_directory/$process_name $process_id & sleep 5

  # Other configurable parameters.
+
+ relayhost = [horse-nettle.ropine.com]
+ disable_dns_lookups = yes
\ No newline at end of file

Note the brackets in [horse-nettle.ropine.com] -- this tells postfix
to not try doing a DNS lookup for horse-nettle.  I think I also used
the brackets in my /etc/aliases file, but I don't remember and I
forgot to forward that to my work account.  (Is that notation peculiar
to postfix, or does sendmail also treat bracketed hostnames that way?
That might explain some of the trouble I was having with sendmail
before I finally gave up on it....)

--
"The big dig might come in handy ... for a few project managers
 whom I think would make great landfill."  --Elaine Ashton
== seth gordon == sgordon at kenan.com == standard disclaimer ==
== documentation group, kenan systems corp., cambridge, ma ==


-
Subcription/unsubscription/info requests: send e-mail with
"subscribe", "unsubscribe", or "info" on the first line of the
message body to discuss-request at blu.org (Subject line is ignored).




BLU is a member of BostonUserGroups
BLU is a member of BostonUserGroups
We also thank MIT for the use of their facilities.

Valid HTML 4.01! Valid CSS!



Boston Linux & Unix / webmaster@blu.org