allows to rewrite outgoing address.
In my development env i want to make sure nobody can send a mail to a wrong address. So all outgoing mails are changed. Signed-off-by: Bram Gillemon <bram@gillemon.be>
This commit is contained in:
parent
7df2c36125
commit
ca7b0033e9
@ -105,3 +105,11 @@ suites:
|
|||||||
sasl:
|
sasl:
|
||||||
smtp_sasl_user_name: "kitchenuser"
|
smtp_sasl_user_name: "kitchenuser"
|
||||||
smtp_sasl_passwd: "not-a-real-thing"
|
smtp_sasl_passwd: "not-a-real-thing"
|
||||||
|
|
||||||
|
- name: canonical
|
||||||
|
run_list:
|
||||||
|
- recipe[postfix]
|
||||||
|
attributes:
|
||||||
|
postfix:
|
||||||
|
recipient_canonical_map_entries:
|
||||||
|
john: john@doe.com
|
@ -47,3 +47,12 @@ suites:
|
|||||||
sasl:
|
sasl:
|
||||||
smtp_sasl_user_name: "kitchenuser"
|
smtp_sasl_user_name: "kitchenuser"
|
||||||
smtp_sasl_passwd: "not-a-real-thing"
|
smtp_sasl_passwd: "not-a-real-thing"
|
||||||
|
|
||||||
|
- name: canonical
|
||||||
|
run_list:
|
||||||
|
- recipe[postfix]
|
||||||
|
attributes:
|
||||||
|
postfix:
|
||||||
|
recipient_canonical_map_entries:
|
||||||
|
john: john@doe.com
|
||||||
|
|
@ -33,6 +33,7 @@ default['postfix']['main_template_source'] = 'postfix'
|
|||||||
default['postfix']['master_template_source'] = 'postfix'
|
default['postfix']['master_template_source'] = 'postfix'
|
||||||
default['postfix']['sender_canonical_map_entries'] = {}
|
default['postfix']['sender_canonical_map_entries'] = {}
|
||||||
default['postfix']['smtp_generic_map_entries'] = {}
|
default['postfix']['smtp_generic_map_entries'] = {}
|
||||||
|
default['postfix']['recipient_canonical_map_entries'] = {}
|
||||||
default['postfix']['access_db_type'] = 'hash'
|
default['postfix']['access_db_type'] = 'hash'
|
||||||
default['postfix']['aliases_db_type'] = 'hash'
|
default['postfix']['aliases_db_type'] = 'hash'
|
||||||
default['postfix']['transport_db_type'] = 'hash'
|
default['postfix']['transport_db_type'] = 'hash'
|
||||||
|
@ -109,6 +109,25 @@ unless node['postfix']['smtp_generic_map_entries'].empty?
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
execute 'update-postfix-recipient_canonical' do
|
||||||
|
command "postmap #{node['postfix']['conf_dir']}/recipient_canonical"
|
||||||
|
action :nothing
|
||||||
|
end
|
||||||
|
|
||||||
|
unless node['postfix']['recipient_canonical_map_entries'].empty?
|
||||||
|
template "#{node['postfix']['conf_dir']}/recipient_canonical" do
|
||||||
|
owner 'root'
|
||||||
|
group node['root_group']
|
||||||
|
mode '0644'
|
||||||
|
notifies :run, 'execute[update-postfix-recipient_canonical]'
|
||||||
|
notifies :reload, 'service[postfix]'
|
||||||
|
end
|
||||||
|
|
||||||
|
unless node['postfix']['main'].key?('recipient_canonical_maps')
|
||||||
|
node.normal['postfix']['main']['recipient_canonical_maps'] = "hash:#{node['postfix']['conf_dir']}/recipient_canonical"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
%w( main master ).each do |cfg|
|
%w( main master ).each do |cfg|
|
||||||
template "#{node['postfix']['conf_dir']}/#{cfg}.cf" do
|
template "#{node['postfix']['conf_dir']}/#{cfg}.cf" do
|
||||||
source "#{cfg}.cf.erb"
|
source "#{cfg}.cf.erb"
|
||||||
|
9
templates/default/recipient_canonical.erb
Normal file
9
templates/default/recipient_canonical.erb
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
#
|
||||||
|
# Auto-generated by Chef.
|
||||||
|
# Local modifications will be overwritten.
|
||||||
|
#
|
||||||
|
# See man 5 canonical for format
|
||||||
|
|
||||||
|
<% node['postfix']['recipient_canonical_map_entries'].each do |name, value| %>
|
||||||
|
<%= name %> <%= value %>
|
||||||
|
<% end unless node['postfix']['recipient_canonical_map_entries'].nil? %>
|
Loading…
x
Reference in New Issue
Block a user