Bug #7173

Puppet master can't submit reports to an HTTP server using basic auth

Added by Nick Fagerlund about 1 year ago. Updated 4 months ago.

Status:Tests Insufficient Start date:04/19/2011
Priority:Normal Due date:
Assignee:- % Done:

0%

Category:-
Target version:-
Affected Puppet version: Branch:
Keywords:
Votes: 1

Description

If you turn on HTTP basic auth in Puppet Dashboard’s vhost config, Puppet is unable to communicate with it. Setting a reporturl of (for example) http://puppet:puppet@localhost:3000/reports will not cause puppet to authenticate itself to Dashboard.

The ENC script doesn’t work either; see issue #5126. The approach in Matt and my patch in comment 7 could probably be dropped into lib/reports/http.rb.


Related issues

related to Puppet - Feature #8465: allow SSL on reporturl Merged - Pending Release 07/18/2011
related to Puppet Dashboard - Feature #5126: Support Basic Auth in external_node registration script Closed 10/27/2010

History

Updated by Nick Fagerlund about 1 year ago

Wait, actually we’re already using the more detailed syntax for sending a request. So we just need to add the line req.basic_auth url.user, url.password if url.user somewhere and it shouuuulllldddd just work.

Updated by Ben Hughes about 1 year ago

Do you have anywhere I can test this please, a hack like the following might work:

diff --git i/lib/puppet/reports/http.rb w/lib/puppet/reports/http.rb
index 7ac54df..4bf1421 100644
--- i/lib/puppet/reports/http.rb
+++ w/lib/puppet/reports/http.rb
@@ -13,6 +13,7 @@ Puppet::Reports.register_report(:http) do
   def process
     url = URI.parse(Puppet[:reporturl])
     req = Net::HTTP::Post.new(url.path)
+    req.basic_auth url.user, url.password if url.user
     req.body = self.to_yaml
     req.content_type = "application/x-yaml"
     Net::HTTP.new(url.host, url.port).start {|http|

Updated by Ben Hughes about 1 year ago

  • Status changed from Unreviewed to Tests Insufficient

Should add some unit tests to it too really. Curses.

Updated by Jason Antman 4 months ago

Is there any update on this?

Updated by Daniel Pittman 4 months ago

Jason Antman wrote:

Is there any update on this?

Hey there. Not at this stage – part of the reason for the weekend “triage-a-thon” is to find tickets like this that had a solution, but which had dropped off the radar for some reason or other.

Ideally, someone hint, hint would take this, write a unit test that checks it sets the basic auth into the request, and then submit it as a pull request to Puppet after they signed the CLA.

Otherwise I will put this onto the list of things that the platform team should look to, and try to get to that soon.

Also available in: Atom PDF