Commit Graph

132 Commits

Author SHA1 Message Date
Felipe Zipitria
e3970dfc3e
feat(maps): add more map types and tests
Signed-off-by: Felipe Zipitria <fzipitria@perceptyx.com>
2020-07-18 17:00:13 -03:00
Holger Fischer
7584fce0af feat(config): run postmap also for regexp maps 2020-07-18 20:36:58 +02:00
Felipe Zipitria
a28bd05b85
fix(deps): fixes ordering where postmap requires sane main.cf
Moved maps generation to config, and added dependency on main.cf generation. Solves centos8 problems.

Signed-off-by: Felipe Zipitria <fzipitria@perceptyx.com>
2020-06-07 23:35:20 -03:00
Imran Iqbal
b20b7ec72d
Merge pull request #112 from Perceptyx/opensuse-fixes
fix(opensuse): fixes config files generation in opensuse
2020-06-08 00:48:08 +01:00
Felipe Zipitria
067bcf636f
fix(opensuse): fixes config files generation in opensuse
Signed-off-by: Felipe Zipitria <fzipitria@perceptyx.com>
2020-06-07 20:28:24 -03:00
Felipe Zipitría
e7856e054b
Merge pull request #107 from Perceptyx/fix-restrictions-defined-main-cf
fix(main): fix postconf warning when reloading/starting
2020-06-07 09:28:47 -03:00
Felipe Zipitria
04003c6ee3
fix(main): fix postconf warning when reloading/starting
Signed-off-by: Felipe Zipitria <fzipitria@perceptyx.com>
2020-06-06 19:26:18 -03:00
Felipe Zipitria
06276fd743
refactor(maps): move tls_policy and transport to mapping section
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`.
2020-06-06 19:17:46 -03:00
Felipe Zipitria
d87da4adc4 feat(maps): adds tls_policy map for smtp delivery
Signed-off-by: Felipe Zipitria <fzipitria@perceptyx.com>
2020-05-12 15:41:02 -03:00
Imran Iqbal
34a112faab
fix: make necessary modifications to get working on salt-ssh
* Similar situation to https://github.com/saltstack-formulas/logrotate-formula/pull/53
  - https://freenode.logbot.info/saltstack-formulas/20200507#c3819526-c3819581
  - https://freenode.logbot.info/saltstack-formulas/20200508#c3826763-c3826995
* Send template values by `context`
2020-05-08 09:40:10 +01:00
Imran Iqbal
b4fbac2934
feat(yamllint): include for this repo and apply rules throughout
* 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)
```
2019-08-15 00:07:07 +01:00
Alexander Weidinger
75358e03e0 fix(service): restart service on package change
This also provides an ID to be used in a watch_in statement.
2019-07-25 22:15:57 +02:00
Alexander Weidinger
fbaa2dcabb main.cf: ignore only actually used keys of 'postfix:mapping'; fixes #89 2019-04-24 12:38:55 +02:00
Alexander Weidinger
c432ae23dc mapping.j2: fixed handling of OrderedDict in Python 3 2019-04-09 20:06:16 +02:00
Dimitrij Hilt
dada652f3e Add no_args parameter on defined own services to allow create also
internal services without 'user= argv='.
2019-01-08 09:26:27 +01:00
Niels Abspoel
1da803467f
Merge pull request #80 from bawuenet/proxy_map_support
Fix table type for proxy tables
2018-10-21 00:34:45 +02:00
Niels Abspoel
8f1126039b
Merge pull request #81 from bawuenet/services_yaml
Improve services definitions
2018-10-21 00:33:15 +02:00
Mark Gomersbach
ae83e2d2a8
Specify dovecot_deliver for Gentoo, solves #84 2018-10-10 02:56:30 +02:00
Andreas Thienemann
fb69881dde Improve services definitions
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
2018-10-08 12:28:01 +02:00
Andreas Thienemann
9281c79aec Fix table type for proxy tables
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.
2018-10-07 13:48:13 +02:00
Niels Abspoel
d2896ea148
Merge pull request #78 from bawuenet/more_services_next_iteration
Further improvements on extra services configured in master.cf
2018-10-05 10:55:02 +02:00
Andreas Thienemann
f5d9a0e95d Rework of PR #69 to fix Issue #68
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.
2018-10-04 16:53:30 +02:00
Andreas Thienemann
e4b507b0b5 Further improvements on extra services configured in master.cf
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.
2018-10-04 05:02:57 +02:00
Niels Abspoel
ca6b26e3ed
Merge pull request #75 from bawuenet/more_services
More pillar managed services
2018-10-01 22:49:54 +02:00
Andreas Thienemann
36f0a70813 Improve handling of multiple values in main.cf
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 }
2018-09-29 03:55:38 +02:00
Andreas Thienemann
1b9ac1eb4e More pillar managed services
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
2018-09-26 21:52:02 -07:00
Andreas Thienemann
44210a1fe8 Reload postfix service by default.
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.
2018-09-26 17:33:14 -07:00
Niels Abspoel
3ded29687e
Merge pull request #73 from Perceptyx/master
Force batch in FreeBSD
2018-09-25 20:54:58 +02:00
Andre Sencioles
e40c589cd5 Fix duplicated mapping parameters on main.cf
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.
2018-08-29 15:34:31 +12:00
Felipe Zipitria
7ede7609f7 Force batch in FreeBSD 2018-07-24 14:38:10 +01:00
Benjamin DUPUIS
fe261fc635 add inet_protocols 2018-07-09 11:32:16 +02:00
Alexander Weidinger
0c489c03df master.cf: submission: CSV must not use blank
Would produce: "fatal: unexpected command-line argument: nameofsetting,"
2018-04-04 11:34:34 +02:00
Javier Bértoli
47ffa7d173 Fix xbin_prefix parameter, add managed by Salt headers 2018-03-18 14:08:45 -03:00
Andreas Thienemann
b6b7ab4cca Allow for full managed master.cf services
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.
2018-03-11 19:22:12 +01:00
N
5579ebcef6
Merge branch 'master' into add_mysql_query_to_virtual 2018-03-08 09:40:09 +00:00
Niels Abspoel
f30071afd2 replace iteritems with items 2018-03-07 21:17:57 +01:00
Alexander Weidinger
f4a10a2843 re-enable Pillar postfix:aliases:content 2017-12-28 21:42:23 +01:00
Alexander Weidinger
014c5227bc Let the user handle mappings manually 2017-12-08 14:53:58 +01:00
Alexander Weidinger
caee184158 master.cf: added dovecot 2017-12-08 14:04:35 +01:00
Alexander Weidinger
4c7c2a269d master.cf: made submission configurable 2017-12-08 13:20:01 +01:00
Alexander Weidinger
ae878da8fa Use defaults.yaml and osmap.yaml 2017-12-08 12:12:56 +01:00
Florian Ermisch
9ed99927c2 explain what the colon in mapping.j2 is for 2017-08-25 14:54:20 +02:00
Florian Ermisch
f514881e5a explain the difference between alias_maps and alias_database 2017-08-24 13:35:24 +02:00
Florian Ermisch
c60c3bab6f adjust processed_parameters to match pillar.example 2017-08-24 13:25:38 +02:00
Florian Ermisch
8eed254773 one for-loop for all of the mappings 2017-08-24 13:10:54 +02:00
Florian Ermisch
136e02a61c check for absolute file_paths for maps 2017-08-24 13:03:22 +02:00
Florian Ermisch
d51f60647a add optional context variable "colon" to mapping.j2 for aliases file 2017-08-24 13:03:10 +02:00
Florian Ermisch
099d84ab73 Template paths and groups to make them work on FreeBSD, too. 2017-08-24 13:02:46 +02:00
Florian Ermisch
af5e9f8862 Add FreeBSD to map.jinja; root_grp, xbin_prefix to defaults.yaml
Accidentally already added config_path in the last commit, not
redoing it again.
2017-08-24 11:27:43 +02:00
Florian Ermisch
f30c63f9ed Import map.jinja+defaults.yaml structure from salt-formula
Now using the `deep_merge()` macro so we can move the
values which are identical on most distributions from
`map.jinja` to `defaults.yaml`.
2017-08-24 11:21:48 +02:00