feat(maps): add more map types and tests
Signed-off-by: Felipe Zipitria <fzipitria@perceptyx.com>
This commit is contained in:
parent
a10af42b16
commit
e3970dfc3e
@ -117,7 +117,7 @@ postfix_{{ domain }}_ssl_key:
|
||||
{%- if not file_path.startswith('/') %}
|
||||
{%- set file_path = postfix.config_path ~ '/' ~ file_path %}
|
||||
{%- endif %}
|
||||
{%- if file_type in ("btree", "cdb", "dbm", "hash", "sdbm", "regexp") %}
|
||||
{%- if file_type in ("btree", "cdb", "cidr", "dbm", "hash", "pcre", "regexp", "sdbm") %}
|
||||
{%- set need_postmap = True %}
|
||||
{%- endif %}
|
||||
postfix_{{ mapping }}:
|
||||
|
25
test/integration/default/controls/postfix_maps_type_spec.rb
Normal file
25
test/integration/default/controls/postfix_maps_type_spec.rb
Normal file
@ -0,0 +1,25 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
control 'Postfix map types' do
|
||||
title 'maps types are generated properly'
|
||||
|
||||
# CIDR
|
||||
describe command('postmap -q "192.168.0.0/16" /etc/postfix/check_cidr') do
|
||||
its('stdout') { should eq "REJECT\n" }
|
||||
its('exit_status') { should eq 0 }
|
||||
end
|
||||
|
||||
# PCRE
|
||||
describe command(
|
||||
'postmap -q "/^(?!owner-)(.*)-outgoing@(.*)/" /etc/postfix/check_pcre'
|
||||
) do
|
||||
its('stdout') { should eq "550 Use ${1}@${2} instead\n" }
|
||||
its('exit_status') { should eq 0 }
|
||||
end
|
||||
|
||||
# REGEXP
|
||||
describe command('postmap -q "/[%!@].*[%!@]/" /etc/postfix/check_client_access') do
|
||||
its('stdout') { should eq "550 Sender-specified routing rejected\n" }
|
||||
its('exit_status') { should eq 0 }
|
||||
end
|
||||
end
|
@ -60,6 +60,11 @@ postfix:
|
||||
local_recipient_maps: $virtual_mailbox_maps
|
||||
transport_maps: hash:/etc/postfix/transport
|
||||
|
||||
# Other map types
|
||||
check_client_access_maps: regexp:/etc/postfix/check_client_access
|
||||
check_cidr_maps: cidr:/etc/postfix/check_cidr
|
||||
check_pcre_maps: pcre:/etc/postfix/check_pcre
|
||||
|
||||
# SMTP server
|
||||
smtpd_tls_session_cache_database: btree:${data_directory}/smtpd_scache
|
||||
smtpd_use_tls: 'yes'
|
||||
@ -158,3 +163,21 @@ postfix:
|
||||
- someuser_1@example.com
|
||||
- someuser_2@example.com
|
||||
- singlealiasexample: someuser_3@example.com
|
||||
|
||||
check_client_access_maps:
|
||||
- '/[%!@].*[%!@]/':
|
||||
- 550 Sender-specified routing rejected
|
||||
|
||||
check_cidr_maps:
|
||||
- '192.168.1.1':
|
||||
- OK
|
||||
- '192.168.0.0/16':
|
||||
- REJECT
|
||||
- '2001:db8::1':
|
||||
- OK
|
||||
- '2001:db8::/32':
|
||||
- REJECT
|
||||
|
||||
check_pcre_maps:
|
||||
- '/^(?!owner-)(.*)-outgoing@(.*)/':
|
||||
- 550 Use ${1}@${2} instead
|
||||
|
Loading…
Reference in New Issue
Block a user