HTTP Request Returned 401 Unauthorized: Failed to authenticate?


#1

Hi, I have following problem installing new node (I am installing it
in same way like rest of nodes), and I am pretty lost at this moment.

Where I should start debugging? (I replace my FQDN with example.com in
following example)

bluszcz@ubuntu:~/work/headnet/chef-repo-headnet$ knife bootstrap
khaki.example.com --sudo -x rafal
Bootstrapping Chef on khaki.example.com
khaki.example.com knife sudo password:
Enter your password:
khaki.example.com
khaki.example.com GET http://rubygems.org/latest_specs.4.8.gz
khaki.example.com 302 Found

khaki.example.com /usr/lib/ruby/gems/1.8/gems/chef-0.10.0/bin/shef
khaki.example.com /usr/bin/chef-client
khaki.example.com /usr/bin/chef-solo
khaki.example.com /usr/bin/knife
khaki.example.com /usr/bin/shef
khaki.example.com Successfully installed chef-0.10.0
khaki.example.com 1 gem installed
khaki.example.com [Wed, 08 Jun 2011 17:32:36 +0200] INFO: *** Chef 0.10.0 ***
khaki.example.com [Wed, 08 Jun 2011 17:32:40 +0200] INFO: HTTP Request
Returned 401 Unauthorized: Failed to authenticate as
khaki.example.com. Ensure that your node_name and client key are
correct.
khaki.example.com [Wed, 08 Jun 2011 17:32:40 +0200] FATAL: Stacktrace
dumped to /var/chef/cache/chef-stacktrace.out
khaki.example.com [Wed, 08 Jun 2011 17:32:40 +0200] FATAL:
Net::HTTPServerException: 401 "Unauthorized"
bluszcz@ubuntu:~/work/headnet/chef-repo-headnet$


Rafał Zawadzki
Senior Backend Developer


#2

Typical issue is out of time sync between chef server and node.

So always check that ntp daemon installed and ran.

2011/6/8 Rafal Bluszcz Zawadzki rafal@headnet.dk

Hi, I have following problem installing new node (I am installing it
in same way like rest of nodes), and I am pretty lost at this moment.

Where I should start debugging? (I replace my FQDN with example.com in
following example)

bluszcz@ubuntu:~/work/headnet/chef-repo-headnet$ knife bootstrap
khaki.example.com --sudo -x rafal
Bootstrapping Chef on khaki.example.com
khaki.example.com knife sudo password:
Enter your password:
khaki.example.com
khaki.example.com GET http://rubygems.org/latest_specs.4.8.gz
khaki.example.com 302 Found

khaki.example.com /usr/lib/ruby/gems/1.8/gems/chef-0.10.0/bin/shef
khaki.example.com /usr/bin/chef-client
khaki.example.com /usr/bin/chef-solo
khaki.example.com /usr/bin/knife
khaki.example.com /usr/bin/shef
khaki.example.com Successfully installed chef-0.10.0
khaki.example.com 1 gem installed
khaki.example.com [Wed, 08 Jun 2011 17:32:36 +0200] INFO: *** Chef 0.10.0


khaki.example.com [Wed, 08 Jun 2011 17:32:40 +0200] INFO: HTTP Request
Returned 401 Unauthorized: Failed to authenticate as
khaki.example.com. Ensure that your node_name and client key are
correct.
khaki.example.com [Wed, 08 Jun 2011 17:32:40 +0200] FATAL: Stacktrace
dumped to /var/chef/cache/chef-stacktrace.out
khaki.example.com [Wed, 08 Jun 2011 17:32:40 +0200] FATAL:
Net::HTTPServerException: 401 "Unauthorized"
bluszcz@ubuntu:~/work/headnet/chef-repo-headnet$


Rafał Zawadzki
Senior Backend Developer


#3

Nowadays, Chef gives a clear message if client and server are out of
sync. Rafal’s case is not like that. Check that in the server, the
name specified there for the node is exactly the same as specified in
/etc/chef/client.rb (or wherever your config is). If these are OK, I
suggest you regenerate the client key on the server and put the new
private key on the node and retry.

On 8 June 2011 17:53, Akzhan Abdulin akzhan.abdulin@gmail.com wrote:

Typical issue is out of time sync between chef server and node.
So always check that ntp daemon installed and ran.

2011/6/8 Rafal Bluszcz Zawadzki rafal@headnet.dk

Hi, I have following problem installing new node (I am installing it
in same way like rest of nodes), and I am pretty lost at this moment.

Where I should start debugging? (I replace my FQDN with example.com in
following example)

bluszcz@ubuntu:~/work/headnet/chef-repo-headnet$ knife bootstrap
khaki.example.com --sudo -x rafal
Bootstrapping Chef on khaki.example.com
khaki.example.com knife sudo password:
Enter your password:
khaki.example.com
khaki.example.com GET http://rubygems.org/latest_specs.4.8.gz
khaki.example.com 302 Found

khaki.example.com /usr/lib/ruby/gems/1.8/gems/chef-0.10.0/bin/shef
khaki.example.com /usr/bin/chef-client
khaki.example.com /usr/bin/chef-solo
khaki.example.com /usr/bin/knife
khaki.example.com /usr/bin/shef
khaki.example.com Successfully installed chef-0.10.0
khaki.example.com 1 gem installed
khaki.example.com [Wed, 08 Jun 2011 17:32:36 +0200] INFO: *** Chef 0.10.0


khaki.example.com [Wed, 08 Jun 2011 17:32:40 +0200] INFO: HTTP Request
Returned 401 Unauthorized: Failed to authenticate as
khaki.example.com. Ensure that your node_name and client key are
correct.
khaki.example.com [Wed, 08 Jun 2011 17:32:40 +0200] FATAL: Stacktrace
dumped to /var/chef/cache/chef-stacktrace.out
khaki.example.com [Wed, 08 Jun 2011 17:32:40 +0200] FATAL:
Net::HTTPServerException: 401 "Unauthorized"
bluszcz@ubuntu:~/work/headnet/chef-repo-headnet$


Rafał Zawadzki
Senior Backend Developer


#4

Hi guys, thanks for reply.

Yesterday I posted link my problem on IRC and Joshua helped me immedietaly -
the problem was that I already bootstraped this box as node, but with bad
FQDN.

Later, I removed the node from the platform - and bootstraped again.

After removing /etc/chef/client.pem (which came with previously bootstrap)
everything started to work.

On Thu, Jun 9, 2011 at 8:02 AM, Ringo De Smet ringo.desmet@gmail.comwrote:

Nowadays, Chef gives a clear message if client and server are out of
sync. Rafal’s case is not like that. Check that in the server, the
name specified there for the node is exactly the same as specified in
/etc/chef/client.rb (or wherever your config is). If these are OK, I
suggest you regenerate the client key on the server and put the new
private key on the node and retry.

On 8 June 2011 17:53, Akzhan Abdulin akzhan.abdulin@gmail.com wrote:

Typical issue is out of time sync between chef server and node.
So always check that ntp daemon installed and ran.

2011/6/8 Rafal Bluszcz Zawadzki rafal@headnet.dk

Hi, I have following problem installing new node (I am installing it
in same way like rest of nodes), and I am pretty lost at this moment.

Where I should start debugging? (I replace my FQDN with example.com in
following example)

bluszcz@ubuntu:~/work/headnet/chef-repo-headnet$ knife bootstrap
khaki.example.com --sudo -x rafal
Bootstrapping Chef on khaki.example.com
khaki.example.com knife sudo password:
Enter your password:
khaki.example.com
khaki.example.com GET http://rubygems.org/latest_specs.4.8.gz
khaki.example.com 302 Found

khaki.example.com /usr/lib/ruby/gems/1.8/gems/chef-0.10.0/bin/shef
khaki.example.com /usr/bin/chef-client
khaki.example.com /usr/bin/chef-solo
khaki.example.com /usr/bin/knife
khaki.example.com /usr/bin/shef
khaki.example.com Successfully installed chef-0.10.0
khaki.example.com 1 gem installed
khaki.example.com [Wed, 08 Jun 2011 17:32:36 +0200] INFO: *** Chef
0.10.0


khaki.example.com [Wed, 08 Jun 2011 17:32:40 +0200] INFO: HTTP Request
Returned 401 Unauthorized: Failed to authenticate as
khaki.example.com. Ensure that your node_name and client key are
correct.
khaki.example.com [Wed, 08 Jun 2011 17:32:40 +0200] FATAL: Stacktrace
dumped to /var/chef/cache/chef-stacktrace.out
khaki.example.com [Wed, 08 Jun 2011 17:32:40 +0200] FATAL:
Net::HTTPServerException: 401 "Unauthorized"
bluszcz@ubuntu:~/work/headnet/chef-repo-headnet$


Rafał Zawadzki
Senior Backend Developer


Rafał Zawadzki
Senior Backend Developer


#5

Rafal,

On 9 June 2011 11:17, Rafal Bluszcz Zawadzki rafal@headnet.dk wrote:

Hi guys, thanks for reply.
Yesterday I posted link my problem on IRC and Joshua helped me immedietaly -
the problem was that I already bootstraped this box as node, but with bad
FQDN.
Later, I removed the node from the platform - and bootstraped again.

The FQDN has hit me multiple times. As such, I always specify my node
name explicitly, independent from the FQDN. As such, I can also let
Chef configure the hostname from my cookbooks.

Ringo


#6

Hi Ringo,

Can you write me more “explicity providing name” - independent from FQDN?

Cheers,

Rafał

On Thu, Jun 9, 2011 at 11:34 AM, Ringo De Smet ringo.desmet@gmail.comwrote:

Rafal,

On 9 June 2011 11:17, Rafal Bluszcz Zawadzki rafal@headnet.dk wrote:

Hi guys, thanks for reply.
Yesterday I posted link my problem on IRC and Joshua helped me
immedietaly -
the problem was that I already bootstraped this box as node, but with bad
FQDN.
Later, I removed the node from the platform - and bootstraped again.

The FQDN has hit me multiple times. As such, I always specify my node
name explicitly, independent from the FQDN. As such, I can also let
Chef configure the hostname from my cookbooks.

Ringo


Rafał Zawadzki
Senior Backend Developer


#7

Rafal,

2011/6/9 Rafal Bluszcz Zawadzki rafal@headnet.dk:

Hi Ringo,
Can you write me more “explicity providing name” - independent from FQDN?

If you use “knife bootstrap”, you can use the --node-name argument to
specify a name yourself. This will override the default value of the
FQDN.

http://help.opscode.com/kb/knife/knife-bootstrap

Hope this helps.

Ringo