cookbook 'ssh_keygen', '= 1.0.3'
ssh_keygen (3) Versions 1.0.3 Follow3
Chef resource for SSH key creation
cookbook 'ssh_keygen', '= 1.0.3', :supermarket
knife supermarket install ssh_keygen
knife supermarket download 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. -
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
: Only2048
and4096
are supported currently, default is2048
. -
type
: Onlyrsa
is supported currently. Ed25519 may be supported in future versions (feature request welcome!) -
comment
: Comment for the public key. Defaults touser@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 to0700
.
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.
Dependent cookbooks
poise ~> 2.0 |
Contingent cookbooks
There are no cookbooks that are contingent upon this one.
v1.0.3
Encode SSH public keys in correct format (OpenSSH format).
v1.0.0
Initial release
Foodcritic Metric
1.0.3 passed this metric
1.0.3 passed this metric