Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
libre
keyringer-macosx
Commits
1cbca4d9
Commit
1cbca4d9
authored
Mar 17, 2015
by
Silvio Rhatto
Browse files
Rename genkeys functions (#69)
parent
53f108e2
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
13 deletions
+18
-13
lib/keyringer/actions/genkeys
lib/keyringer/actions/genkeys
+18
-13
No files found.
lib/keyringer/actions/genkeys
View file @
1cbca4d9
...
...
@@ -4,10 +4,10 @@
#
# This script is just a wrapper to easily generate keys for
# automated systems.
#
#
# Generate a keypair, ssh version
function
gen
pair
_ssh
{
function
gen
keys
_ssh
{
echo
"Make sure that
$KEYDIR
is atop of an encrypted volume."
read
-p
"Hit ENTER to continue."
prompt
...
...
@@ -27,11 +27,11 @@ function genpair_ssh {
cat
"
$TMPWORK
/id_rsa.pub"
>
"
$OUTFILE
.pub"
fi
echo
"Done"
echo
"Done"
}
# Generate a keypair, gpg version
function
gen
pair
_gpg
{
function
gen
keys
_gpg
{
echo
"Make sure that
$KEYDIR
is atop of an encrypted volume."
passphrase
=
"no"
...
...
@@ -47,7 +47,7 @@ function genpair_gpg {
echo
"Password don't match."
fi
done
# TODO: insert random bytes
# TODO: custom Name-Comment and Name-Email
# TODO: allow for empty passphrases
...
...
@@ -78,11 +78,16 @@ EOF
$GPG
--armor
--homedir
"
$TMPWORK
"
--export
>
"
$OUTFILE
.pub"
fi
echo
"Done"
echo
"Done"
}
# Alias
function
genkeys_ssl
{
genkeys_x509
$*
}
# Generate a keypair, ssl version
function
gen
pair_ssl
{
function
gen
keys_x509
{
echo
"Make sure that
$KEYDIR
is atop of an encrypted volume."
read
-p
"Hit ENTER to continue."
prompt
...
...
@@ -148,7 +153,7 @@ EOF
cat
"
${
NODE
}
_privatekey.pem"
| keyringer_exec encrypt
"
$BASEDIR
"
"
$FILE
.pem"
echo
"Encrypting certificate request into keyringer..."
cat
"
${
NODE
}
_csr.pem"
| keyringer_exec encrypt
"
$BASEDIR
"
"
$FILE
.csr"
if
[
"
$KEYTYPE
"
==
"ssl-self"
]
;
then
echo
"Encrypting certificate into keyringer..."
cat
"
${
NODE
}
.crt"
| keyringer_exec encrypt
"
$BASEDIR
"
"
$FILE
.crt"
...
...
@@ -191,9 +196,9 @@ CWD="`pwd`"
# Verify
if
[
-z
"
$NODE
"
]
;
then
echo
-e
"Usage: keyringer <keyring>
$BASENAME
<gpg|ssh|
ssl|ssl
-self> <file> <hostname> [outfile]"
echo
-e
"Usage: keyringer <keyring>
$BASENAME
<gpg|ssh|
x509|x509
-self> <file> <hostname> [outfile]"
echo
-e
"Options:"
echo
-e
"
\t
gpg|ssh|
ssl
[-self]: key type."
echo
-e
"
\t
gpg|ssh|
x509
[-self]: key type."
echo
-e
"
\t
file : base file name for encrypted output (relative to keys folder),"
echo
-e
"
\t
without spaces"
echo
-e
"
\t
hostname : host for the key pair"
...
...
@@ -210,10 +215,10 @@ keyringer_set_tmpfile genpair -d
# Dispatch
echo
"Generating
$KEYTYPE
key for
$NODE
..."
if
[
"
$KEYTYPE
"
==
"ssl-self"
]
;
then
gen
pair_ssl
if
[
"
$KEYTYPE
"
==
"ssl-self"
]
||
[
"
$KEYTYPE
"
==
"x509-self"
]
;
then
gen
keys_x509
else
gen
pair
_
"
$KEYTYPE
"
gen
keys
_
"
$KEYTYPE
"
fi
# Cleanup
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment