cookbook 'ssh_auth_keys', '= 0.1.1'
ssh_auth_keys (4) Versions 0.1.1 Follow4
This recipe reads public ssh authorized keys from data bag and appends those in $HOME/.ssh/authorized_keys file
cookbook 'ssh_auth_keys', '= 0.1.1', :supermarket
knife supermarket install ssh_auth_keys
knife supermarket download ssh_auth_keys
ssh_auth_keys Cookbook
Description
This recipe reads public ssh authorized keys from data bag and appends those in $HOME/.ssh/authorized_keys file
It supports encrypted data baf supported
Requirements
Attributes
It Expects node[:ssh_auth_keys] to be a hash containing user name as key and data bag user name as value.
<table>
<tr>
<th>Key</th>
<th>Type</th>
<th>Description</th>
</tr>
<tr>
<td><tt>[:ssh_auth_keys]</tt></td>
<td>Ruby Hash</td>
<td>Ruby hash specifying user_name => databag_name </td>
</tr>
</table>
You can define hash in wrapper cookbook's default attributes as follows
default['ssh_auth_keys']['user_name'] = ["databag1", "databag2",.....]
Additional attributes can be tweaked see attributes/default.rb for Additional self explanatory attributes
.....wrapper_cookbook/attributes/default.rb
```
default['ssh_auth_keys']['root'] = ["user1", "user2", "bipin"]
default["ssh_auth_keys"]['bips'] = ["bipin"]
```
Platforms
- Centos-6.8
- Centos-7.1
- Centos-7.2
Chef
- Chef 12.0 or later
Cookbooks
ssh_auth_keys::default
Usage
You can define hash in wrapper cookbook's default attributes as follows
default['ssh_auth_keys']['user_name'] = ["databag1", "databag2",.....]
.....wrapper_cookbook/attributes/default.rb
```
default['ssh_auth_keys']['root'] = ["user1", "user2", "bipin"]
default["ssh_auth_keys"]['bips'] = ["bipin"]
And just include ssh_auth_keys
in your wrapper recipe:
include_recipe "ssh_auth_keys"
```
Node Configuration and run_list can be defined in json format:
Node configuration example to create authorized_keys for user root from data bag user1 user2 and bipin:
{
"ssh_auth_keys": {
"root": ["user1", "user2", "bipin"]
},
"run_list": [
"recipe[ssh_auth_keys]"
]
}
{
"ssh_auth_keys": {
"root": "user1"
},
"run_list": [
"recipe[ssh_auth_keys]"
]
}
Use knife to create a data bag named "users"
knife data bag create users
knife data bag users user1
{
"id": "user1",
"ssh_keys": "ssh-rsa BAASSS3Nz...YYYhCw== user1"
}
SSH options can be given with "ssh_options". They will prepend every given ssh-key.
knife data bag users bipin
{
"id": "bipin",
"ssh_keys": "ssh-rsa AAAAB3Nz...5D8F== bipin",
"ssh_options": "environment=\"REMOTE_USER=Foo Bar\""
}
Contributing
- Fork the repository on Github
- Create a named feature branch (like
add_component_x
) - Write your change
- Write tests for your change (if applicable)
- Run the tests, ensuring they all pass
- Submit a Pull Request using Github
License and Authors
TODO:
- Work on FC014: Consider extracting long ruby_block to library
- convert recipe to a Resource
Dependent cookbooks
This cookbook has no specified dependencies.
Contingent cookbooks
There are no cookbooks that are contingent upon this one.
ssh_auth_keys CHANGELOG
This file is used to list changes made in each version of the ssh_auth_keys cookbook.
0.1.0
- Bipin Bachhao - Initial release of ssh_auth_keys
Check the Markdown Syntax Guide for help with Markdown.
The Github Flavored Markdown page describes the differences between markdown on github and standard markdown.
Collaborator Number Metric
0.1.1 failed this metric
Failure: Cookbook has 0 collaborators. A cookbook must have at least 2 collaborators to pass this metric.
Foodcritic Metric
0.1.1 failed this metric
FC014: Consider extracting long ruby_block to library: /tmp/12a4b26b1bb19eb562a14412/ssh_auth_keys/recipes/default.rb:10
FC064: Ensure issues_url is set in metadata: /tmp/12a4b26b1bb19eb562a14412/ssh_auth_keys/metadata.rb:1
FC065: Ensure source_url is set in metadata: /tmp/12a4b26b1bb19eb562a14412/ssh_auth_keys/metadata.rb:1
0.1.1 failed this metric
0.1.1 failed this metric
FC014: Consider extracting long ruby_block to library: /tmp/12a4b26b1bb19eb562a14412/ssh_auth_keys/recipes/default.rb:10
FC064: Ensure issues_url is set in metadata: /tmp/12a4b26b1bb19eb562a14412/ssh_auth_keys/metadata.rb:1
FC065: Ensure source_url is set in metadata: /tmp/12a4b26b1bb19eb562a14412/ssh_auth_keys/metadata.rb:1