Postfix and aliases

Scott Kitterman ubuntu at kitterman.com
Tue Jan 9 01:23:15 UTC 2007


On Monday 08 January 2007 18:24, Gary Hodges wrote:
> On 1/8/07, Scott Kitterman <ubuntu at kitterman.com> wrote:
> > On Monday 08 January 2007 15:32, Gary Hodges wrote:
> > > Thank you for your reply.
> > >
> > > On 1/8/07, John Mark Walker <johnmark at johnmark.org> wrote:
> > > > On 1/8/07, Gary Hodges <fsunoles at gmail.com> wrote:
> > > > > Kubuntu 6.10 AMD64
> > > > >
> > > > > I have the following in /etc/aliases
> > > > >
> > > > > testalias:      valid.address at address.com
> > > > >
> > > > > If I issue the command:
> > > > > <nail -s "subject" -r valid.address at address.com testalias>
> > > > > and then send the mail it bounces on recipient
> > > > > testalias at address.com
> > > > >
> > > > > The following works:
> > > > > <nail -s "subject" valid.address at address.com>
> > > > >
> > > > > I've run "sudo newaliases"
> > > > >
> > > > > >sudo postconf -d | grep aliases
> > > > >
> > > > > alias_database = hash:/etc/aliases
> > > > > alias_maps = hash:/etc/aliases, nis:mail.aliases
> > > > > newaliases_path = /usr/bin/newaliases
> > > >
> > > > Are you sure your /etc/aliases.db and /etc/aliases files have the
> > > > same data?
> > > >
> > > > "ls -l /etc/aliases*"
> > > >
> > > > I know you ran newaliases, but it doesn't hurt to make sure the
> > > > changes "took". Look at the date stamp on those files.

newaliases should work just fine, but postalias is, I think better.  If you 
look at the man pages you'll see there are some subtle differences.  I don't 
think that has anything to do with what's going on now.

> > > ~>ls -l /etc/aliases*
> > > -rw-r--r-- 1 root root   338 2007-01-08 12:54 /etc/aliases
> > > -rw-r--r-- 1 root root 12288 2007-01-08 13:19 /etc/aliases.db
> > >
> > > > Also, instead of grepping for "aliases" try grepping for just "alias"
> > > > and see what "allow_mail_to_commands" and "allow_mail_to_files" are
> > > > set to.
> > >
> > > ~>sudo postconf -d | grep alias
> > > alias_database = hash:/etc/aliases
> > > alias_maps = hash:/etc/aliases, nis:mail.aliases
> > > allow_mail_to_commands = alias, forward
> > > allow_mail_to_files = alias, forward
> > >
> > > > And finally, if you don't include the "-r <mail address>" in your
> > > > mail command, does it still not work? Have you tried other methods of
> > > > sending mail to your alias address? It's been awhile since I really
> > > > looked into the "mail" command, so I can't recall what "-r" means -
> > > > reply-to?
> > >
> > > The -r sets the reply-to address as you guessed.  If I leave it out I
> > > get nothing.  I'm setting the reply-to address to my regular work
> > > address and that is how I see the bounce.  If I run Mail locally it
> > > says I have no mail.  I've tried Mail, mail and nail to send to the
> > > alias address with no luck.
> > >
> > > Best my lay person self can gather, it doesn't appear the alias
> > > address (the key) is being resolved to the real address (the value).
> > >
> > > Another clue?  If simply mail myself on the local machine I don't get
> > > a mail, but if I mail a valid outside address it works.
> >
> > The answer almost certainly lies in your logs.  Please send the full
> > postconf -n (if you anonymize information, please make it clear where you
> > are doing so) and relevant entries from /var/log/mail.log to the list and
> > I'll help you figure it out.
>
> Thank you for your willingness to dig into this.  FWIW, this is a
> generic AMD64 install so maybe there is a config bug somewhere.
>
> ~>sudo postconf -n
> Password:
> alias_database = hash:/etc/aliases
> alias_maps = hash:/etc/aliases
> append_dot_mydomain = no
> biff = no
> config_directory = /etc/postfix
> inet_interfaces = all
> inet_protocols = all
> mailbox_size_limit = 0
> mydestination = space, localhost.localdomain, , localhost
> myhostname = space
> mynetworks = 127.0.0.0/8
> myorigin = /etc/mailname
> recipient_delimiter = +
> relayhost =
> smtp_tls_session_cache_database = btree:${queue_directory}/smtp_scache
> smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
> smtpd_tls_cert_file = /etc/ssl/certs/ssl-cert-snakeoil.pem
> smtpd_tls_key_file = /etc/ssl/private/ssl-cert-snakeoil.key
> smtpd_tls_session_cache_database = btree:${queue_directory}/smtpd_scache
> smtpd_use_tls = yes

That all looks reasonable.

> /var/log/mail.log output of an attempt to send to an alias.
> "~>nail -s "subject"  testalias"
> I changed the username and name of the machine.
>
> Jan  8 16:17:40 foo postfix/pickup[8236]: 17F7C54961: uid=1000 from=<gary>
> Jan  8 16:17:40 foo postfix/cleanup[8278]: 17F7C54961:
> message-id=<20070108231740.17F7C54961 at foo>
> Jan  8 16:17:40 foo postfix/qmgr[5146]: 17F7C54961:
> from=<gary at foo.srrb.noaa.gov>, size=421, nrcpt=1 (queue active)
> Jan  8 16:17:40 foo postfix/smtp[8280]: 17F7C54961:
> to=<testalias at foo.srrb.noaa.gov>, orig_to=<testalias>, relay=none,
> delay=0.01, delays=0.01/0/0/0, dsn=5.4.6, status=bounced (mail for
> foo.srrb.noaa.gov loops back to myself)

You can see here that your alias is working:

to=<testalias at foo.srrb.noaa.gov>, orig_to=<testalias>

This line also shows your problem:

mail for foo.srrb.noaa.gov loops back to myself

> Jan  8 16:17:40 foo postfix/cleanup[8278]: 1B18954962:
> message-id=<20070108231740.1B18954962 at foo>
> Jan  8 16:17:40 foo postfix/qmgr[5146]: 1B18954962: from=<>,
> size=2174, nrcpt=1 (queue active)
> Jan  8 16:17:40 foo postfix/bounce[8281]: 17F7C54961: sender
> non-delivery notification: 1B18954962
> Jan  8 16:17:40 foo postfix/qmgr[5146]: 17F7C54961: removed
> Jan  8 16:17:40 foo postfix/smtp[8280]: 1B18954962:
> to=<gary at foo.srrb.noaa.gov>, relay=none, delay=0.01, delays=0/0/0/0,
> dsn=5.4.6, status=bounced (mail for foo.srrb.noaa.gov loops back to
> myself)

And then this is the bounce.

> Jan  8 16:17:40 foo postfix/qmgr[5146]: 1B18954962: removed

So, you need to figure out why the mail is looping.

Scott K




More information about the ubuntu-users mailing list