https://github.com/vancluever/ssh_keygen
Chef resource for SSH key creation (Halite pattern)
https://github.com/vancluever/ssh_keygen
chef chef-resource cookbook ssh-keygen ssh-keys
Last synced: about 1 year ago
JSON representation
Chef resource for SSH key creation (Halite pattern)
- Host: GitHub
- URL: https://github.com/vancluever/ssh_keygen
- Owner: vancluever
- License: other
- Created: 2015-11-11T20:57:23.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2016-12-17T06:11:39.000Z (over 9 years ago)
- Last Synced: 2024-04-26T17:45:12.527Z (about 2 years ago)
- Topics: chef, chef-resource, cookbook, ssh-keygen, ssh-keys
- Language: Ruby
- Size: 29.3 KB
- Stars: 4
- Watchers: 4
- Forks: 4
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://supermarket.chef.io/cookbooks/ssh_keygen)
# ssh_keygen Chef Resource
This single-purpose cookbook provides a resource to create SSH keys, as you
would expect to be created with `ssh-keygen`.
## Usage and Example
Say you wanted to create a user (named after `test-kitchen`) and create an
SSH key for it:
```
group 'kitchen' do
action :create
end
user 'kitchen' do
action :create
group 'kitchen'
home '/home/kitchen'
manage_home true
end
directory '/home/kitchen/.ssh' do
action :create
end
ssh_keygen '/home/kitchen/.ssh/id_rsa' do
action :create
owner 'kitchen'
group 'kitchen'
strength 4096
type 'rsa'
comment 'kitchen@localhost'
passphrase 'changeme'
secure_directory true
end
```
The following would (after creating the `kitchen` user), generate an SSH private
key in `/home/kitchen/.ssh/id_rsa`, a public key in OpenSSH format in
`/home/kitchen/.ssh/id_rsa.pub`, and ensure the `.ssh` directory has secure
permissions as well (so mode `0700`).
### Attributes
The attributes for the `ssh_keygen` resource are:
* `action`: Only `:create` is supported. This resource does nothing if the file exists.
* `path`: The path to save the SSH key to (if different from the resource name).
* `owner`: The owner of the private and public key files.
* `group`: The group ID for the private and public key files.
* `strength`: Only `2048` and `4096` are supported currently, default is `2048`.
* `type`: Only `rsa` is supported currently.
Ed25519 may be supported in future versions (feature request welcome!)
* `comment`: Comment for the public key. Defaults to `user@host`.
* `passphrase`: Passphrase for an encrypted private key. The default is no passphrase.
* `secure_directory`: Sets the directory the key is saved in to mode to `0700`.
## Author and License
```
Copyright 2015 Chris Marchesi
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
```