Chris Green:
> On Wed, Feb 10, 2021 at 03:14:11PM +0100, Matus UHLAR - fantomas wrote:
> > On 10.02.21 13:57, Chris Green wrote:
> > > It would be really handy if I could get postfix to use the value
> > > returned by the dnsdomainname command for its mydomain value as I
> > > could then use the same main.cf file in several headless 'send only'
> > > systems where postfix is used solely for sending error messages from
> > > cron and similar.
> > >
> > > There isn't an 'include' type directive in postfix configuration so I
> > > can't see any way of doing this by capturing the output of
> > > dnsdomainname at startup and then including this in main.cf.
> > >
> > > Has anyone else wanted to do anything like this and come up with a
> > > solution?
> >
> >
> > the default is get from your myhostname, can't you set up that one?
> >
> > btw are you sure you dont mean myorigin instead of mydomain?
> >
> Apart from the TLS/SASL bits the main.cf for all these headless
> systems is:-
>
> mydomain = zbmc.eu
> myorigin = $mydomain
> relayhost = [mail.gandi.net]:465
> luser_relay = [email protected]
> local_recipient_maps =
> #
> #
> # We don't accept any incoming connections
> #
> mydestination =
> inet_interfaces = loopback-only
>
> So myhostname isn't explicitly set.
>
> Having 'mydomain = zbmc.eu' worked until now because the systems in
> question were on a LAN which is zbmc.eu. However I'd now rather like
> to use the same main.cf on some systems which aren't on the same LAN.
> It does need to be set so that one can tell easily where messages come
> from.
First, there is no requirement to SET myhostname. Postfix uses the SYSTEM
HOSTNAME by default. Postfix will automatically append $mydomain
if the SYSTEM HOSTNAME is not in FQDN form.
Second, please don't run sed on main.cf or master.cf. Use postconf
commands instead.
For example:
postconf "myhostname = $(dnsdomainname)"
postfix start
Not all the world is LINUX, and most systems get along with the
defaults just fine.
Wietse