The new format match the format proposed in the template-formula
BREAKING CHANGE: as all resources' IDs changed, other formulas
depending on this formula's resources will need to be modified
accordingly.
Moved maps generation to config, and added dependency on main.cf generation. Solves centos8 problems.
Signed-off-by: Felipe Zipitria <fzipitria@perceptyx.com>
Signed-off-by: Felipe Zipitria <fzipitria@perceptyx.com>
BREAKING CHANGE: `transport` and `tls_policy` keys in `postfix:config` have been moved to the standard `postfix:mapping`.
* Semi-automated using `ssf-formula` (v0.5.0)
* Fix (or ignore) errors shown below:
```bash
postfix-formula$ $(grep "\- yamllint" .travis.yml | sed -e "s:^\s\+-\s\(.*\):\1:")
./postfix/osfamilymap.yaml
1:1 warning missing document start "---" (document-start)
./postfix/services.yaml
11:1 warning missing document start "---" (document-start)
12:1 warning comment not indented like content (comments-indentation)
221:1 warning comment not indented like content (comments-indentation)
./postfix/defaults.yaml
4:1 warning missing document start "---" (document-start)
pillar.example
1:1 warning missing document start "---" (document-start)
2:25 warning truthy value should be one of [false, true] (truthy)
13:17 warning truthy value should be one of [false, true] (truthy)
16:17 warning truthy value should be one of [false, true] (truthy)
22:17 warning truthy value should be one of [false, true] (truthy)
23:17 warning truthy value should be one of [false, true] (truthy)
25:17 warning truthy value should be one of [false, true] (truthy)
29:17 warning truthy value should be one of [false, true] (truthy)
31:17 warning truthy value should be one of [false, true] (truthy)
35:17 warning truthy value should be one of [false, true] (truthy)
47:15 warning truthy value should be one of [false, true] (truthy)
50:18 warning truthy value should be one of [false, true] (truthy)
53:21 warning truthy value should be one of [false, true] (truthy)
62:24 warning truthy value should be one of [false, true] (truthy)
66:31 warning truthy value should be one of [false, true] (truthy)
69:19 warning truthy value should be one of [false, true] (truthy)
70:19 warning truthy value should be one of [false, true] (truthy)
73:14 warning truthy value should be one of [false, true] (truthy)
74:21 warning truthy value should be one of [false, true] (truthy)
78:14 warning truthy value should be one of [false, true] (truthy)
89:15 error trailing spaces (trailing-spaces)
96:6 warning missing starting space in comment (comments)
130:89 error line too long (105 > 88 characters) (line-length)
131:89 error line too long (101 > 88 characters) (line-length)
152:5 error duplication of key "sender_canonical_maps" in mapping (key-duplicates)
154:5 error duplication of key "virtual_alias_maps" in mapping (key-duplicates)
190:5 error duplication of key "use_file" in mapping (key-duplicates)
235:9 error wrong indentation: expected 10 but found 8 (indentation)
248:1 error duplication of key "postfix" in mapping (key-duplicates)
258:85 error trailing spaces (trailing-spaces)
```
The services definitions for master.cf were previously defined in
the services.jinja file.
This commit instead moves them into the services.yaml file, as we
should not require any jinja parsing inside the services definitions.
Drive-By: Add a .gitignore file
Drive-By: Set manage_master_config: True for kitchen. We do want to
verify that the master.cf file generation is actually working.
Drive-By: Add fedora-latest as a kitchen testing target, this helps
with verifying the os_family map testing that was added in
PR #79
Drive-By: Link to the kitchen-salt getting started guide in the README
http://www.postfix.org/DATABASE_README.html#types specifies the lookup
table types postfix understands.
Most are defined as type:/path/to/table which is currently supported
by the postfix formula.
This does break though as soon as the proxy table type is used which is
a prefix to a normal table definition to indicate caching is requested.
This PR changes the code to discard the proxy prefix to ensure that the
usual logic applies again.
Issue #68 raised a valid problem: The postfix formula is using
the osmap.yaml file incorrectly. It is being used to filter on
the os grain but should instead be filtering on os_family
to correctly account for Red Hat/CentOS similarities.
PR #69 did the fix in a complex way as it only moved parts of the os
mapping into the os_family mapping.
This is a much simpler fix, as it just renames the file and uses
it as a os_family map, which it actually is.
If we really need to differentiate between os flavors inside the
os_family at a later date, we can then add a lookup on the os grain.
No need to complicate manners now.
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.