How could I find the private key for chef?


#1

I am using aws chef automate for managing the nodes. However, when I tried to upload a cookbook I got the following error. Is there a way I can find the private key for chef.

thanks.

[root@chefworkstation chef-client-wrapper]# SSL_CERT_FILE=’/root/chef-repo/cookbooks/avery-chef-new-skijrwulpurzjp84/.chef/ca_certs/opsworks-cm-ca-2016-root.pem’ berks upload
There was an error connecting to the Chef Server
[root@chefworkstation chef-client-wrapper]# knife node list
WARNING: No knife configuration file found
WARN: Failed to read the private key /etc/chef/client.pem: #<Errno::ENOENT: No such file or directory @ rb_sysopen - /etc/chef/client.pem>
ERROR: Your private key could not be loaded from /etc/chef/client.pem
Check your configuration file and ensure that your private key is readable
[root@chefworkstation chef-client-wrapper]# find / -name “client.pem”
/usr/share/doc/m2crypto-0.21.1/demo/smime/client.pem
/usr/share/doc/m2crypto-0.21.1/demo/ssl/client.pem
[root@chefworkstation chef-client-wrapper]#


#2

That seems like you’ve not got a knife.rb configured which both berks and knife use to talk to your chef-server. It appears you are running as root and not a normal user which is likely, at least part of the problem.