-
-
Notifications
You must be signed in to change notification settings - Fork 315
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
modules: misc: Add a small helper module
Maybe I'll collect enough small snippets that I can keep them in here until they get split out elsewhere to more appropriate places.
- Loading branch information
1 parent
13fc711
commit 9a752da
Showing
2 changed files
with
19 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import "os" | ||
|
||
# ssh_keygen creates an ssh key pair in the user's home directory if the private | ||
# key doesn't exist. | ||
# TODO: add more parameters such as key size and type in the future | ||
class ssh_keygen($user) { | ||
panic($user == "") # panic if $user is empty | ||
$p = os.expand_home("~${user}/") # eg: ~james/ | ||
exec "ssh-keygen-${user}" { | ||
cmd => "/usr/bin/ssh-keygen", | ||
args => [ | ||
"-t", "rsa", # type | ||
"-f", "${p}.ssh/id_rsa", # private key file | ||
"-N", "", # empty password | ||
], | ||
creates => "${p}.ssh/id_rsa", | ||
user => $user, | ||
} | ||
} |
Empty file.