From 9861c861b55e7f8efca6532a3968b16eb59e9e58 Mon Sep 17 00:00:00 2001 From: Silvio Rhatto Date: Fri, 24 Mar 2017 13:48:48 -0300 Subject: Initialize the clipboard at kvmx-vdagent --- README.md | 1 + kvmx | 10 +++++++++- kvmx-create | 2 ++ kvmx-vdagent | 6 ++++++ kvmxfile | 3 +++ 5 files changed, 21 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 5410818..21092a4 100644 --- a/README.md +++ b/README.md @@ -46,6 +46,7 @@ If no folder is specified, the current folder is assumed as the project home. ## Further development +* Support for custom SSH keypair per virtual machine. * Remount shared folders and reinitialize spice-vdagent upon resume from disk. * More params (memory, cpus, ssh, serial console, additional shared folders, etc). * Integration with [image-bootstrap](https://github.com/hartwork/image-bootstrap). diff --git a/kvmx b/kvmx index a6bd52c..6f9c582 100755 --- a/kvmx +++ b/kvmx @@ -74,7 +74,6 @@ function __kvmx_initialize { # Default parameters PORT="$(($RANDOM + 1024))" SSH="$(($PORT + 22))" - SSH_COMMAND="ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o LogLevel=FATAL -o ProxyCommand=none -i $APP_BASE/share/ssh/insecure_private_key" SSH_LOGIN="user" # Initalize @@ -112,6 +111,15 @@ function __kvmx_initialize { SSHFILE="$STATE_DIR/ssh" LOGFILE="$STATE_DIR/log" SPICEFILE="$STATE_DIR/spice" + + if [ -e "$STORAGE/$VM.key" ]; then + SSHKEY="$STORAGE/$VM.key" + else + SSHKEY="$APP_BASE/share/ssh/insecure_private_key" + fi + + SSH_COMMAND="ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o LogLevel=FATAL -o ProxyCommand=none -i $SSHKEY" + mkdir -p $STATE_DIR if [ ! -e "$image" ] && [ "$ACTION" != "up" ] && [ "$ACTION" != "purge" ] && [ "$ACTION" != "destroy" ]; then diff --git a/kvmx-create b/kvmx-create index d06c2b4..31646eb 100755 --- a/kvmx-create +++ b/kvmx-create @@ -103,6 +103,8 @@ function kvmx_config { kvmx_user_config arch amd64 "System arch" kvmx_user_config version stretch "Distro version" kvmx_user_config mirror http://http.debian.net/debian/ "Debian mirror" + kvmx_user_config ssh_support y "Administration using passwordless SSH (y/n)" + kvmx_user_config ssh_custom y "Setup a custom SSH keypair (y/n)" } # Load config file diff --git a/kvmx-vdagent b/kvmx-vdagent index 9437a8e..e938b74 100755 --- a/kvmx-vdagent +++ b/kvmx-vdagent @@ -30,3 +30,9 @@ done if which spice-vdagent &> /dev/null ; then spice-vdagent fi + +# Initialize the clipboard with some content: this seems necessary in order to +# the clipboard link start working between host and guest. +if which xclip &> /dev/null; then + echo $RANDOM | xclip +fi diff --git a/kvmxfile b/kvmxfile index 2b3bfb8..99fad1d 100644 --- a/kvmxfile +++ b/kvmxfile @@ -48,3 +48,6 @@ version="stretch" # Debian mirror mirror="http://http.debian.net/debian/" + +ssh_support="y" +ssh_custom="y" -- cgit v1.2.3