canonical / canonical/cloud-init

validation_key in client.rb should be filepath not actual validation key content

Open
#2,645 2 comments 0 reactions 0 assignees View on GitHub
bug launchpad
Dominant language
Python
Stars
3.8k
Forks
1.1k
Avg merge
2d 23h
Merged PRs (30d)
18

Description

This bug was originally filed in Launchpad as [LP: #1568940](https://bugs.launchpad.net/cloud-init/+bug/1568940)

Launchpad details

affected_projects = []

assignee = None
assignee_name = None
date_closed = None
date_created = 2016-04-11T15:55:04.280847+00:00
date_fix_committed = None
date_fix_released = None
id = 1568940
importance = medium
is_complete = False
lp_url = https://bugs.launchpad.net/cloud-init/+bug/1568940
milestone = None
owner = philoliva8
owner_name = Philip Oliva
private = False
status = triaged
submitter = philoliva8
submitter_name = Philip Oliva
tags = ['chef']
duplicates = []

_Launchpad user **Philip Oliva(philoliva8)** wrote on 2016-04-11T15:55:04.280847+00:00_

The chef example shows that you need to pass validation key content in user data (http://cloudinit.readthedocs.org/en/latest/topics/examples.html#install-and-run-chef-recipes) which will populate /etc/chef/validation.pem. This populates /etc/chef/validation.pem correctly on your vm but unfortunately puts this content as the value of validation_key in /etc/chef/client.rb. This value should be a file path as per documentation: https://docs.chef.io/config_rb_client.html.

validation_key
The location of the file that contains the key used when a chef-client is registered with a Chef server. A validation key is signed using the validation_client_name for authentication. Default value: /etc/chef/validation.pem.

When you try to run chef-client on this node you will get the following error:

Creating a new client identity for poliva-bescloud-admin.poliva.dev.altus.bblabs using the validator key.

================================================================================
Chef encountered an error attempting to create the client "poliva-bescloud-admin.poliva.dev.altus.bblabs"
================================================================================

Private Key Not Found:
----------------------
Your private key could not be loaded. If the key file exists, ensure that it is
readable by chef-client.

Relevant Config Settings:
-------------------------
validation_key "-----BEGIN RSA PRIVATE KEY-----

-----END RSA PRIVATE KEY-----"

I have noticed that when running chef-client as daemon though you do not hit this problem (not sure why). But in my case I didn't want to run in daemon mode.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.