diff options
author | Silvio Rhatto <rhatto@riseup.net> | 2017-03-29 22:36:02 -0300 |
---|---|---|
committer | Silvio Rhatto <rhatto@riseup.net> | 2017-03-29 22:36:02 -0300 |
commit | def8ac5d7c0d14362ff21fbc89f0921d94a837da (patch) | |
tree | 9de7a0131a6b63b11dd5d4a4c1faff16a6cf89b5 /kvmx | |
parent | 96c1c6a94904b9a408ecfa87e0f488acdc724422 (diff) | |
download | kvmx-def8ac5d7c0d14362ff21fbc89f0921d94a837da.tar.gz kvmx-def8ac5d7c0d14362ff21fbc89f0921d94a837da.tar.bz2 |
Put SSH keys inside a ssh/ folder
Diffstat (limited to 'kvmx')
-rwxr-xr-x | kvmx | 13 |
1 files changed, 8 insertions, 5 deletions
@@ -116,8 +116,9 @@ function __kvmx_initialize { LOGFILE="$STATE_DIR/log" SPICEFILE="$STATE_DIR/spice" - if [ -e "$STORAGE/$VM.key" ]; then - SSHKEY="$STORAGE/$VM.key" + if [ -e "$STORAGE/ssh/$VM.key" ]; then + mkdir -p "$STORAGE/ssh" + SSHKEY="$STORAGE/ssh/$VM.key" else SSHKEY="$APP_BASE/share/ssh/insecure_private_key" fi @@ -191,7 +192,7 @@ function kvmx_up { if [ ! -z "$basebox" ]; then if [ -e "$GLOBAL_USER_CONFIG_FOLDER/$basebox" ]; then baseimage="`kvmx list_image $basebox`" - basekey="`basename $baseimage .img`.key" + basekey="`dirname $baseimage`/ssh/`basename $baseimage .img`.key" if [ ! -e "$baseimage" ]; then echo "$BASENAME: could not find basebox $baseimage. Please create it first." @@ -202,7 +203,9 @@ function kvmx_up { cp $baseimage $image if [ -e "$basekey" ]; then - imagekey="`basename $image .img`.key" + imagekey="`dirname $image`/ssh/`basename $image .img`.key" + mkdir "`dirname $image`/ssh" + cp $basekey $imagekey cp $basekey.pub $imagekey.pub @@ -674,7 +677,7 @@ function kvmx_log { # Rotate SSH keys function kvmx_rotate_sshkeys { # Generate new keypair - SSHKEY="$STORAGE/$VM.key" + SSHKEY="$STORAGE/ssh/$VM.key" $DIRNAME/kvmx-keygen $SSHKEY.new "$user@`basename $image .img`" # Replace pubkey on server |