- From: Alex Howells <
>
- To:
- Subject: [chef] Re: retrieving public keys of knife users
- Date: Wed, 15 Aug 2012 15:12:41 +0100
On 15 August 2012 10:40, Louis Garman
<
>
wrote:
>
In a cookbook I'd like to retrieve the public keys of each knife user.
>
I assume a "knife user" to be a chef API client with the admin
>
privilege.
>
>
But when I run this in shef (with -z) on a non-admin node:
>
>
Chef::ApiClient.load('knife-user')['public_key']
>
# or Chef::ApiClient.list
>
>
I get a 403 response. In both open source and private chef.
>
>
Why would access to this information be forbidden? Anyone know of a
>
slick workaround?
chef > x =
Chef::REST.new(Chef::Config[:chef_server_url]).get_rest("clients/foo")
=> client[foo]
chef > x.public_key
=> "-----BEGIN RSA PUBLIC
KEY-----\nMIIBCgKCAQEArWFbpLaXlcTRwaNIwG71Y8XEMKAkE0Aq4BeHQCK5CNnS7mhrFgPM\nKbLA4M27Z7Zph9nrFW5Kka3uRKDO7lhmvMrZjJZjl9Hq1kiy1DL7YY7HujW1RVwM\nvRv0NTAevM4A+yFIeq/QsI6kzIKIVIBNdG6KtPf5gmqfHrSJJbKrPmwXOC6dMy1q\n/0ptd+79u2crkCSb9ItlW3gs7FjReBxKQ8IAU3ZiBveKCk6JFdqoiw9DG59oeBDB\nJcT5NzE8lInn8prxkHl5uENu5MUB3Fp0iDk2PuxQA1Po1egxUsEKThj1ZYxY2fbk\nbDEvVfeOXZSCXI+SZQmgMWcHXX5Z4hB/IwIDAQAB\n-----END
RSA PUBLIC KEY-----\n"
Archive powered by MHonArc 2.6.16.