From 8e3cac8b51dcd0d266e4d7c327ce7629512dbed8 Mon Sep 17 00:00:00 2001 From: Ossi Salmi Date: Mon, 7 Jun 2010 16:39:22 +0300 Subject: [PATCH] Initial version of sendmail module. --- sendmail/manifests/init.pp | 76 ++++++++++++++++++++++++++++++++ sendmail/templates/submit.mc.erb | 34 ++++++++++++++ 2 files changed, 110 insertions(+) create mode 100644 sendmail/manifests/init.pp create mode 100644 sendmail/templates/submit.mc.erb diff --git a/sendmail/manifests/init.pp b/sendmail/manifests/init.pp new file mode 100644 index 0000000..b76fb89 --- /dev/null +++ b/sendmail/manifests/init.pp @@ -0,0 +1,76 @@ +# Install Sendmail packages. +# +class sendmail::common { + + case $operatingsystem { + centos,fedora: { + package { ["sendmail", "sendmail-cf"]: + ensure => installed, + } + } + } + +} + + +# Configure Sendmail submission. +# +# === Global variables +# +# $mail_server: +# Hostname of mail server. +# +class sendmail::client inherits sendmail::common { + + case $operatingsystem { + openbsd: { + file { "/usr/share/sendmail/cf/submit.mc": + ensure => present, + content => template("sendmail/submit.mc.erb"), + owner => root, + group => bin, + mode => 0444, + notify => Exec["make submit.cf"], + } + } + default: { + file { "/etc/mail/submit.mc": + ensure => present, + content => template("sendmail/submit.mc.erb"), + owner => root, + group => root, + mode => 0644, + notify => Exec["make submit.cf"], + } + } + } + + exec { "make submit.cf": + path => "/bin:/usr/bin:/sbin:/usr/sbin", + cwd => $operatingsystem ? { + openbsd => "/usr/share/sendmail/cf", + default => "/etc/mail", + }, + require => $operatingsystem ? { + openbsd => undef, + default => Package["sendmail-cf"], + }, + refreshonly => true, + } + + file { "/etc/mail/submit.cf": + ensure => present, + owner => root, + group => $operatingsystem ? { + openbsd => wheel, + default => root, + }, + mode => 0644, + source => $operatingsystem ? { + openbsd => "/usr/share/sendmail/cf/submit.cf", + default => undef, + }, + require => Exec["make submit.cf"], + } + +} diff --git a/sendmail/templates/submit.mc.erb b/sendmail/templates/submit.mc.erb new file mode 100644 index 0000000..9a1ff31 --- /dev/null +++ b/sendmail/templates/submit.mc.erb @@ -0,0 +1,34 @@ +divert(-1) +# +# Copyright (c) 2001-2003 Sendmail, Inc. and its suppliers. +# All rights reserved. +# +# By using this file, you agree to the terms and conditions set +# forth in the LICENSE file which can be found at the top level of +# the sendmail distribution. +# +# + +# +# This is the prototype file for a set-group-ID sm-msp sendmail that +# acts as a initial mail submission program. +# + +divert(0)dnl +<% if kernel == 'Linux' -%> +include(`/usr/share/sendmail-cf/m4/cf.m4')dnl +<% end -%> +VERSIONID(`puppet setup')dnl +define(`confCF_VERSION', `Submit')dnl +define(`__OSTYPE__',`')dnl dirty hack to keep proto.m4 from complaining +define(`_USE_DECNET_SYNTAX_', `1')dnl support DECnet +define(`confTIME_ZONE', `USE_TZ')dnl +define(`confDONT_INIT_GROUPS', `True')dnl +define(`confDIRECT_SUBMISSION_MODIFIERS',`C')dnl +<% if kernel == 'Linux' -%> +define(`confPID_FILE', `/var/run/sm-client.pid')dnl +<% end -%> +FEATURE(`use_ct_file')dnl +dnl +dnl If you use IPv6 only, change [127.0.0.1] to [IPv6:::1] +FEATURE(`msp', `[<%= mail_server %>]')dnl