Rework restrictions parameter building
It still included SASL configuration that is nowhere to be found in current main.cf template.
This commit is contained in:
parent
542be4f5bb
commit
da1995119a
@ -37,6 +37,9 @@
|
|||||||
|
|
||||||
{{ set_parameter('readme_directory', 'no') }}
|
{{ set_parameter('readme_directory', 'no') }}
|
||||||
|
|
||||||
|
{%- set relay_restrictions = ['permit_mynetworks'] %}
|
||||||
|
{%- set recipient_restrictions = ['permit_mynetworks'] %}
|
||||||
|
|
||||||
{%- if config.get('smtpd_use_tls', 'yes') == 'yes' %}
|
{%- if config.get('smtpd_use_tls', 'yes') == 'yes' %}
|
||||||
# TLS parameters (http://www.postfix.org/TLS_README.html)
|
# TLS parameters (http://www.postfix.org/TLS_README.html)
|
||||||
# Recipient settings
|
# Recipient settings
|
||||||
@ -60,20 +63,21 @@
|
|||||||
{{ set_parameter('message_size_limit', '41943040') }}
|
{{ set_parameter('message_size_limit', '41943040') }}
|
||||||
|
|
||||||
{%- if config.get('relayhost') %}
|
{%- if config.get('relayhost') %}
|
||||||
{% set relay_restrictions = ['permit_mynetworks', 'permit_sasl_authenticated', 'defer_unauth_destination'] %}
|
|
||||||
{% set policyd_spf = salt['pillar.get']('postfix:policyd-spf', {}) %}
|
{% set policyd_spf = salt['pillar.get']('postfix:policyd-spf', {}) %}
|
||||||
{% if policyd_spf.get('enabled', False) %}
|
{%- if policyd_spf.get('enabled', False) %}
|
||||||
{% set relay_restrictions = relay_restrictions + ['check_policy_server unix:private/policyd-spf'] %}
|
{%- do relay_restrictions.append('check_policy_server unix:private/policyd-spf') %}
|
||||||
policy-spf_time_limit = {{ policyd_spf.get('time_limit', '3600s') }}
|
policy-spf_time_limit = {{ policyd_spf.get('time_limit', '3600s') }}
|
||||||
{% endif %}
|
{%- endif %}
|
||||||
|
{%- do relay_restrictions.append('defer_unauth_destination') %}
|
||||||
{{ set_parameter('smtpd_relay_restrictions', relay_restrictions) }}
|
{{ set_parameter('smtpd_relay_restrictions', relay_restrictions) }}
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
|
|
||||||
{% set recipient_restrictions = ['permit_mynetworks', 'permit_sasl_authenticated', 'reject_unauth_destination'] %}
|
{#- check_policy_service must be after reject_unauth_destination #}
|
||||||
{% set postgrey_config = salt['pillar.get']('postfix:postgrey', {}) %}
|
{%- do recipient_restrictions.append('reject_unauth_destination') %}
|
||||||
{% if postgrey_config.get('enabled', False) %}
|
{%- set postgrey_config = salt['pillar.get']('postfix:postgrey', {}) %}
|
||||||
{% set recipient_restrictions = recipient_restrictions + ['check_policy_service ' ~ postgrey_config.get('location', 'inet:127.0.0.1:10030')] %}
|
{%- if postgrey_config.get('enabled', False) %}
|
||||||
{% endif %}
|
{%- do recipient_restrictions.append('check_policy_service ' ~ postgrey_config.get('location', 'inet:127.0.0.1:10030')) %}
|
||||||
|
{%- endif %}
|
||||||
{{ set_parameter('smtpd_recipient_restrictions', recipient_restrictions) }}
|
{{ set_parameter('smtpd_recipient_restrictions', recipient_restrictions) }}
|
||||||
|
|
||||||
{% if 'virtual' in pillar.get('postfix','') %}
|
{% if 'virtual' in pillar.get('postfix','') %}
|
||||||
|
Loading…
Reference in New Issue
Block a user