As promised in PR #75, here's a further (and hopefully final)
iteration of the master.cf service handling:
- Bring dovecot and policyd-spf configuration in line with the
extras_services item added in PR #75
- Remove policyd-spf configuration again from services.jinja,
handle this in master.cf instead, where it was before
- Allow for completely custom services to be added via a pillar
definition in postfix:master_config:services
- Fix legacy dovecot argv example in pillar.example: The example
showed the extra_args being defined as part of the argv
parameter, something that would clash with the actual code and
result in a duplicate '-d ${recipient}' definition in the config.
In case a list of items (iterable) is passed to the set_parameter
function in main.cf, the list of items are joined by a comma.
This makes parameters with many items a bit hard to read as it
results in long lines.
Postfix also supports an alternative declaration where subsequent
parameter values are written in a new line that starts with whitespace
and thus forms a continuation of the previous line.
This makes parsing multiple entry lines easier for humans.
Old style:
smtpd_milters = { unix:/run/spamass-milter/postfix/sock, connect_timeout=10s, default_action=accept } { inet:localhost:10003, connect_timeout=10s, default_action=accept } { inet:localhost:10004, connect_timeout=10s, default_action=accept } { inet:localhost:10006, connect_timeout=10s, default_action=accept } { inet:localhost:10007, connect_timeout=10s, default_action=accept }
New style:
smtpd_milters = { unix:/run/spamass-milter/postfix/sock, connect_timeout=10s, default_action=accept }
{ inet:localhost:10003, connect_timeout=10s, default_action=accept }
{ inet:localhost:10004, connect_timeout=10s, default_action=accept }
{ inet:localhost:10006, connect_timeout=10s, default_action=accept }
{ inet:localhost:10007, connect_timeout=10s, default_action=accept }
Most of the services in master.cf were already configurable through
the formula but specific ones such as cyrus or uucp were not managed
yet.
This commit adds functionality to manage these services as well
through pillar variables, e.g.:
postfix:
master_config:
services:
uucp:
enable: True
The postfix service is currently being restarted whenever a
config item changes.
This is unnecessary as the postfix service can reload a new
config.
Set reload: True to prevent unnecessary restarts of the service.
The old behavior can be restored by setting the pillar key
reload_service to False.
Fixes the creation of duplicated parameters on main.cf by using the
"set_parameter" macro to append the mapping parameter to the
"processed_parameters" list.
Currently master.cf only allows for _very_ limited configuration
options mainly focussed on SMTP submission settings.
This is rather limited and does not scale very well for managing
the other services defined in master.cf.
This patch has moved all the service definitions into a jinja file
and generates the master.cf service definition on the fly based on
these defaults.
Defaults can be overridden in a pillar to customize the rendered
master.cf file accordingly to local needs.
Undefined values will be filled with the postfix defaults.
Care has been taken that the previous ways of managing the submission
configuration options are still supported for backwards compatibility
to prevent breakage for existing users of the formula.