From 06276fd7431e1675795be95c0c8ebb01772ea740 Mon Sep 17 00:00:00 2001 From: Felipe Zipitria Date: Sat, 23 May 2020 18:47:54 -0300 Subject: [PATCH] refactor(maps): move tls_policy and transport to mapping section Signed-off-by: Felipe Zipitria BREAKING CHANGE: `transport` and `tls_policy` keys in `postfix:config` have been moved to the standard `postfix:mapping`. --- pillar.example | 15 +++++++------- postfix/config.sls | 42 ---------------------------------------- postfix/files/tls_policy | 17 ---------------- postfix/files/transport | 17 ---------------- 4 files changed, 8 insertions(+), 83 deletions(-) delete mode 100644 postfix/files/tls_policy delete mode 100644 postfix/files/transport diff --git a/pillar.example b/pillar.example index d00faa3..2c97be7 100644 --- a/pillar.example +++ b/pillar.example @@ -122,6 +122,7 @@ postfix: local_transport: virtual local_recipient_maps: $virtual_mailbox_maps + # Use the `mapping` key to define the map transport_maps: hash:/etc/postfix/transport # SMTP server @@ -163,13 +164,6 @@ postfix: relay_recipient_maps: hash:/etc/postfix/relay_domains virtual_alias_maps: hash:/etc/postfix/virtual - transport: - DOMAIN_NAME: ':[IP_ADDRESS]' - - tls_policy: - example.com: encrypt - .example.com: encrypt - vmail: user: postfix_user password: DB_PASSWD @@ -234,6 +228,13 @@ postfix: -----END RSA PRIVATE KEY----- mapping: + transport_maps: + - DOMAIN_NAME: ':[IP_ADDRESS]' + + smpt_tls_policy_maps: + - example.com: encrypt + - .example.com: encrypt + smtp_sasl_password_maps: - smtp.example.com: myaccount:somepassword diff --git a/postfix/config.sls b/postfix/config.sls index 97aa6d5..d2f92a3 100644 --- a/postfix/config.sls +++ b/postfix/config.sls @@ -80,48 +80,6 @@ include: postfix_master_services: {{ postfix_master_services|tojson }} {% endif %} -{% if 'transport' in pillar.get('postfix', '') %} -{{ postfix.config_path }}/transport: - file.managed: - - source: salt://postfix/files/transport - - user: root - - group: {{ postfix.root_grp }} - - mode: 644 - - require: - - pkg: postfix - - watch_in: - - service: postfix - - template: jinja - -run-postmap: - cmd.wait: - - name: {{ postfix.xbin_prefix }}/sbin/postmap {{ postfix.config_path }}/transport - - cwd: / - - watch: - - file: {{ postfix.config_path }}/transport -{% endif %} - -{% if 'tls_policy' in pillar.get('postfix', '') %} -{{ postfix.config_path }}/tls_policy: - file.managed: - - source: salt://postfix/files/tls_policy - - user: root - - group: {{ postfix.root_grp }} - - mode: 644 - - require: - - pkg: postfix - - watch_in: - - service: postfix - - template: jinja - -run-postmap-tls-policy: - cmd.wait: - - name: {{ postfix.xbin_prefix }}/sbin/postmap {{ postfix.config_path }}/tls_policy - - cwd: / - - watch: - - file: {{ postfix.config_path }}/tls_policy -{% endif %} - {%- for domain in salt['pillar.get']('postfix:certificates', {}).keys() %} postfix_{{ domain }}_ssl_certificate: diff --git a/postfix/files/tls_policy b/postfix/files/tls_policy deleted file mode 100644 index 8830c22..0000000 --- a/postfix/files/tls_policy +++ /dev/null @@ -1,17 +0,0 @@ -# -# This file is managed by salt -# - -{% set config = salt['pillar.get']('postfix:tls_policy', {}) -%} -{% macro set_parameter(parameter, default=None) -%} -{% set value = config.get(parameter, default) -%} -{% if value is not none -%} -{{ parameter }} {{ value }} -{% endif -%} -{% endmacro -%} - -{# Accept arbitrary parameters -#} -{% for parameter in config -%} -{{ set_parameter(parameter) }} -{% endfor -%} - diff --git a/postfix/files/transport b/postfix/files/transport deleted file mode 100644 index 8db7092..0000000 --- a/postfix/files/transport +++ /dev/null @@ -1,17 +0,0 @@ -# -# This file is managed by salt -# - -{% set config = salt['pillar.get']('postfix:transport', {}) -%} -{% macro set_parameter(parameter, default=None) -%} -{% set value = config.get(parameter, default) -%} -{% if value is not none -%} -{{ parameter }} {{ value }} -{% endif -%} -{% endmacro -%} - -{# Accept arbitrary parameters -#} -{% for parameter in config -%} -{{ set_parameter(parameter) }} -{% endfor -%} -