1

I have postfix v2.6.6 running on CentOS 6.3, hostname priest.ocsl.local (private, internal domain) with a number of aliases

supportpeople: user1@ocsl.co.uk, user2@ocsl.co.uk, user3@ocsl.co.uk
requests: "|/opt/rt4/bin/rt-mailgate --queue 'general' --action  correspond --url http://localhost/", supportpeople
help: "|/opt/rt4/bin/rt-mailgate --queue 'help' --action correspond --url http://localhost/", supportpeople

If I leave postfix with its default configuration, then the aliases are resolved correctly/as I expect, so that incoming mail to, say, rt@ocsl.co.uk will be piped through the rt-mailgate mailgate command and also be delivered (via the mail server for ocsl.co.uk (a publicly resolvable domain)) to user1@ocsl.co.uk, user2, etc.

The problem comes when I define mydomain = ocsl.co.uk in /etc/postfix/main.cf (with the intention that outgoing mail come from, for example, help@ocsl.co.uk). When I do this, postfix continues to run the piped command correctly, however it no longer expands the nested aliases as I expect: instead of trying to deliver to user1@ocsl.co.uk, user2 etc, it tries to send to supportpeople@ocsl.co.uk, which does not exist on the upstream mail server and generates NDRs. postconf -n for the non-working configuration follows (the working configuration differs only by the "mydomain" line.

alias_database = hash:/etc/aliases
alias_maps = hash:/etc/aliases
command_directory = /usr/sbin
config_directory = /etc/postfix
daemon_directory = /usr/libexec/postfix
data_directory = /var/lib/postfix
debug_peer_level = 2
html_directory = no
inet_interfaces = all
inet_protocols = all
mail_owner = postfix
mailq_path = /usr/bin/mailq.postfix
manpage_directory = /usr/share/man
mydestination = $myhostname, localhost.$mydomain, localhost
mydomain = ocsl.co.uk
newaliases_path = /usr/bin/newaliases.postfix
queue_directory = /var/spool/postfix
readme_directory = /usr/share/doc/postfix-2.6.6/README_FILES
sample_directory = /usr/share/doc/postfix-2.6.6/samples
sendmail_path = /usr/sbin/sendmail.postfix
setgid_group = postdrop
unknown_local_recipient_reject_code = 550

We did have things working as we expected/wanted previously on an older system running Sendmail.

Norky
  • 849
  • 4
  • 14

1 Answers1

1

The supportpeople values do not have a domain part in your $alias_maps, thus Postfix appends $mydomain to them (because of $append_dot_mydomain). With mydomain = ocsl.co.uk Postfix expands supportpeople to supportpeople@ocls.co.uk and tries to route the mail to the MX for that domain. To avoid that, change the right-hand supportpeople values to a full address for which your Postfix is the final destination, e.g. supportpeople@localhost.

Besides, for changing the sender address you'd use $myorigin, not $mydomain.

Ansgar Wiechers
  • 4,197
  • 2
  • 17
  • 26
  • I thought $myorigin was by default, set to $mydomain. Obviously it affects others things too. – Norky Oct 09 '12 at 08:11
  • Thank you @Angsar, setting the alias destination to supportpeople@ocls.co.uk made things work as I wanted. – Norky Oct 09 '12 at 08:35
  • The above is incorrect. $mydomain is never appended to localparts, it is appended to *bare hostnames*. *$myorigin* is appended to bare locaparts if **append_at_myorigin** is set. – adaptr Oct 09 '12 at 08:36
  • @adaptr Hmm... weird. I re-checked and it turns out you're right. However, the OP's setup should have worked then even with `mydomain = ocls.co.uk`, since `$myorigin` defaults to `$myhostname`, which is a final destination according to his config. – Ansgar Wiechers Oct 09 '12 at 17:31
  • 1
    mydomain != myhostname != myorigin – adaptr Oct 11 '12 at 08:25
  • @adaptr Yes, I'm aware of that. What are you trying to tell me? – Ansgar Wiechers Oct 11 '12 at 08:54
  • "Should have worked with mydomain because myorigin=myhostname" is incorrect. mydomain != myhostname, they are NOT related unless you make them so. – adaptr Oct 11 '12 at 09:16
  • @adaptr I suggest you take a look at the output of `postconf -d myorigin` (or the [documentation](http://www.postfix.org/postconf.5.html#myorigin)). `myorigin` **does** default to `myhostname`, and my comment did not imply any kind of relation for `mydomain`. – Ansgar Wiechers Oct 11 '12 at 11:37
  • Yes, it did imply exactly that, and while the *default* for mydomain is myhostname minus the local part, that's rarely the case in general. It doesn't really matter but I would prefer if you kept the advice strictly to the documented behaviour :) – adaptr Oct 12 '12 at 10:26
  • @adaptr The default for `$myorigin` is `$mydestination`, the default for `$append_at_myorigin` is `yes` (as documented). `postconf -n` did not show a non-default value for `$myorigin` or `append_at_mydomain`, so the defaults apply. In that case setting `mydomain = ocls.co.uk` should **not** have had any effect on mail-routing for the alias `supportpeople`, because it would have been expanded to `supportpeople@$myhostname`, and `$myhostname` is listed in `$mydestination`. Nothing else was implied by my comment from 2 days ago. – Ansgar Wiechers Oct 12 '12 at 11:46