diff --git a/attributes/default.rb b/attributes/default.rb index 039423f..7851fe5 100644 --- a/attributes/default.rb +++ b/attributes/default.rb @@ -23,6 +23,7 @@ default['postfix']['use_procmail'] = false default['postfix']['aliases'] = {} default['postfix']['main_template_source'] = "postfix" default['postfix']['master_template_source'] = "postfix" +default['postfix']['sender_canonical_map_entries'] = {} case node['platform'] when 'smartos' diff --git a/recipes/default.rb b/recipes/default.rb index cbdcc7c..4a2497d 100644 --- a/recipes/default.rb +++ b/recipes/default.rb @@ -38,6 +38,19 @@ when "rhel", "fedora" end end +if !node['postfix']['sender_canonical_map_entries'].empty? + template "#{node['postfix']['conf_dir']}/sender_canonical" do + owner "root" + group 0 + mode '0644' + notifies :restart, "service[postfix]" + end + + if !node['postfix']['main'].has_key?('sender_canonical_maps') + node.set['postfix']['main']['sender_canonical_maps'] = "hash:#{node['postfix']['conf_dir']}/sender_canonical" + end +end + %w{main master}.each do |cfg| template "#{node['postfix']['conf_dir']}/#{cfg}.cf" do source "#{cfg}.cf.erb"