Wietse Venema:
> Geert Stappers:
> > So I'm also curious if there is a "syntax checker"
> > that reports missing files.
> 
> How would a program know that a string 'foobar' is a file reference
> 1) in main.cf or master.cf
> 2) in a file that is referenced by 1)
> 3) in a file that is referenced by a file that is referenced by 1)
> 4) and so on.
> 
> Answer: in many cases the only program that knows if 'foobar' is a
> file reference is the program that uses 'foobar' as a file reference.
> 
> For a Postfix configuration checker to answer your question, I see
> two options.
> 
> 1) In the configuration checker, duplicate all the parts of all
> programs that understand file references. Code duplication is
> undesirable because it makes Postfix more difficult to change.
> 
> 2) In the configuration checker, ask every Postfix program to "check"
> the file references that it knows about.  Part of this involves
> starting up the Postfix mail server and running all daemons with a
> special option, so that each daemon opens all databases, all files,
> and all sockets, and then terminates without causing permanent side
> effects other than logging some warnings.
> 
> The second option makes the most sense because it can reuse the
> existing code in each daemon program that opens databases as that
> daemon starts to execute. In the case of the SMTP daemon, that
> includes database references in smtpd_mumble_restrictions.  But
> this trick cannot check pathnames in non-Postfix programs such as
> those executed by the spawn(8) or pipe(8) daemons.
> 
> I do not expect that this option will be implemented soon. It will
> likely be a multi-year project, just like the effort to make the
> postconf command understand master.cf, and to make it complain about
> unknown parameter names.

A first result looks promising. I hacked up Postfix code so that
"postfix check" runs each Postfix daemon with a special option.
With this the daemon initializes as usual (opening databases etc.)
and terminates before it would start talking to a client.

Then, I mangled the alias_maps setting in main.cf, and ran "postfix
check". As expected the local daemon complains:

    # postfix check
    local: fatal: open database /etc/aliasesx.db: No such file or directory

Normally, this "problem" would not be "discovered" until the local
daemon tries to deliver email, but now we can find it earlier with
"postfix check". That is an improvement.

However, I also got some error messages from a master.cf service
that I never use: the virtual daemon complained that virtual_mailbox_base
was not set:

    virtual: fatal: bad string length 0 < 1: virtual_mailbox_base = 

This is a problem. The virtual daemon is enabled by default in
master.cf since more than 10 years, and we can't suddenly have
Postfix failing to start because 'postfix check' fails.

        Wietse

Reply via email to