aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2017-04-01 22:42:30 -0300
committerSilvio Rhatto <rhatto@riseup.net>2017-04-01 22:42:30 -0300
commitbccc6e33d394ce12ce89195a3eb0c73c6e2f797a (patch)
treee3047d148d8a17f7a329e3974ad76d4998d9ca17
parentb2e96fae1957229fb63649122023f5e0c3d3332a (diff)
downloadkvmx-bccc6e33d394ce12ce89195a3eb0c73c6e2f797a.tar.gz
kvmx-bccc6e33d394ce12ce89195a3eb0c73c6e2f797a.tar.bz2
Ensure any previous keys are removed at __kvmx_ssh_keygen
-rwxr-xr-xlib/kvmx/functions4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/kvmx/functions b/lib/kvmx/functions
index df1bd7a..134f4be 100755
--- a/lib/kvmx/functions
+++ b/lib/kvmx/functions
@@ -12,6 +12,10 @@
# Generate a keypair
function __kvmx_ssh_keygen {
if [ ! -z "$2" ]; then
+ # Ensure any previous keys are removed
+ rm -f $1 $1.pub
+
+ # Generate the keypair
ssh-keygen -t rsa -b 4096 -f $1 -N '' -C $2
fi
}