Skip to content

Commit a28bd05

Browse files
author
Felipe Zipitria
committed
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 <[email protected]>
1 parent 273caf9 commit a28bd05

File tree

6 files changed

+50
-223
lines changed

6 files changed

+50
-223
lines changed

docs/README.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ Installs and starts postfix SMTP server
5353
``postfix.config``
5454
^^^^^^^^^^^^^^^^^^
5555

56-
Manages postfix main.cf and optionally the master.cf configuration file
56+
Manages postfix main.cf and optionally the master.cf configuration file. Generates mappings.
5757

5858
``postfix.policyd-spf``
5959
^^^^^^^^^^^^^^^^^^^^^^^

postfix/config.sls

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,3 +101,49 @@ postfix_{{ domain }}_ssl_key:
101101
- service: postfix
102102
103103
{% endfor %}
104+
105+
# manage various mappings
106+
{% for mapping, data in salt['pillar.get']('postfix:mapping', {}).items() %}
107+
{%- set need_postmap = False %}
108+
{%- set file_path = salt['pillar.get']('postfix:config:' ~ mapping) %}
109+
{%- if file_path.startswith('proxy:') %}
110+
{#- Discard the proxy:-prefix #}
111+
{%- set _, file_type, file_path = file_path.split(':') %}
112+
{%- elif ':' in file_path %}
113+
{%- set file_type, file_path = file_path.split(':') %}
114+
{%- else %}
115+
{%- set file_type = default_database_type %}
116+
{%- endif %}
117+
{%- if not file_path.startswith('/') %}
118+
{%- set file_path = postfix.config_path ~ '/' ~ file_path %}
119+
{%- endif %}
120+
{%- if file_type in ("btree", "cdb", "dbm", "hash", "sdbm") %}
121+
{%- set need_postmap = True %}
122+
{%- endif %}
123+
postfix_{{ mapping }}:
124+
file.managed:
125+
- name: {{ file_path }}
126+
- source: salt://postfix/files/mapping.j2
127+
- user: root
128+
- group: {{ postfix.root_grp }}
129+
{%- if mapping.endswith('_sasl_password_maps') %}
130+
- mode: 600
131+
{%- else %}
132+
- mode: 644
133+
{%- endif %}
134+
- template: jinja
135+
- context:
136+
data: {{ data|json() }}
137+
- require:
138+
- pkg: postfix
139+
- file: {{ postfix.config_path }}/main.cf
140+
{%- if need_postmap %}
141+
cmd.wait:
142+
- name: {{ postfix.xbin_prefix }}/sbin/postmap {{ file_path }}
143+
- cwd: /
144+
- watch:
145+
- file: {{ file_path }}
146+
- watch_in:
147+
- service: postfix
148+
{%- endif %}
149+
{% endfor %}

postfix/init.sls

Lines changed: 0 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -94,48 +94,3 @@ postfix_alias_absent_{{ user }}:
9494
{%- endfor %}
9595
{% endif %}
9696
{% endif %}
97-
98-
# manage various mappings
99-
{% for mapping, data in salt['pillar.get']('postfix:mapping', {}).items() %}
100-
{%- set need_postmap = False %}
101-
{%- set file_path = salt['pillar.get']('postfix:config:' ~ mapping) %}
102-
{%- if file_path.startswith('proxy:') %}
103-
{#- Discard the proxy:-prefix #}
104-
{%- set _, file_type, file_path = file_path.split(':') %}
105-
{%- elif ':' in file_path %}
106-
{%- set file_type, file_path = file_path.split(':') %}
107-
{%- else %}
108-
{%- set file_type = default_database_type %}
109-
{%- endif %}
110-
{%- if not file_path.startswith('/') %}
111-
{%- set file_path = postfix.config_path ~ '/' ~ file_path %}
112-
{%- endif %}
113-
{%- if file_type in ("btree", "cdb", "dbm", "hash", "sdbm") %}
114-
{%- set need_postmap = True %}
115-
{%- endif %}
116-
postfix_{{ mapping }}:
117-
file.managed:
118-
- name: {{ file_path }}
119-
- source: salt://postfix/files/mapping.j2
120-
- user: root
121-
- group: {{ postfix.root_grp }}
122-
{%- if mapping.endswith('_sasl_password_maps') %}
123-
- mode: 600
124-
{%- else %}
125-
- mode: 644
126-
{%- endif %}
127-
- template: jinja
128-
- context:
129-
data: {{ data|json() }}
130-
- require:
131-
- pkg: postfix
132-
{%- if need_postmap %}
133-
cmd.wait:
134-
- name: {{ postfix.xbin_prefix }}/sbin/postmap {{ file_path }}
135-
- cwd: /
136-
- watch:
137-
- file: {{ file_path }}
138-
- watch_in:
139-
- service: postfix
140-
{%- endif %}
141-
{% endfor %}

test/integration/default/controls/postfix_mysql.rb

Lines changed: 0 additions & 9 deletions
This file was deleted.

test/salt/pillar/default.sls

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,16 @@ postfix:
1111
smtp:
1212
# Limit to no more than 10 smtp processes
1313
maxproc: 10
14-
# Enable oldstyle TLS wrapped SMTP
14+
# Disable oldstyle TLS wrapped SMTP
1515
smtps:
16-
enable: true
16+
enable: false
1717
# Enable submission service on port 587/tcp with custom options
1818
submission:
1919
enable: true
2020
args:
2121
- "-o smtpd_tls_security_level=encrypt"
2222
- "-o smtpd_sasl_auth_enable=yes"
23-
- "-o smtpd_client_restrictions: permit_sasl_authenticated,reject"
23+
- "-o smtpd_client_restrictions=permit_sasl_authenticated,reject"
2424
tlsproxy:
2525
enable: true
2626
chroot: true

test/salt/pillar/postgrey.sls

Lines changed: 0 additions & 165 deletions
This file was deleted.

0 commit comments

Comments
 (0)