Skip to content

Commit ec08c98

Browse files
committed
Ensuring we make 0600 for new keys
1 parent 5cf7798 commit ec08c98

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

‎chef/lib/chef/rest.rb‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ def register(name=Chef::Config[:node_name], destination=Chef::Config[:client_key
7979
Chef::Log.debug("Registration response: #{response.inspect}")
8080
raiseChef::Exceptions::CannotWritePrivateKey,"The response from the server did not include a private key!"unlessresponse.has_key?("private_key")
8181
# Write out the private key
82-
file=File.open(destination,"w")
82+
file=File.open(destination,File::WRONLY|File::EXCL|File::CREAT,0600)
8383
file.print(response["private_key"])
8484
file.close
8585
throw:done

0 commit comments

Comments
(0)