The Puppet Labs Issue Tracker has Moved: https://tickets.puppetlabs.com

This issue tracker is now in read-only archive mode and automatic ticket export has been disabled. Redmine users will need to create a new JIRA account to file tickets using https://tickets.puppetlabs.com. See the following page for information on filing tickets with JIRA:

Bug #7173

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

Added by Nick Fagerlund about 5 years ago. Updated over 2 years ago.

Status:In Topic Branch Pending ReviewStart date:04/19/2011
Priority:NormalDue date:
Assignee:-% Done:

0%

Category:reports
Target version:-
Affected Puppet version: Branch:https://github.com/puppetlabs/puppet/pull/2081
Keywords:

We've Moved!

Ticket tracking is now hosted in JIRA: https://tickets.puppetlabs.com

This ticket is now tracked at: https://tickets.puppetlabs.com/browse/PUP-1068


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.

http.rb.patch Magnifier (752 Bytes) Gia Bao, 04/27/2013 04:33 am


Related issues

Related to Puppet Dashboard - Feature #5126: Support Basic Auth in external_node registration script Closed 10/27/2010
Related to Puppet - Feature #8465: allow SSL on reporturl Closed 07/18/2011
Duplicated by Puppet - Feature #22791: Basic Auth in Report URL Duplicate

History

#1 Updated by Nick Fagerlund about 5 years 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.

#2 Updated by Ben Hughes almost 5 years 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|

#3 Updated by Ben Hughes almost 5 years ago

  • Status changed from Unreviewed to Tests Insufficient

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

#4 Updated by Jason Antman over 4 years ago

Is there any update on this?

#5 Updated by Anonymous over 4 years 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.

#6 Updated by Gia Bao about 3 years ago

on puppet-3.2.0-rc1, I had to change /lib/puppet/reports/http.rb as in the attached patch file

#7 Updated by Adrien Thebo over 2 years ago

  • Category set to reports
  • Status changed from Tests Insufficient to In Topic Branch Pending Review

#8 Updated by Adrien Thebo over 2 years ago

  • Branch set to https://github.com/puppetlabs/puppet/pull/1975

#9 Updated by Stephen Gelman over 2 years ago

  • Branch changed from https://github.com/puppetlabs/puppet/pull/1975 to https://github.com/puppetlabs/puppet/pull/2081

New PR submitted

#10 Updated by Jason Antman over 2 years ago

Redmine Issue #7173 has been migrated to JIRA:

https://tickets.puppetlabs.com/browse/PUP-1068

Also available in: Atom PDF