r/postfix: Support rewriting recipient addresses

The *postfix* role will now generate configuration and a lookup table
for [canonical address mapping][0] of email recipients.  To configure
the mapping, the `postfix_recipient_canonical_map` must be a dictionary
of source-target addresses, e.g.:

```yaml
postfix_recipient_canonical_map:
  my.bad.email@fake.test: my.real.email@example.com
```

[0]: https://www.postfix.org/ADDRESS_REWRITING_README.html#canonical
This commit is contained in:
2024-08-22 16:10:20 -05:00
parent d7a271de20
commit 0e46599fbc
5 changed files with 23 additions and 0 deletions

View File

@@ -30,6 +30,19 @@
- rehash postfix sasl passwd table
- reload postfix
- name: ensure postfix recipient canonical map is configured
template:
src: canonical_map.j2
dest: /etc/postfix/recipient_canonical
mode: u=rw,go=r
owner: root
group: root
setype: postfix_etc_t
vars:
postfix_canonical: '{{ postfix_recipient_canonical_map }}'
notify:
- rehash postfix recipient canonical map
- name: ensure postfix is configured
template:
src=main.cf.j2