From 04f97681eb5bb35f0cd72f759a222ebc3e87431f Mon Sep 17 00:00:00 2001 From: Gilles Dartiguelongue Date: Sat, 22 Aug 2015 13:26:26 +0200 Subject: [PATCH] Handle postgrey setup in main.cf --- pillar.example | 4 ++++ postfix/files/main.cf | 7 +++++++ 2 files changed, 11 insertions(+) diff --git a/pillar.example b/pillar.example index 5217977..4886062 100644 --- a/pillar.example +++ b/pillar.example @@ -3,6 +3,10 @@ postfix: master_config: enable_submission: False + postgrey: + enabled: True + location: inet:172.16.0.5:6379 + config: smtpd_banner: $myhostname ESMTP $mail_name biff: 'no' diff --git a/postfix/files/main.cf b/postfix/files/main.cf index ae61bed..da420d2 100644 --- a/postfix/files/main.cf +++ b/postfix/files/main.cf @@ -59,6 +59,13 @@ {{ set_parameter('message_size_limit', '41943040') }} {{ set_parameter('smtpd_relay_restrictions', ['permit_mynetworks', 'permit_sasl_authenticated', 'defer_unauth_destination']) }} +{% set recipient_restrictions = ['permit_mynetworks', 'permit_sasl_authenticated', 'reject_unauth_destination'] %} +{% set postgrey_config = salt['pillar.get']('postfix:postgrey', {}) %} +{% if postgrey_config.get('enabled', False) %} +{% set recipient_restrictions = recipient_restrictions + ['check_policy_service ' ~ postgrey_config.get('location', 'inet:127.0.0.1:10030')] %} +{% endif %} +{{ set_parameter('smtpd_recipient_restrictions', recipient_restrictions) }} + {% if 'virtual' in pillar.get('postfix','') %} virtual_alias_maps = hash:/etc/postfix/virtual {% endif %}