From dada652f3e6f9cba9f396a8d5850c9a0ca1d80d6 Mon Sep 17 00:00:00 2001 From: Dimitrij Hilt Date: Tue, 8 Jan 2019 09:26:27 +0100 Subject: [PATCH] Add no_args parameter on defined own services to allow create also internal services without 'user= argv='. --- .kitchen.yml | 17 +++++++++++++++++ pillar.example | 3 +++ postfix/files/master.cf | 4 ++++ 3 files changed, 24 insertions(+) diff --git a/.kitchen.yml b/.kitchen.yml index 5d0a570..0d9788c 100644 --- a/.kitchen.yml +++ b/.kitchen.yml @@ -43,6 +43,23 @@ provisioner: postfix.sls: postfix: manage_master_config: True + master_config: + services: + relay1: + wrap: True + command: smtp + chroot: false + type: unix + extras: '-o smtp_bind_address=127.0.0.1 -o syslog_name=relay1' + no_args: True + relay2: + wrap: True + command: smtp + chroot: false + type: unix + extras: '-o smtp_bind_address=127.0.0.2 -o syslog_name=relay2' + no_args: True + verifier: name: inspec diff --git a/pillar.example b/pillar.example index 0653773..f1dc72a 100644 --- a/pillar.example +++ b/pillar.example @@ -45,6 +45,9 @@ postfix: user: mail # Wrap the output in master.cf at 78 chars for better readability wrap: True + # Avoid user and arvg settings to allow define internal processes + # needed for randomizing relay IP (randmap functionality) + no_args: True # Backwards compatible definition of dovecot delivery in master.cf enable_dovecot: False diff --git a/postfix/files/master.cf b/postfix/files/master.cf index 75f5bba..85ccd33 100644 --- a/postfix/files/master.cf +++ b/postfix/files/master.cf @@ -130,6 +130,9 @@ y service_param(service, service_name, 'wakeup'), service_param(service, service_name, 'maxproc'), service_param(service, service_name, 'command', service_name)) }} +{%- if 'no_args' in service -%} +{%- set parameter_str = "%s %s" | format(comment,service_param(service, service_name, 'extras', '')) -%} +{%- else -%} {%- if 'flags' in service or 'flags' in postfix_master_services.defaults[service_name] -%} {%- set parameter_str = "%s flags=%s user=%s argv=%s %s" | format(comment, service_param(service, service_name, 'flags'), @@ -142,6 +145,7 @@ y service_param(service, service_name, 'argv'), service_param(service, service_name, 'extras', '')) -%} {%- endif -%} +{%- endif -%}{# if 'no_args' in service #} {%- if wrap %} {{ parameter_str | wordwrap(width=wrap, break_long_words=False, wrapstring='\n%s ' | format(comment)) }} {%- else %}