From 5226583c8c6ecd74d0621b2b61e56ab9f98bcb6c Mon Sep 17 00:00:00 2001 From: Micah Anderson Date: Mon, 14 Nov 2011 11:42:58 -0500 Subject: allow for overriding the owner/group/mode of dovecot config files In some cases, the default permissions will not work. For example, if you are using postfix's pipe to send things through dovecot's LDA with sieve for filtering, you will get this: dovecot-lda: Permission denied doveconf: Fatal: Error in configuration file /etc/dovecot/dovecot.conf line 17: Couldn't open include file /etc/dovecot/conf.d/90-sieve.conf: Permission denied that is because, by default, the process runs as user 'mail' --- manifests/config/file.pp | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/manifests/config/file.pp b/manifests/config/file.pp index fe93500..39c6cc3 100644 --- a/manifests/config/file.pp +++ b/manifests/config/file.pp @@ -2,7 +2,10 @@ define dovecot::config::file ( $ensure = present, $source = 'absent', $content = 'absent', - $destination = 'absent' + $destination = 'absent', + $mode = 'absent', + $owner = 'absent', + $group = 'absent' ) { @@ -15,13 +18,28 @@ define dovecot::config::file ( default => $destination } + $real_mode = $mode ? { + 'absent' => 0640, + default => $mode + } + + $real_owner = $owner ? { + 'absent' => root, + default => $owner + } + + $real_group = $group ? { + 'absent' => 0, + default => $group + } + # the $name variable is set to dovecot_${name}, but the actual filename will # be set to $name file { "dovecot_${name}": ensure => $ensure, path => $real_destination, notify => Service[dovecot], - owner => root, group => 0, mode => 0640; + owner => $real_owner, group => $real_group, mode => $real_mode; } # the $content variable is 'absent' by default, so if the user doesn't -- cgit v1.2.3