File tree Expand file tree Collapse file tree 3 files changed +43
-0
lines changed Expand file tree Collapse file tree 3 files changed +43
-0
lines changed Original file line number Diff line number Diff line change @@ -156,6 +156,7 @@ postfix:
156156 smtp_use_tls : ' yes'
157157 smtp_tls_cert_file : /etc/postfix/ssl/example.com-relay-client-cert.crt
158158 smtp_tls_key_file : /etc/postfix/ssl/example.com-relay-client-cert.key
159+ smtp_tls_policy_maps : hash:/etc/postfix/tls_policy
159160
160161 smtp_sasl_password_maps : hash:/etc/postfix/sasl_passwd
161162 sender_canonical_maps : hash:/etc/postfix/sender_canonical
@@ -165,6 +166,10 @@ postfix:
165166 transport :
166167 DOMAIN_NAME : ' :[IP_ADDRESS]'
167168
169+ tls_policy :
170+ example.com : encrypt
171+ .example.com : encrypt
172+
168173 vmail :
169174 user : postfix_user
170175 password : DB_PASSWD
Original file line number Diff line number Diff line change @@ -101,6 +101,27 @@ run-postmap:
101101 - file : {{ postfix.config_path }}/ transport
102102{% endif % }
103103
104+ {% if ' tls_policy' in pillar.get(' postfix' , ' ' ) % }
105+ {{ postfix.config_path }}/ tls_policy:
106+ file .managed:
107+ - source: salt:// postfix/ files/ tls_policy
108+ - user: root
109+ - group: {{ postfix.root_grp }}
110+ - mode: 644
111+ - require:
112+ - pkg: postfix
113+ - watch_in:
114+ - service: postfix
115+ - template: jinja
116+
117+ run- postmap- tls- policy:
118+ cmd.wait:
119+ - name: {{ postfix.xbin_prefix }}/ sbin/ postmap {{ postfix.config_path }}/ tls_policy
120+ - cwd: /
121+ - watch:
122+ - file : {{ postfix.config_path }}/ tls_policy
123+ {% endif % }
124+
104125{%- for domain in salt[' pillar.get' ](' postfix:certificates' , {}).keys() % }
105126
106127postfix_{{ domain }}_ssl_certificate:
Original file line number Diff line number Diff line change 1+ #
2+ # This file is managed by salt
3+ #
4+
5+ {% set config = salt['pillar.get']('postfix:tls_policy', {}) -%}
6+ {% macro set_parameter(parameter, default=None) -%}
7+ {% set value = config.get(parameter, default) -%}
8+ {% if value is not none -%}
9+ {{ parameter }} {{ value }}
10+ {% endif -%}
11+ {% endmacro -%}
12+
13+ {# Accept arbitrary parameters -#}
14+ {% for parameter in config -%}
15+ {{ set_parameter(parameter) }}
16+ {% endfor -%}
17+
You can’t perform that action at this time.
0 commit comments