[chef] Problem authenticating from console


Chronological Thread 
  • From: Albert Llop < >
  • To:
  • Subject: [chef] Problem authenticating from console
  • Date: Fri, 19 Feb 2010 13:17:55 +0100
  • Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:from:date:message-id:subject:to:content-type; b=WfvSRhB1f04Q1BB9PIdVMQNrmia6yYPEQuGpqm/yLHRg+NEZA2ewxE8koB9x2czk5h Fln2mgvSVvxm2USNoJntS1vF9ic2FLtiiohGY0AU3PvXaiABmHu+2vB+y4LJVHkxvh53 TTpbpiqOzKSZImhtmCxlZyE8esPx7/p2V8UZ0=

Hi there,
been trying to play a bit with the REST api for a couple of things we have in mind, and found myself quite unable to do so. Checking the source code (since I found nothing in the documentation) I saw the methods register and authenticate. Doing this:


require 'chef'
require 'chef/rest'
Chef::Config[:log_level] = :debug

r = Chef::REST.new("https://vmchef.imim.es")
r.register("rest_user","******")

I see positive feedback from the log and when I go to the chef web ui I can see a new registration. I validate it and even give it admin rights (although I'm not sure what is it for), and them I try to authenticate:

r.authenticate("rest_user","******")

And the log spits all of this:

[Fri, 19 Feb 2010 13:14:28 +0100] DEBUG: Authenticating rest_user via openid
[Fri, 19 Feb 2010 13:14:28 +0100] DEBUG: Sending HTTP Request via POST to /openid/consumer/start
[Fri, 19 Feb 2010 13:14:29 +0100] DEBUG: Sending HTTP Request via GET to /openid/server?openid.assoc_handle=%7BHMAC-SHA1%7D%7B4b7e9e83%7D%7ByluHRQ%3D%3D%7D&openid.claimed_id=http%3A%2F%2Flocalhost%3A4001%2Fopenid%2Fserver%2Fnode%2Frest_user&openid.identity=http%3A%2F%2Flocalhost%3A4001%2Fopenid%2Fserver%2Fnode%2Frest_user&openid.mode=checkid_setup&openid.ns=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0&openid.realm=https%3A%2F%2Fvmchef.imim.es%2Fopenid%2Fconsumer&openid.return_to=https%3A%2F%2Fvmchef.imim.es%2Fopenid%2Fconsumer%2Fcomplete
[Fri, 19 Feb 2010 13:14:29 +0100] ERROR: Connection refused connecting to localhost:4001 for /openid/server?openid.assoc_handle=%7BHMAC-SHA1%7D%7B4b7e9e83%7D%7ByluHRQ%3D%3D%7D&openid.claimed_id=http%3A%2F%2Flocalhost%3A4001%2Fopenid%2Fserver%2Fnode%2Frest_user&openid.identity=http%3A%2F%2Flocalhost%3A4001%2Fopenid%2Fserver%2Fnode%2Frest_user&openid.mode=checkid_setup&openid.ns=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0&openid.realm=https%3A%2F%2Fvmchef.imim.es%2Fopenid%2Fconsumer&openid.return_to=https%3A%2F%2Fvmchef.imim.es%2Fopenid%2Fconsumer%2Fcomplete 1/5
[Fri, 19 Feb 2010 13:14:34 +0100] ERROR: Connection refused connecting to localhost:4001 for /openid/server?openid.assoc_handle=%7BHMAC-SHA1%7D%7B4b7e9e83%7D%7ByluHRQ%3D%3D%7D&openid.claimed_id=http%3A%2F%2Flocalhost%3A4001%2Fopenid%2Fserver%2Fnode%2Frest_user&openid.identity=http%3A%2F%2Flocalhost%3A4001%2Fopenid%2Fserver%2Fnode%2Frest_user&openid.mode=checkid_setup&openid.ns=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0&openid.realm=https%3A%2F%2Fvmchef.imim.es%2Fopenid%2Fconsumer&openid.return_to=https%3A%2F%2Fvmchef.imim.es%2Fopenid%2Fconsumer%2Fcomplete 2/5
[Fri, 19 Feb 2010 13:14:39 +0100] ERROR: Connection refused connecting to localhost:4001 for /openid/server?openid.assoc_handle=%7BHMAC-SHA1%7D%7B4b7e9e83%7D%7ByluHRQ%3D%3D%7D&openid.claimed_id=http%3A%2F%2Flocalhost%3A4001%2Fopenid%2Fserver%2Fnode%2Frest_user&openid.identity=http%3A%2F%2Flocalhost%3A4001%2Fopenid%2Fserver%2Fnode%2Frest_user&openid.mode=checkid_setup&openid.ns=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0&openid.realm=https%3A%2F%2Fvmchef.imim.es%2Fopenid%2Fconsumer&openid.return_to=https%3A%2F%2Fvmchef.imim.es%2Fopenid%2Fconsumer%2Fcomplete 3/5
[Fri, 19 Feb 2010 13:14:44 +0100] ERROR: Connection refused connecting to localhost:4001 for /openid/server?openid.assoc_handle=%7BHMAC-SHA1%7D%7B4b7e9e83%7D%7ByluHRQ%3D%3D%7D&openid.claimed_id=http%3A%2F%2Flocalhost%3A4001%2Fopenid%2Fserver%2Fnode%2Frest_user&openid.identity=http%3A%2F%2Flocalhost%3A4001%2Fopenid%2Fserver%2Fnode%2Frest_user&openid.mode=checkid_setup&openid.ns=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0&openid.realm=https%3A%2F%2Fvmchef.imim.es%2Fopenid%2Fconsumer&openid.return_to=https%3A%2F%2Fvmchef.imim.es%2Fopenid%2Fconsumer%2Fcomplete 4/5
Errno::ECONNREFUSED: Connection refused - Connection refused connecting to localhost:4001 for /openid/server?openid.assoc_handle=%7BHMAC-SHA1%7D%7B4b7e9e83%7D%7ByluHRQ%3D%3D%7D&openid.claimed_id=http%3A%2F%2Flocalhost%3A4001%2Fopenid%2Fserver%2Fnode%2Frest_user&openid.identity=http%3A%2F%2Flocalhost%3A4001%2Fopenid%2Fserver%2Fnode%2Frest_user&openid.mode=checkid_setup&openid.ns=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0&openid.realm=https%3A%2F%2Fvmchef.imim.es%2Fopenid%2Fconsumer&openid.return_to=https%3A%2F%2Fvmchef.imim.es%2Fopenid%2Fconsumer%2Fcomplete, giving up
    from /Users/allop/.gem/ruby/1.8/gems/chef-0.7.16/lib/chef/rest.rb:206:in `run_request'
    from /Users/allop/.gem/ruby/1.8/gems/chef-0.7.16/lib/chef/rest.rb:231:in `run_request'
    from /Users/allop/.gem/ruby/1.8/gems/chef-0.7.16/lib/chef/rest.rb:95:in `post_rest'
    from /Users/allop/.gem/ruby/1.8/gems/chef-0.7.16/lib/chef/rest.rb:68:in `authenticate'
    from (irb):42

On the server side I only see this (in debug level log mode):

merb : worker (port 4000) ~ Started request handling: Fri Feb 19 15:56:08 +0100 2010
merb : worker (port 4000) ~ Routed to: {"submit"=>"Verify", "action"=>"start", "controller"=>"chef_server_slice/openid_consumer", "openid_identifier"=>"http://localhost:4001/openid/server/node/rest_user"}
merb : worker (port 4000) ~ Params: {"submit"=>"Verify", "action"=>"start", "controller"=>"chef_server_slice/openid_consumer", "openid_identifier"=>"http://localhost:4001/openid/server/node/rest_user"}
merb : worker (port 4001) ~ Started request handling: Fri Feb 19 15:56:08 +0100 2010
merb : worker (port 4001) ~ Routed to: {"action"=>"node_page", "id"=>"rest_user", "controller"=>"chef_server_slice/openid_server"}
merb : worker (port 4001) ~ Params: {"action"=>"node_page", "id"=>"rest_user", "controller"=>"chef_server_slice/openid_server"}
 ~ Sending HTTP Request via GET to /chef/openid_registration_rest_user
merb : worker (port 4001) ~ {:after_filters_time=>0.000202, :before_filters_time=>7.5e-05, :action_time=>0.005677, :dispatch_time=>0.006937}
merb : worker (port 4001) ~

 ~ Generated checkid_setup request to http://localhost:4001/openid/server with assocication {HMAC-SHA1}{4b7e9e83}{yluHRQ==}
 ~ Generated checkid_setup request to http://localhost:4001/openid/server with assocication {HMAC-SHA1}{4b7e9e83}{yluHRQ==}
merb : worker (port 4000) ~ Redirecting to: http://localhost:4001/openid/server?openid.assoc_handle=%7BHMAC-SHA1%7D%7B4b7e9e83%7D%7ByluHRQ%3D%3D%7D&openid.claimed_id=http%3A%2F%2Flocalhost%3A4001%2Fopenid%2Fserver%2Fnode%2Frest_user&openid.identity=http%3A%2F%2Flocalhost%3A4001%2Fopenid%2Fserver%2Fnode%2Frest_user&openid.mode=checkid_setup&openid.ns=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0&openid.realm=https%3A%2F%2Fvmchef.imim.es%2Fopenid%2Fconsumer&openid.return_to=https%3A%2F%2Fvmchef.imim.es%2Fopenid%2Fconsumer%2Fcomplete (302)
merb : worker (port 4000) ~ {:after_filters_time=>1.7e-05, :before_filters_time=>1.3e-05, :action_time=>0.019162, :dispatch_time=>0.019865}
merb : worker (port 4000) ~


I'll keep digging into this, but if someone has any idea it would be most welcome :D
--
{ :name => "Albert Llop" }



Archive powered by MHonArc 2.6.16.

§