#55 - Add support for virtual aliases
Signed-off-by: Sean OMeara <someara@opscode.com>
This commit is contained in:
parent
bad71eebbe
commit
80d37848cb
@ -90,6 +90,18 @@ if node['postfix']['main']['smtp_sasl_auth_enable'] == 'yes'
|
|||||||
default['postfix']['main']['relayhost'] = ''
|
default['postfix']['main']['relayhost'] = ''
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if node['postfix']['use_virtual_aliases'] == 'yes'
|
||||||
|
default['postfix']['main']['virtual_alias_domains'] = []
|
||||||
|
case node['platform']
|
||||||
|
when 'smartos'
|
||||||
|
default['postfix']['virtual_alias_db'] = '/opt/local/etc/postfix/virtual'
|
||||||
|
else
|
||||||
|
default['postfix']['virtual_alias_db'] = '/etc/postfix/virtual'
|
||||||
|
end
|
||||||
|
default['postfix']['main']['virtual_alias_maps'] = "hash:#{node['postfix']['virtual_alias_db']}"
|
||||||
|
default['postfix']['virtual_aliases'] = {}
|
||||||
|
end
|
||||||
|
|
||||||
# # Default main.cf attributes according to `postconf -d`
|
# # Default main.cf attributes according to `postconf -d`
|
||||||
# default['postfix']['main']['relayhost'] = ''
|
# default['postfix']['main']['relayhost'] = ''
|
||||||
# default['postfix']['main']['milter_default_action'] = 'tempfail'
|
# default['postfix']['main']['milter_default_action'] = 'tempfail'
|
||||||
|
31
recipes/virtual_aliases.rb
Normal file
31
recipes/virtual_aliases.rb
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
# encoding: utf-8
|
||||||
|
# Copyright:: Copyright (c) 2012, Opscode, Inc.
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
#
|
||||||
|
|
||||||
|
include_recipe 'postfix'
|
||||||
|
|
||||||
|
execute 'postmap-virtual-alias' do
|
||||||
|
command "postmap #{node['postfix']['main']['virtual_alias_maps']}"
|
||||||
|
action :nothing
|
||||||
|
end
|
||||||
|
|
||||||
|
template node['postfix']['virtual_alias_db'] do
|
||||||
|
source 'virtual_aliases.erb'
|
||||||
|
owner 'root'
|
||||||
|
group 'root'
|
||||||
|
mode 0400
|
||||||
|
notifies :run, 'execute[postmap-virtual-alias]', :immediately
|
||||||
|
notifies :restart, 'service[postfix]'
|
||||||
|
end
|
10
templates/default/virtual_aliases.erb
Normal file
10
templates/default/virtual_aliases.erb
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
#
|
||||||
|
# This file is generated by Chef for <%= node['fqdn'] %>
|
||||||
|
#
|
||||||
|
# Local changes will be overwritten
|
||||||
|
#
|
||||||
|
# See man 5 virtual for format
|
||||||
|
|
||||||
|
<% node['postfix']['virtual_aliases'].each do |key, value| %>
|
||||||
|
<%= key %> <%= value %>
|
||||||
|
<% end %>
|
Loading…
x
Reference in New Issue
Block a user