saltstack-formulas / postfix-formula

http://docs.saltstack.com/en/latest/topics/development/conventions/formulas.html
Other
25 stars 130 forks source link

en-/disable domain in mydestination #53

Open kossmac opened 7 years ago

kossmac commented 7 years ago

If I setup a server with hostname subdomain.example.com example.com is configured in postfix' mydestination so that every mail addressed to someone@example.com is sent to local postfix.

aboe76 commented 7 years ago

@kossmac why do this?

isn't it possible to just set mydestination in pillar to achieve the same thing

postfix:
  config:
    mydestination: subdomain.example.com, localhost, localhost.localcomain
kossmac commented 7 years ago

yes, you're right, but i do have to write redundant pillar data to every system i manage

EvaSDK commented 7 years ago

Maybe you can make it generic with jinja like:

postfix:
  config:
    mydestination: {{ grains.id.split('.')[1:]|join('.') }}, localhost, localhost.localdomain

This is something I use for some email address rewriting to avoid this copy/paste as well.

alxwr commented 5 years ago

@kossmac @aboe76 @EvaSDK I'm closing this due to inactivity. Please re-open if you still want to see the PR merged. Thanks for your effort!

cp-richard commented 5 years ago

This should be re-opened

We just noticed this issue on a system that just happened to need to send to `something@[hostdomain]

Normally systems with default postfix config are just setup to get mail out to some monitoring address for cron failures, etc, and that's usually a 3rd party address from the managed system, so we only noticed it now.

I can't think of a good reason why the 'default' handling needs to be {{ set_parameter('mydestination', [grains['fqdn'], 'localhost', 'localhost.localdomain', grains['domain']]) }}

If the server is going to be a full SMTP Inbound system, you are probably going to have a much deeper pillar configuration. I can't think of a good reason why the 'default' unconfigured state should have the grains['domain'] in there.

The Postfix defaults (from the manual) are : $myhostname, localhost.$mydomain, localhost

One should have to go out of their way to set a value different than the postfix default, with this formula.

alxwr commented 5 years ago

@kti-richard Your are raising a good point. :-)

I'd rather drop include_domain_in_mydestination: True and the domain at the end of mydestination and go with the Postfix default. If someone is using something different, she can always set mydestination in Pillar.

@aboe76 @kossmac @EvaSDK What are your thoughts on this?

cp-richard commented 5 years ago

Our team would be happy with @alxwr 's recommendation of just following the postfix default. Do we need a new PR for this ?

alxwr commented 5 years ago

@kti-richard I'd do it myself, but haven't got the time to do it. Please submit a PR! :-)