From f231f8b408cbeb4ba1f23d2db9d7484889773cc5 Mon Sep 17 00:00:00 2001 From: Joshua Buysse Date: Sat, 4 Aug 2012 19:06:21 -0500 Subject: [PATCH] [COOK-1520] Added support for enabling procmail to postfix cookbook --- README.md | 3 +++ attributes/default.rb | 2 ++ metadata.rb | 5 +++++ recipes/default.rb | 7 +++++++ templates/default/main.cf.erb | 3 +++ 5 files changed, 20 insertions(+) diff --git a/README.md b/README.md index 4f12d74..d00d467 100644 --- a/README.md +++ b/README.md @@ -57,6 +57,9 @@ See `attributes/default.rb` for default values. * `node['postfix']['aliases']` - hash of aliases to create with `recipe[postfix::aliases]`, see below under __Recipes__ for more information. +* `node['postfix']['use_procmail']` - set to true if nodes should use + procmail as the delivery agent (mailbox_command). + Recipes ======= diff --git a/attributes/default.rb b/attributes/default.rb index bc2071b..c8581a9 100644 --- a/attributes/default.rb +++ b/attributes/default.rb @@ -33,4 +33,6 @@ default['postfix']['smtp_use_tls'] = "yes" default['postfix']['smtp_sasl_user_name'] = "" default['postfix']['smtp_sasl_passwd'] = "" +default['postfix']['use_procmail'] = false + default['postfix']['aliases'] = {} diff --git a/metadata.rb b/metadata.rb index eb313c3..589bf7e 100644 --- a/metadata.rb +++ b/metadata.rb @@ -102,3 +102,8 @@ attribute "postfix/multi_environment_relay", :display_name => "Postfix Search for relayhost in any environment", :description => "If true, then the client recipe will search any environment instead of just the node's", :default => "" + +attribute "postfix/use_procmail", + :display_name => "Postfix Use procmail?", + :description => "Whether procmail should be used as the local delivery agent for a server", + :default => "no" diff --git a/recipes/default.rb b/recipes/default.rb index cc479de..e81ac8a 100644 --- a/recipes/default.rb +++ b/recipes/default.rb @@ -22,6 +22,13 @@ package "postfix" do action :install end +if node['postfix']['use_procmail'] then + package "procmail" do + action :install + end +end + + service "postfix" do supports :status => true, :restart => true, :reload => true action :enable diff --git a/templates/default/main.cf.erb b/templates/default/main.cf.erb index 029ce49..75d7310 100644 --- a/templates/default/main.cf.erb +++ b/templates/default/main.cf.erb @@ -37,5 +37,8 @@ relayhost = <%= node['postfix']['relayhost'] %> mynetworks = <%= node['postfix']['mail_relay_networks'] %> inet_interfaces = loopback-only <% end -%> +<% if node['postfix']['use_procmail'] -%> +mailbox_command = /usr/bin/procmail -a "$EXTENSION" +<% end -%> mailbox_size_limit = 0 recipient_delimiter = +