Issue #5019 has been reported by Tomoyuki Kano.
----------------------------------------
Feature #5019: smtpserver should be specifiable port, HELO domain and SMTP
AUTH parameters.
https://projects.puppetlabs.com/issues/5019
Author: Tomoyuki Kano
Status: Unreviewed
Priority: Normal
Assignee:
Category:
Target version: 2.6.x
Affected version:
Keywords:
Branch:
Puppet Master's `smtpserver` configuration parameter can not speciy SMTP port,
HELO domain and SMTP AUTH parameters.
And, Message-Id should be set.
Here is a my quick hack:
--- puppet/defaults.rb.~1~ 2010-10-02 10:08:57.000000000 +0900
+++ puppet/defaults.rb 2010-10-16 13:56:36.453437983 +0900
@@ -640,7 +640,12 @@
:sendmail => [%x{which sendmail 2>/dev/null}.chomp, "Where to find the
sendmail binary with which to send email."],
:reportfrom => ["report@" + [Facter["hostname"].value,
Facter["domain"].value].join("."), "The 'from' email address for the reports."],
- :smtpserver => ["none", "The server through which to send email
reports."]
+ :smtpserver => ["none", "The server through which to send email
reports."],
+ :smtpport => [25, "The smtp server's port."],
+ :smtphelo => [[Facter["hostname"].value,
Facter["domain"].value].join("."), "SMTP HELO domain."],
+ :smtpaccount => ["none", "SMTP AUTH account."],
+ :smtppassword => ["none", "SMTP AUTH password."],
+ :smtpauthtype => ["none", "SMTP AUTH type (plain or cram_md5)."]
)
setdefaults(
--- puppet/reports/tagmail.rb.~1~ 2010-10-02 10:08:57.000000000 +0900
+++ puppet/reports/tagmail.rb 2010-10-16 17:02:15.756435883 +0900
@@ -121,13 +121,24 @@
def send(reports)
pid = fork do
if Puppet[:smtpserver] != "none"
+ port = (Puppet[:smtpport] != "none") ? Puppet[:smtpport].to_i : 25
+ helo_domain = Puppet[:smtphelo]
+ if Puppet[:smtpaccount] != "none"
+ account = Puppet[:smtpaccount]
+ password = (Puppet[:smtppassword] != "none") ?
Puppet[:smtppassword] : nil
+ authtype = (Puppet[:smtpauthtype] != "none") ?
Puppet[:smtpauthtype].to_sym : nil
+ else
+ account = password = authtype = nil
+ end
begin
- Net::SMTP.start(Puppet[:smtpserver]) do |smtp|
+ Net::SMTP.start(Puppet[:smtpserver], port=port,
helo_domain=helo_domain,
+ account=account, password=password, authtype=authtype) do
|smtp|
reports.each do |emails, messages|
smtp.open_message_stream(Puppet[:reportfrom], *emails) do |p|
p.puts "From: #{Puppet[:reportfrom]}"
p.puts "Subject: Puppet Report for #{self.host}"
p.puts "To: " + emails.join(", ")
+ p.puts "Message-Id: #{Time.now.strftime('%Y%m%d%H%M%S') +
"-" + Puppet[:reportfrom]}"
p.puts "Date: #{Time.now.rfc2822}"
p.puts
p.puts messages
--
You have received this notification because you have either subscribed to it,
or are involved in it.
To change your notification preferences, please click here:
http://projects.puppetlabs.com/my/account
--
You received this message because you are subscribed to the Google Groups
"Puppet Bugs" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/puppet-bugs?hl=en.