smoeding / puppet-sendmail Goto Github PK
View Code? Open in Web Editor NEWManage the Sendmail MTA using Puppet
License: BSD 2-Clause "Simplified" License
Manage the Sendmail MTA using Puppet
License: BSD 2-Clause "Simplified" License
When using the following:
sendmail::aliases::entry { 'root':
recipient => '[email protected]',
}
You get an error:
Error: Evaluation Error: Error while evaluating a Resource Statement, Evaluation Error: Error while evaluating a Resource Statement, Unknown resource type: 'mailalias' (file: /etc/puppetlabs/code/modules/sendmail/manifests/aliases/entry.pp, line: 37, column: 3) (file: /etc/puppetlabs/code/environments/production/site/mailserver/manifests/aliases.pp, line: 2) on node mynode.example.com
Error can be fixed by adding this to Puppetfile:
mod 'puppetlabs-mailalias_core', '1.1.0'
Puppet Enterprise v2021.4.0
https://github.com/smoeding/puppet-sendmail/blob/master/manifests/nullclient.pp#L99 shows that the default value is undef
, but https://github.com/smoeding/puppet-sendmail/blob/master/manifests/nullclient.pp#L129 shows that the validate_re()
function will make that default value fail, since undef is not a string, nor would an empty string match the regex provided.
Two solutions come to mind; I'm not quite sure which you'd prefer, so will spell them out:
validate_re()
call in a conditional, e.g.if undef != $port_option_modify { validate_re($port_option_modify, '^[abcfhruACEOS]*$') }
$port_option_modify
much like you do for $mail_hub
.Hello,
I'm using Vagrant created virtual severs to try your puppet-sendmail module.
I've tried with Debian 11, Ubuntu (18.04, 20.04, 22,04), but sendmail configuration is never installed, it always returns this error message:
Error: Evaluation Error: Resource type not found: Deferred (file: /etc/puppet/code/modules/concat/manifests/fragment.pp, line: 21, column: 47)
The steps I follow:
# apt-get update
# apt install puppet
# puppet module install stm-sendmail --version 3.3.0
# echo "class { 'sendmail': }" > /vagrant/sendmail.install.config.pp
# puppet apply /vagrant/sendmail.install.config.pp
Warning: /etc/puppet/hiera.yaml: Use of 'hiera.yaml' version 3 is deprecated. It should be converted to version 5
(file: /etc/puppet/hiera.yaml)
Error: Evaluation Error: Resource type not found: Deferred (file: /etc/puppet/code/modules/concat/manifests/fragment.pp, line: 21, column: 47) on node localdev.example.com
Any idea?, perhaps is some dependency missing?
I get this error when I run puppet:
Debug: Augeas[/etc/mail/virtusertable-phabricator](provider=augeas): /augeas/load/Xfm/error = Can not find lens Sendmail_Map.lns
Is there some trick to make this use the bundled lens?
Hello,
The puppet agent is stuck on plesk 9.x servers with centos 7 because
sendmail -d0.4 -ODontProbeInterfaces=true -bv root 2>/dev/null
Doesn't exit
Quick fix is maybe a
Facter.add(:sendmail_version, :timeout => 5) do
With regards,
Richard
All manifest parameters should use data types to enforce parameter types.
Calling validate
functions is no longer necessary then.
The module should be able to add Milter configuration directives to the sendmail.mc file.
Hi,
Could you please add the Generics Domain Feature to the module.
Example: GENERICS_DOMAIN(`xxxxx.mycompany.net')dnl
The module currently only supports sendmail::mc::domain { 'xxxx.mycompany.net': } which results in the output of sendmail.mc as
DOMAIN('xxxx.mycompany.net')dnl
First off, thank you for your work on this project! I've encountered an issue while using sendmail::mc::daemon_options, where every time the puppet agent runs, a refresh of the service is triggered. This is due to the DAEMON_OPTIONS line being written to sendmail.mc always being ordered differently. Any ideas for a work-around?
Example changes to sendmail.mc after two puppet agent runs:
< DAEMON_OPTIONS(`Family=inet, Name=MTA-v4, Addr=127.0.0.1, Port=smtp')dnl
> DAEMON_OPTIONS(`Port=smtp, Family=inet, Name=MTA-v4, Addr=127.0.0.1')dnl
Versions:
stm/sendmail - 0.4.0
concat - 2.1.0
stdlib - 4.11.0
ruby - 1.8.7
puppet - 3.8.6
This is the full class that I'm using, should it be helpful:
class xx_mail::sendmail-client {
class { 'sendmail':
smart_host => 'mail-lab01.domain.com',
enable_ipv4_daemon => false,
enable_ipv6_daemon => false,
}
sendmail::mc::masquerade_as { 'domain.com':
masquerade_envelope => true,
}
sendmail::mc::daemon_options { 'MTA-v4':
addr => '127.0.0.1',
family => 'inet',
port => 'smtp',
}
}
Any authinfo entries created in /etc/mail/authinfo seem to be ignored (for me at least) on Redhat/CentOS. The sendmail documentation recommends that you put authinfo entries into the /etc/mail/access file, however I don't think I am able to do this using your module. If I manually put my authinfo entries into the access file and recompile it does seem to work ok.
Am I doing something wrong with your authinfo parameter? Or does this functionality not exist?
Many Thanks
Kev
The sendmail.mc file managed by the package should allow setting various TLS parameters to configure encrypted connections.
On FreeBSD 11.2-RELEASE-p4, my sendmail.cf file ships with this...
$ fgrep AliasFile /etc/mail/sendmail.cf
O AliasFile=/etc/mail/aliases
https://github.com/smoeding/puppet-sendmail/blob/master/manifests/aliases/file.pp#L29 is hard-coded to use the params class; https://github.com/smoeding/puppet-sendmail/blob/master/manifests/params.pp#L24 allows no adjustment.
My workaround is to just symlink and require/notify the appropriate classes.
case $::kernel {
'FreeBSD': {
# The sendmail module does not yet have an easy way to adjust the
# AliasFile parameter in sendmail.cf and in FreeBSD the default
# is /etc/mail/aliases. We work around that by making a symlink.
file { '/etc/mail/aliases':
ensure => 'link',
target => '../aliases',
before => Class['sendmail::aliases'],
notify => Class['sendmail::aliases::newaliases'],
}
} default: {
#NOOP
}
}
It would probably be nice to be able to adjust the AliasFile
line per a variable in the init class or the like.
That said, this tickles a broader issue, which I am not sure you'd want to tackle, here. That said, I'll mention it: with the conversion to no-Puppet-3-compatibility that happened this year... calling variables from params.pp
should probably be avoided per https://www.devco.net/archives/2013/12/09/the-problem-with-params-pp.php . I would suggest a conversion to YAML similar to https://github.com/puppetlabs/puppetlabs-ntp/tree/master/data, which -- in my experience -- makes it easier to deal with multi-OS nuance like this for both coder and user alike, since it puts all variables into Hiera (and thus tunable by users).
Looks like there are ~22 classes to deal with per fgrep -R 'include ::sendmail::params' manifests/ | wc -l
. I'd be willing to consider doing a PR to help, but will warn that it would take me a few weeks, based on my travel schedule.
From the sendmail operations guide:
The options ClientCertFile, ClientKeyFile, ServerCertFile, and ServerKeyFile can take a second file name, which must be separated from the first with a comma (note: do not use any spaces) to set up a second cert/key pair. This can be used to have certs of different types, e.g., RSA and DSA.
Hello:
When I updated stdlib, I get this when I run your module:
Notice: /Stage[main]/Sendmail::Mc/Concat[sendmail.mc]/File[/etc/mail/sendmail.mc]/content:
--- /etc/mail/sendmail.mc 2016-03-28 19:38:08.619650893 +0000
+++ /tmp/puppet-file20160412-15827-ex5s0m 2016-04-12 19:16:05.471658994 +0000
@@ -16,8 +16,8 @@
dnl #
dnl # Macros
dnl #
-DAEMON_OPTIONS(`Name=MTA-v4, Family=inet, Port=smtp')dnl
-DAEMON_OPTIONS(`Name=MTA-v6, Family=inet6, Port=smtp, M=O')dnl
+DAEMON_OPTIONS(`')dnl
+DAEMON_OPTIONS(`')dnl
dnl #
dnl # Mailer
dnl #
I this a problem with stdlib's delete function, or with this module?
With CentOS 7 I was getting the following issue.
[root@947057-2rpmr001 ~]# /opt/puppetlabs/bin/puppet agent -t
Info: Using configured environment 'production'
Info: Retrieving pluginfacts
Info: Retrieving plugin
Info: Loading facts
Info: Caching catalog for 947057-2rpmr001.davison.local
Info: Applying configuration version '1527003903'
Error: Systemd start for sendmail failed!
journalctl log for sendmail:
-- Logs begin at Sat 2018-05-12 22:26:06 CDT, end at Tue 2018-05-22 10:46:36 CDT. --
May 22 10:44:37 947057-2rpmr001.davison.local systemd[1]: Starting Sendmail Mail Transport Agent...
May 22 10:44:37 947057-2rpmr001.davison.local make[26990]: /etc/mail/make: line 22: makemap: command not found
May 22 10:44:37 947057-2rpmr001.davison.local make[26990]: /etc/mail/make: line 22: makemap: command not found
May 22 10:44:37 947057-2rpmr001.davison.local make[26990]: /etc/mail/make: line 22: makemap: command not found
May 22 10:44:37 947057-2rpmr001.davison.local make[26990]: /etc/mail/make: line 22: makemap: command not found
May 22 10:44:37 947057-2rpmr001.davison.local systemd[1]: PID file /run/sendmail.pid not readable (yet?) after start.
May 22 10:44:38 947057-2rpmr001.davison.local postfix/postfix-script[27018]: fatal: the Postfix mail system is already running
May 22 10:44:38 947057-2rpmr001.davison.local systemd[1]: sendmail.service never wrote its PID file. Failing.
May 22 10:44:38 947057-2rpmr001.davison.local systemd[1]: Failed to start Sendmail Mail Transport Agent.
May 22 10:44:38 947057-2rpmr001.davison.local systemd[1]: Unit sendmail.service entered failed state.
May 22 10:44:38 947057-2rpmr001.davison.local systemd[1]: sendmail.service failed.
May 22 10:45:06 947057-2rpmr001.davison.local systemd[1]: Starting Sendmail Mail Transport Agent...
May 22 10:45:06 947057-2rpmr001.davison.local make[27182]: /etc/mail/make: line 22: makemap: command not found
May 22 10:45:06 947057-2rpmr001.davison.local make[27182]: /etc/mail/make: line 22: makemap: command not found
May 22 10:45:06 947057-2rpmr001.davison.local make[27182]: /etc/mail/make: line 22: makemap: command not found
May 22 10:45:06 947057-2rpmr001.davison.local make[27182]: /etc/mail/make: line 22: makemap: command not found
May 22 10:45:06 947057-2rpmr001.davison.local systemd[1]: PID file /run/sendmail.pid not readable (yet?) after start.
May 22 10:45:07 947057-2rpmr001.davison.local postfix/master[27269]: daemon started -- version 2.10.1, configuration /etc/postfix
May 22 10:46:36 947057-2rpmr001.davison.local systemd[1]: sendmail.service start operation timed out. Terminating.
May 22 10:46:36 947057-2rpmr001.davison.local systemd[1]: Failed to start Sendmail Mail Transport Agent.
May 22 10:46:36 947057-2rpmr001.davison.local systemd[1]: Unit sendmail.service entered failed state.
May 22 10:46:36 947057-2rpmr001.davison.local systemd[1]: sendmail.service failed.
Error: /Stage[main]/Sendmail::Service/Service[sendmail]/ensure: change from stopped to running failed: Systemd start for sendmail failed!
journalctl log for sendmail:
-- Logs begin at Sat 2018-05-12 22:26:06 CDT, end at Tue 2018-05-22 10:46:36 CDT. --
May 22 10:44:37 947057-2rpmr001.davison.local systemd[1]: Starting Sendmail Mail Transport Agent...
May 22 10:44:37 947057-2rpmr001.davison.local make[26990]: /etc/mail/make: line 22: makemap: command not found
May 22 10:44:37 947057-2rpmr001.davison.local make[26990]: /etc/mail/make: line 22: makemap: command not found
May 22 10:44:37 947057-2rpmr001.davison.local make[26990]: /etc/mail/make: line 22: makemap: command not found
May 22 10:44:37 947057-2rpmr001.davison.local make[26990]: /etc/mail/make: line 22: makemap: command not found
May 22 10:44:37 947057-2rpmr001.davison.local systemd[1]: PID file /run/sendmail.pid not readable (yet?) after start.
May 22 10:44:38 947057-2rpmr001.davison.local postfix/postfix-script[27018]: fatal: the Postfix mail system is already running
May 22 10:44:38 947057-2rpmr001.davison.local systemd[1]: sendmail.service never wrote its PID file. Failing.
May 22 10:44:38 947057-2rpmr001.davison.local systemd[1]: Failed to start Sendmail Mail Transport Agent.
May 22 10:44:38 947057-2rpmr001.davison.local systemd[1]: Unit sendmail.service entered failed state.
May 22 10:44:38 947057-2rpmr001.davison.local systemd[1]: sendmail.service failed.
May 22 10:45:06 947057-2rpmr001.davison.local systemd[1]: Starting Sendmail Mail Transport Agent...
May 22 10:45:06 947057-2rpmr001.davison.local make[27182]: /etc/mail/make: line 22: makemap: command not found
May 22 10:45:06 947057-2rpmr001.davison.local make[27182]: /etc/mail/make: line 22: makemap: command not found
May 22 10:45:06 947057-2rpmr001.davison.local make[27182]: /etc/mail/make: line 22: makemap: command not found
May 22 10:45:06 947057-2rpmr001.davison.local make[27182]: /etc/mail/make: line 22: makemap: command not found
May 22 10:45:06 947057-2rpmr001.davison.local systemd[1]: PID file /run/sendmail.pid not readable (yet?) after start.
May 22 10:45:07 947057-2rpmr001.davison.local postfix/master[27269]: daemon started -- version 2.10.1, configuration /etc/postfix
May 22 10:46:36 947057-2rpmr001.davison.local systemd[1]: sendmail.service start operation timed out. Terminating.
May 22 10:46:36 947057-2rpmr001.davison.local systemd[1]: Failed to start Sendmail Mail Transport Agent.
May 22 10:46:36 947057-2rpmr001.davison.local systemd[1]: Unit sendmail.service entered failed state.
May 22 10:46:36 947057-2rpmr001.davison.local systemd[1]: sendmail.service failed.
Notice: /Stage[main]/Sendmail/Anchor[sendmail::end]: Dependency Service[sendmail] has failures: true
Warning: /Stage[main]/Sendmail/Anchor[sendmail::end]: Skipping because of failed dependencies
Notice: Applied catalog in 91.27 seconds
I looked into it a little bit and the link for makemap was bad.
[root@947057-2rpmr001 ~]# ls -lah /usr/bin/makemap
lrwxrwxrwx. 1 root root 15 May 22 10:44 /usr/bin/makemap -> ../sbin/makemap
But the executable is "/usr/sbin/makemap.sendmail"
So I fixed the link
cd /usr/bin
rm makemap
ln -s ../sbin/makemap.sendmail makemap
Native Puppet templates should be used where possible.
I presently need to do add a sendmail::mc::feature
this to get sendmail::access::entry
to work, E.G.:
sendmail::mc::feature { 'access_db': }
sendmail::access::entry { 'Try_TLS:': value => 'NO' }
It took me a while to figure out, so in the interest of saving others time, I'll ask: should sendmail::access::file
contain sendmail::mc::feature { 'access_db': }
(or ensure_resource('sendmail::mc::feature','access_db')
) in order to avoid that? My initial take is that if you're setting something in the access_db, you want it working automatically, but I may be missing some context.
The current version of puppetlabs.concat is 4.2.1 but your stm-sendmail module still requires a version (>= 1.2.0 < 3.0.0) for concat.
This creates unresolved dependencies when using stm-sendmail with other modules requiring a newer version of concat.
Please test with a new version of concat and update your dependencies. Thank you.
sendmail::mc::feature
to add a FEATURE to the sendmail.mc file. In my hierdata/hosts/sendmail.yaml file I'm adding:classes:
"sendmail::mc::feature": mailertable
{bunch of other sendmail:: configs}
But when I run puppet agent on my host, it doesn't even look like it's running the mc::feature class. Everything else works perfectly fine but it's just this sendmail::mc::feature
class that just isn't running. (Hopefully all that makes sense?)
On Ubuntu the module fails to include starttls.mc
file. This is causes by incorrectly checking the @operatingsystem
fact the a template file.
The module should be able to add LDAP configuration options to sendmail.mc
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.