User.authenticate broken
joelmoss opened this issue · 4 comments
Seems that User.authenticate
is not working...
irb(main):052:0> ChefAPI::Resource::User.authenticate username: 'joelmoss', password: 'something'
ChefAPI::Connection | ===> POST /authenticate_user...
ChefAPI::Connection | Chef flavor: :open_source
ChefAPI::Connection | ===> Building URI...
ChefAPI::Connection | Detected URI is relative
ChefAPI::Connection | Appending /authenticate_user to https://X.com
ChefAPI::Connection | ===> Adding request headers...
ChefAPI::Connection | Accept: application/json
ChefAPI::Connection | Content-Type: application/json
ChefAPI::Connection | Connection: keep-alive
ChefAPI::Connection | Keep-Alive: 30
ChefAPI::Connection | User-Agent: ChefAPI Ruby Gem 0.5.0
ChefAPI::Connection | X-Chef-Version: 11.4.0
ChefAPI::Connection | ===> Detected form data
ChefAPI::Connection | ===> Adding signed header authentication...
ChefAPI::Authentication | ===> Parsing private key...
ChefAPI::Authentication | Detected private key is the path to a file
ChefAPI::Connection | X-Ops-Sign: algorithm=sha1;version=1.0;
ChefAPI::Connection | X-Ops-Userid: chef-webui
ChefAPI::Connection | X-Ops-Timestamp: 2014-07-23T22:22:24Z
ChefAPI::Connection | X-Ops-Content-Hash: MX2/hAzVT2IPTTXtlKrGf9AzXOo=
ChefAPI::Connection | X-Ops-Authorization-1: x
ChefAPI::Connection | X-Ops-Authorization-2: x
ChefAPI::Connection | X-Ops-Authorization-3: x
ChefAPI::Connection | X-Ops-Authorization-4: x
ChefAPI::Connection | X-Ops-Authorization-5: x
ChefAPI::Connection | X-Ops-Authorization-6: x
ChefAPI::Connection | Raw response:
ChefAPI::Connection | {"error":["internal service error"]}
ChefAPI::Connection | ===> Parsing response as error...
ChefAPI::Connection | Detected error response as JSON
ChefAPI::Connection | Parsing error response as JSON
ChefAPI::Error::HTTPServerUnavailable: The Chef Server is currently unavailable or is not currently accepting client connections. Please ensure the server is accessible via ping or telnet on your local network. If this error persists, please contact your network administrator.
from /usr/local/opt/rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/chef-api-0.5.0/lib/chef-api/connection.rb:425:in `error'
from /usr/local/opt/rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/chef-api-0.5.0/lib/chef-api/connection.rb:282:in `block in request'
from /usr/local/opt/rbenv/versions/2.1.2/lib/ruby/2.1.0/net/http.rb:853:in `start'
from /usr/local/opt/rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/chef-api-0.5.0/lib/chef-api/connection.rb:268:in `request'
from /usr/local/opt/rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/chef-api-0.5.0/lib/chef-api/connection.rb:122:in `post'
from /usr/local/opt/rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/chef-api-0.5.0/lib/chef-api/resources/user.rb:78:in `authenticate'
from (irb):52
from /usr/local/opt/rbenv/versions/2.1.2/bin/irb:11:in `<main>'
Ridley's user.authenticate
method works with the same server and credentials.
thx
What version of OSC is this?
Thanks, but can you shed some light on the differences (if any) between how this method is used on the open source server and enterprise? It works when using open source chef server, but with enterprise (hosted) chef, I get...
ChefAPI::Connection | ===> POST /authenticate_user...
ChefAPI::Connection | Chef flavor: :enterprise
ChefAPI::Connection | ===> Building URI...
ChefAPI::Connection | Detected URI is relative
ChefAPI::Connection | Appending /authenticate_user to https://api.opscode.com/organizations/maitre_d
ChefAPI::Connection | ===> Adding request headers...
ChefAPI::Connection | Accept: application/json
ChefAPI::Connection | Content-Type: application/json
ChefAPI::Connection | Connection: keep-alive
ChefAPI::Connection | Keep-Alive: 30
ChefAPI::Connection | User-Agent: ChefAPI Ruby Gem 0.5.0
ChefAPI::Connection | X-Chef-Version: 11.4.0
ChefAPI::Connection | ===> Detected regular body
ChefAPI::Connection | ===> Adding signed header authentication...
ChefAPI::Authentication | ===> Parsing private key...
ChefAPI::Authentication | Detected private key is the path to a file
ChefAPI::Connection | X-Ops-Sign: algorithm=sha1;version=1.0;
ChefAPI::Connection | X-Ops-Userid: maitre_d_rails
ChefAPI::Connection | X-Ops-Timestamp: 2014-08-02T10:41:08Z
ChefAPI::Connection | X-Ops-Content-Hash: 5aCvn0u70MyjWssDOYHK3xvlQ3k=
ChefAPI::Connection | X-Ops-Authorization-1: EcwaxFGNfsN1qGKCuta3bgxsLjyokUhp64f9uJRXKhM2q80fq4xQbERviG8/
ChefAPI::Connection | X-Ops-Authorization-2: cpRCYqM0IK8TMOeNvQI9mYGXJupeOiLcyC2gm8pcU/19dihLyZ/6NIeQ0gXV
ChefAPI::Connection | X-Ops-Authorization-3: orgSqDXvyUZIMfXnqoeZfFEn0cQ4xkoJ8tyd1/s4Vaov4DWrT6F+FGsaofxg
ChefAPI::Connection | X-Ops-Authorization-4: aCIYmaqLBn+NFXnHR8/ZAvwOCETJ3U6plI7X/q737CeD5k8kR8+J71INlywW
ChefAPI::Connection | X-Ops-Authorization-5: 5H2APGVtys2XDhrbEzYuFk/vUCNYBjm8h+eohk/GgK9vmJ01IAM6iU/PJJRm
ChefAPI::Connection | X-Ops-Authorization-6: WKidc3IOH5LIV57IxBWvzkazs0IXtH7nro4lZGQaMg==
ChefAPI::Connection | Raw response:
ChefAPI::Connection | { "error": "404 - Not Found: Sorry, I can't find what you are looking for." }
ChefAPI::Connection | ===> Parsing response as error...
ChefAPI::Connection | Detected error response as JSON
ChefAPI::Connection | Parsing error response as JSON
ChefAPI::Error::HTTPNotFound - The requested URL does not exist on the Chef Server.
{"error"=>"404 - Not Found: Sorry, I can't find what you are looking for."}
@joelmoss sure. From what I understand, the authenticate_user
endpoint is called on /
, not /organizations/NAME
as I see in your output. Even so, on Hosted Chef, I do not believe you are authorized to perform an authentication request.
Remember, you are authenticating to the server, not an organization (just like a username/password on hosted chef).