From 067bcf636face6b3a3cb40418758641354ac2402 Mon Sep 17 00:00:00 2001 From: Felipe Zipitria Date: Sun, 7 Jun 2020 18:53:00 -0300 Subject: [PATCH] fix(opensuse): fixes config files generation in opensuse Signed-off-by: Felipe Zipitria --- postfix/defaults.yaml | 2 ++ postfix/files/main.cf | 5 +++++ postfix/init.sls | 15 ++++++++++++++- postfix/osfamilymap.yaml | 7 +++++++ 4 files changed, 28 insertions(+), 1 deletion(-) diff --git a/postfix/defaults.yaml b/postfix/defaults.yaml index 3c7b8d9..a0011b4 100644 --- a/postfix/defaults.yaml +++ b/postfix/defaults.yaml @@ -8,6 +8,8 @@ postfix: postsrsd_pkg: postsrsd postgrey_pkg: postgrey root_grp: root + setgid_group: postdrop + daemon_directory: /usr/libexec/postfix service: postfix xbin_prefix: /usr dovecot_deliver: /usr/lib/dovecot/deliver diff --git a/postfix/files/main.cf b/postfix/files/main.cf index ae9d35b..487fa75 100644 --- a/postfix/files/main.cf +++ b/postfix/files/main.cf @@ -39,6 +39,11 @@ {{ set_parameter('readme_directory', 'no') }} +# Apply default setgid_group +{{ set_parameter('setgid_group', postfix.setgid_group) }} +# Set daemon directory +{{ set_parameter('daemon_directory', postfix.daemon_directory) }} + {%- set relay_restrictions = ['permit_mynetworks'] %} {%- set recipient_restrictions = ['permit_mynetworks'] %} diff --git a/postfix/init.sls b/postfix/init.sls index 6a8321d..c178200 100644 --- a/postfix/init.sls +++ b/postfix/init.sls @@ -1,9 +1,22 @@ {% from "postfix/map.jinja" import postfix with context %} +{%- if grains.os_family == "Suse" %} +# The existence of this file prevents the system to +# overwrite files from salt when installing. +/var/adm/postfix.configured: + file.managed: + - contents: '' + - mode: '0644' + - user: 'root' + - group: 'root' + - require_in: + - pkg: postfix +{%- endif %} + postfix: pkg.installed: - name: {{ postfix.package }} -{%- if grains['os_family']=="FreeBSD" %} +{%- if grains.os_family == "FreeBSD" %} - force: True - batch: True {%- endif %} diff --git a/postfix/osfamilymap.yaml b/postfix/osfamilymap.yaml index 3779c78..4a762b0 100644 --- a/postfix/osfamilymap.yaml +++ b/postfix/osfamilymap.yaml @@ -3,11 +3,13 @@ --- Arch: policyd_spf_pkg: python-postfix-policyd-spf + daemon_directory: /usr/lib/postfix/bin Debian: policyd_spf_pkg: postfix-policyd-spf-python pcre_pkg: postfix-pcre mysql_pkg: postfix-mysql + daemon_directory: /usr/lib/postfix/sbin FreeBSD: policyd_spf_pkg: py27-postfix-policyd-spf-python @@ -15,6 +17,7 @@ FreeBSD: xbin_prefix: /usr/local config_path: /usr/local/etc/postfix root_grp: wheel + daemon_directory: /usr/local/libexec/postfix dovecot_deliver: /usr/local/libexec/dovecot/deliver Gentoo: @@ -27,3 +30,7 @@ Gentoo: RedHat: policyd_spf_pkg: pypolicyd-spf + +Suse: + setgid_group: maildrop + daemon_directory: /usr/lib/postfix/bin