Added dovecot module, which barely walks, but even so. :)
This commit is contained in:
parent
9c6b9e1a68
commit
861dd095ee
2 changed files with 117 additions and 0 deletions
83
dovecot/manifests/init.pp
Normal file
83
dovecot/manifests/init.pp
Normal file
|
@ -0,0 +1,83 @@
|
|||
class dovecot::common {
|
||||
|
||||
case $operatingsystem {
|
||||
centos,fedora: {
|
||||
package { ["dovecot"]:
|
||||
ensure => installed,
|
||||
}
|
||||
}
|
||||
default: {
|
||||
fail("Dovecot module not supported in ${operatingsystem}.")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
define dovecot::server($mx_mailname="", $ssl_csr="", $ssl_cert="", $ssl_key="", $ssl_chain="") {
|
||||
|
||||
case $operatingsystem {
|
||||
centos,fedora: {
|
||||
$ssl_dir = "/etc/pki/tls"
|
||||
}
|
||||
default: {
|
||||
fail("Dovecot module not supported in ${operatingsystem}.")
|
||||
}
|
||||
}
|
||||
|
||||
service { "dovecot":
|
||||
ensure => running,
|
||||
enable => true,
|
||||
require => File["/etc/dovecot.conf"],
|
||||
}
|
||||
|
||||
$mail_domain = $name ? {
|
||||
"default" => "${homename}",
|
||||
default => "${name}",
|
||||
}
|
||||
|
||||
if $ssl_chain {
|
||||
file { "$ssl_dir/certs/${mx_mailname}.chain.crt":
|
||||
ensure => present,
|
||||
source => $ssl_chain,
|
||||
mode => 0644,
|
||||
owner => root,
|
||||
group => root,
|
||||
notify => Service["dovecot"],
|
||||
}
|
||||
}
|
||||
|
||||
if $ssl_cert {
|
||||
file { "$ssl_dir/certs/${mx_mailname}.crt":
|
||||
ensure => present,
|
||||
source => $ssl_cert,
|
||||
mode => 0644,
|
||||
owner => root,
|
||||
group => root,
|
||||
notify => Service["dovecot"],
|
||||
}
|
||||
} else {
|
||||
fail("You need to define an ssl_cert in your node manifest.")
|
||||
}
|
||||
|
||||
if $ssl_key {
|
||||
file { "$ssl_dir/private/${mx_mailname}.key":
|
||||
ensure => present,
|
||||
source => $ssl_key,
|
||||
mode => 0600,
|
||||
owner => root,
|
||||
group => root,
|
||||
notify => Service["dovecot"],
|
||||
}
|
||||
} else {
|
||||
fail("You need to define an ssl_key in your node manifest.")
|
||||
}
|
||||
|
||||
file { "/etc/dovecot.conf":
|
||||
ensure => present,
|
||||
content => template("dovecot/dovecot.conf.erb"),
|
||||
mode => 0644,
|
||||
owner => root,
|
||||
group => root,
|
||||
notify => Service["dovecot"],
|
||||
}
|
||||
|
||||
}
|
34
dovecot/templates/dovecot.conf.erb
Normal file
34
dovecot/templates/dovecot.conf.erb
Normal file
|
@ -0,0 +1,34 @@
|
|||
protocols = imaps
|
||||
disable_plaintext_auth = yes
|
||||
ssl_cert_file = <%= ssl_dir %>/certs/<%= mx_mailname %>.crt
|
||||
ssl_key_file = <%= ssl_dir %>/private/<%= mx_mailname %>.key
|
||||
ssl_ca_file = <%= ssl_dir %>/certs/<%= mx_mailname %>.chain.crt
|
||||
login_chroot = yes
|
||||
login_user = dovecot
|
||||
login_max_processes_count = 256
|
||||
namespace private {
|
||||
prefix =
|
||||
location = mbox:~/imapmail/:INBOX=/var/mail/%u
|
||||
inbox = yes
|
||||
}
|
||||
protocol imap {
|
||||
mail_plugins = zlib
|
||||
}
|
||||
|
||||
protocol pop3 {
|
||||
}
|
||||
protocol lda {
|
||||
postmaster_address = postmaster@<%= mail_domain %>
|
||||
}
|
||||
auth default {
|
||||
mechanisms = plain
|
||||
passdb pam {
|
||||
}
|
||||
userdb passwd {
|
||||
}
|
||||
user = root
|
||||
}
|
||||
dict {
|
||||
}
|
||||
plugin {
|
||||
}
|
Loading…
Add table
Reference in a new issue