<commit_before># chef\_vault\_pki cookbook

Uses chef-vault to provide an easy to manage PKI for Chef managed servers.

Instead of having to manage and secure a CA, chef\vault\_pki lets you create a CA cert and key using the provided script which is then stored using chef\_vault. Authorised clients can then obtain the CA cert and key, and automatically generate their certificates.

# Requirements

Depends on [chef-vault](http://community.opscode.com/cookbooks/chef-vault) and [sensu\_spec](http://community.opscode.com/cookbooks/sensu_spec) cookbooks.

# Usage

## Creating a CA

Install the [chef-vault-pki](https://github.com/zeroXten/chef-vault-pki) command on your workstation.

Run
    $ bundle install

from here, or

    $ gem install chef-vault-pki

Running the `chef-vault-pki` will randomly generate CA certificate and key, and will output the PEMs as JSON by default. We pass this directly to chef-vault to create an encrypted data bag.

    $ chef-vault-pki | knife vault create chef_vault_pki chef_vault_pki_ca -J /dev/stdin --search 'role:base' --admins admin-user

We can see chef-vault created the data bag as required.

    $ ls data_bags/chef_vault_pki/
    chef_vault_pki_ca.json    chef_vault_pki_ca_keys.json

See the chef-vault documentation for more information on managing data bags encrypted with chef-vault.

## Using chef\_vault\_pki in a recipe

Add this to your cookbook's metadata.rb

    depends 'chef_vault_pki'<commit_msg>readme updates<commit_after># chef\_vault\_pki cookbook

Uses chef-vault to provide an easy-to-manage PKI for Chef managed servers.

Instead of having to manage and secure a CA, chef\_vault\_pki lets you generate a CA cert and key which is then stored and secured using chef-vault. Authorised clients can then obtain the CA cert and key, and automatically generate their certificates.

# Requirements

Depends on [chef-vault](http://community.opscode.com/cookbooks/chef-vault) and [sensu\_spec](http://community.opscode.com/cookbooks/sensu_spec) cookbooks.

# Usage

## Creating a CA

Install the [chef-vault-pki](https://github.com/zeroXten/chef-vault-pki) command on your workstation.

Run

    $ bundle install

from here, or

    $ gem install chef-vault-pki

Running chef-vault-pki will randomly generate a CA certificate and key, and will output the PEMs as JSON by default. We pass this directly to chef-vault to create an encrypted data bag.

    $ chef-vault-pki | knife vault create chef_vault_pki chef_vault_pki_ca -J /dev/stdin --search 'role:base' --admins admin-user

We can see chef-vault created the data bag as required.

    $ ls data_bags/chef_vault_pki/
    chef_vault_pki_ca.json    chef_vault_pki_ca_keys.json

See the chef-vault documentation for more information on managing data bags encrypted with chef-vault.

## Using chef\_vault\_pki in a recipe

Add this to your cookbook's metadata.rb

    depends 'chef_vault_pki'
{'fraction_non_alphanumeric': 0.07300275482093664, 'fraction_numerical': 0.0, 'mean_word_length': 4.052173913043478, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3644389', 'n_tokens_mistral': 960, 'n_tokens_neox': 923, 'n_words': 336}