Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Missing Private key error when creating Encrypted Data Bag with Knife

Tags:

chef-infra

I'm trying to create an encrypted Data bag to store a Mysql password and followed the instructions here to run this command:

knife data bag create --secret-file /tmp/my_data_bag_key passwords mysql

This returns an error:

Error: "Your private key could not be loaded from /Users/ClientName/.chef/ClientName.pem" Check your configuration file and ensure that your private key is readable

Now there is no .pem file at that location.But do I really need one? For Chef solo? If I do, then how do I create this file?

like image 888
udit Avatar asked Mar 12 '26 21:03

udit


2 Answers

This command works by connecting to a chef server. If you don't have a key, this will fail. However, this knife plugin seems to do what you are looking for:

https://github.com/cparedes/knife-file

N.B., I have not used this plugin, but it looks right to me

like image 186
turtlebender Avatar answered Mar 16 '26 11:03

turtlebender


The gist of it is that the Opscode links in the original post that point to Encrypted Data Bag creation instructions will not work for Chef-solo. The way to make Encrypted Data Bags work with Chef-solo is described here.

like image 26
udit Avatar answered Mar 16 '26 09:03

udit