Re: https report processor setup

38 views
Skip to first unread message

Ellison Marks

unread,
Oct 12, 2012, 3:23:27 PM10/12/12
to puppet...@googlegroups.com
I'm not sure there is any https report handler per se. The http report handler should handle both http and https with the 3.0.0 update, so you might try

reports = store, log, http

On Friday, October 12, 2012 11:57:56 AM UTC-7, Lou wrote:
hi,

I'm having difficulty setting up the built-in https report processor and I'm hoping somewhere here can provide some insight.

I've got a puppet agent and master set up and working correctly, at least as far as I can tell. What I need to do next is get information about any configuration changes made by the master on the agent and send it to an external application. Ideally I would do this by piggy-backing on the puppet reports functionality and just send the yaml reports to a remote REST service. From everything I've read this should be doable, even simple. Unfortunately that's not the case. I'm guessing I'm missing something basic, but I haven't been able to figure out what

This is what I have so far in puppet.conf on the master:

[master]
report = true
reports = store, log, https
reporturl = https:// ...

So the two things I think I'm missing are

1) how do I handle the cert for the https server

2) what URI(s) do I need to implement on the remote server


thanks,

Lou

Lou

unread,
Oct 12, 2012, 4:00:35 PM10/12/12
to puppet...@googlegroups.com
did try http, and from looking at the code I agree it should do what I want, but still have the same questions about cert and URI(s)

Ellison Marks

unread,
Oct 12, 2012, 4:33:08 PM10/12/12
to puppet...@googlegroups.com
As to the certs, I found this in the source, not sure if it actually answers the question, but hope it helps...

Any HTTPS requests made using this class will use Puppet's SSL
certificate configuration for their authentication, and
Provides some useful error handling for any SSL errors that occur
during a request.

For the URI... I'm not sure. Won't it go to whatever you tell it to go to in the reporturl setting?

Lou

unread,
Oct 12, 2012, 9:25:28 PM10/12/12
to puppet...@googlegroups.com
My fix turned out to be that I had to modify http.rb under /usr/lib/ruby/site_ruby/1.8/puppet/reports/ My new version looks like:

require 'puppet'
require 'net/http'
require 'net/https'    <==  added
require 'uri'

Puppet::Reports.register_report(:http) do

  desc <<-DESC
  Send report information via HTTP to the `reporturl`. Each host sends
  its report as a YAML dump and this sends this YAML to a client via HTTP POST.
  The YAML is the `report` parameter of the request."
  DESC


  def process
    url = URI.parse(Puppet[:reporturl])
    req = Net::HTTP::Post.new(url.path)
    req.body = self.to_yaml
    req.content_type = "application/x-yaml"

#    Net::HTTP.new(url.host, url.port).start {|http|
#          http.request(req)

         # add these lines to replace the above 2
    http = Net::HTTP.new(url.host, url.port)
    http.use_ssl = true
    req.basic_auth("username", "password")
    response = http.start {|http| http.request(req)

    }
  end
end

There's a more secure way to do this with certificates, I just haven't gotten there yet.

Jakov Sosic

unread,
Oct 12, 2012, 10:00:03 PM10/12/12
to puppet...@googlegroups.com
On 10/13/2012 03:25 AM, Lou wrote:
> My fix turned out to be that I had to modify http.rb under
> /usr/lib/ruby/site_ruby/1.8/puppet/reports/ My new version looks like:
>
> require 'puppet'
> require 'net/http'
> require 'net/https' <== added
> require 'uri'


Could you maybe open an issue, or if some of the developers read this,
could they add the fix to next version?

Reply all
Reply to author
Forward
0 new messages