cookbook 'user-ssh-keys', '= 1.0.1'
user-ssh-keys (3) Versions 1.0.1 Follow4
Deploys SSH keys
cookbook 'user-ssh-keys', '= 1.0.1', :supermarket
knife supermarket install user-ssh-keys
knife supermarket download user-ssh-keys
user-ssh-keys-cookbook
Deploys SSH keys and authorized keys
Supported Platforms
- CentOS 6.5
- Debian 7
Attributes
The root key of all attributes is user_ssh_keys
.
Key | Type | Default | Description |
---|---|---|---|
data_bag |
String | ssh_keys |
Databag where to search for keys |
users |
Hash | {} |
A list of users with names as key |
Users
Key | Type | Default | Description |
---|---|---|---|
authorized_keys |
Array | [] |
Array of strings representing authorized SSH public keys |
authorized_users |
Array | [] |
Array of strings representing authorized users (found in the databag) |
LWRP
This cookbook provides one resource:
user_ssh_keys_key
user_ssh_keys_key 'john' do authorized_keys [ 'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDmz4D...', 'ssh-rsa sFE5JafGV4UmfxGP5/vpAAADWC8HcoQAyYT...' ] authorized_users %w(bob joe) end
This resource will add authorized keys from the provided list (authorized_keys
) and from users declared in the databag (bob
and joe
) to the john
user.
Databag
The databag is an Hash
with usernames as keys. Each user can have a list of keypairs (as an Array
).
A keypais is described as follow:
Key | Type | Default | Description |
---|---|---|---|
id |
String | nil |
Arbitrary name for the key |
priv |
String | nil |
Public key content |
pub |
String | nil |
Private key content |
Usage
You can use this cookbook in tow ways:
Both methods require you to define a databag to define SSH key pairs. Defining attributes is not required if you only want to use the LWRP.
user-ssh-keys::default
Include user-ssh-keys
in your node's run_list
:
{ "run_list": [ "recipe[user-ssh-keys]" ] }
Example databag
{ "bob": [ { "id": "my_key", "pub": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDmz4D...", "priv": [ "-----BEGIN RSA PRIVATE KEY-----", "MIIEpgIBAAKCAQEA5s+A461t/v8mQB9UQpaYwGWNl...", "...", "-----END RSA PRIVATE KEY-----" ] }, { "id": "my_other_key", "pub": "ssh-rsa sFE5JafGV4UmfxGP5/vpWC8HcoQAyYT...", "priv": [ "-----BEGIN RSA PRIVATE KEY-----", "XFQg/FfgRC+rwooxKXsxqjA/zapfkzFVBchsjmYpx...", "...", "-----END RSA PRIVATE KEY-----" ] } ] }
Dependent cookbooks
This cookbook has no specified dependencies.
Contingent cookbooks
There are no cookbooks that are contingent upon this one.
0.1.0
Initial release of ssh-keys
Foodcritic Metric
1.0.1 failed this metric
FC031: Cookbook without metadata file: /tmp/cook/e795142fc3bfae3bf3fa7210/user-ssh-keys/metadata.rb:1
FC045: Consider setting cookbook name in metadata: /tmp/cook/e795142fc3bfae3bf3fa7210/user-ssh-keys/metadata.rb:1
1.0.1 failed this metric
FC045: Consider setting cookbook name in metadata: /tmp/cook/e795142fc3bfae3bf3fa7210/user-ssh-keys/metadata.rb:1