From 2d0374ec52ef0f96204aa76c436cac08a2484a93 Mon Sep 17 00:00:00 2001 From: Justin Clark Date: Fri, 1 Jul 2016 11:42:16 -0700 Subject: [PATCH] ssh-keys updates based on feedback --- deb.mk | 2 +- plugins/ssh-keys/functions | 2 +- plugins/ssh-keys/subcommands/add | 5 +++-- plugins/ssh-keys/subcommands/list | 3 ++- plugins/ssh-keys/subcommands/remove | 3 ++- 5 files changed, 9 insertions(+), 6 deletions(-) diff --git a/deb.mk b/deb.mk index 27875cc30..305320581 100644 --- a/deb.mk +++ b/deb.mk @@ -26,7 +26,7 @@ Simplifies running a single command over SSH, and manages authorized keys (ACL) and users in order to do so. endef SSHCOMMAND_REPO_NAME ?= dokku/sshcommand -SSHCOMMAND_VERSION ?= 0.4.0 +SSHCOMMAND_VERSION ?= 0.5.0 SSHCOMMAND_ARCHITECTURE = amd64 SSHCOMMAND_PACKAGE_NAME = sshcommand_$(SSHCOMMAND_VERSION)_$(SSHCOMMAND_ARCHITECTURE).deb SSHCOMMAND_URL ?= https://raw.githubusercontent.com/dokku/sshcommand/v$(SSHCOMMAND_VERSION)/sshcommand diff --git a/plugins/ssh-keys/functions b/plugins/ssh-keys/functions index 1a2f4f19b..32e7e971e 100755 --- a/plugins/ssh-keys/functions +++ b/plugins/ssh-keys/functions @@ -5,7 +5,7 @@ source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions" verify_ssh_key_file() { declare desc="Test that public key is valid" [[ -s ${DOKKU_ROOT}/.ssh/authorized_keys ]] || dokku_log_fail "No public keys found." - ssh-keygen -l -f "${DOKKU_ROOT}/.ssh/authorized_keys" &> /dev/null || dokku_log_fail "${DOKKU_ROOT}/.ssh/authorized_keys failed ssh-kegen check." + ssh-keygen -l -f "${DOKKU_ROOT}/.ssh/authorized_keys" &> /dev/null || dokku_log_fail "${DOKKU_ROOT}/.ssh/authorized_keys failed ssh-keygen check." } verify_ssh_key_exists() { diff --git a/plugins/ssh-keys/subcommands/add b/plugins/ssh-keys/subcommands/add index b9e3b2ddf..165993a25 100755 --- a/plugins/ssh-keys/subcommands/add +++ b/plugins/ssh-keys/subcommands/add @@ -1,10 +1,11 @@ #!/usr/bin/env bash set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions" -source "$PLUGIN_CORE_AVAILABLE_PATH/ssh-keys/functions" +source "$PLUGIN_AVAILABLE_PATH/ssh-keys/functions" -add_keys(){ +add_keys() { declare desc="add a new key via sshcommand" + local cmd="ssh-keys:add" shift local name="$1" key_file="$2" key_contents key_from_pipe [[ -p /dev/stdin ]] && read -r key_from_pipe diff --git a/plugins/ssh-keys/subcommands/list b/plugins/ssh-keys/subcommands/list index 5eb165e4f..ce485bbd6 100755 --- a/plugins/ssh-keys/subcommands/list +++ b/plugins/ssh-keys/subcommands/list @@ -1,10 +1,11 @@ #!/usr/bin/env bash set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions" -source "$PLUGIN_CORE_AVAILABLE_PATH/ssh-keys/functions" +source "$PLUGIN_AVAILABLE_PATH/ssh-keys/functions" list_ssh_keys() { declare desc="List ssh key hashes" + local cmd="ssh-keys:list" verify_ssh_key_file sshcommand list dokku } diff --git a/plugins/ssh-keys/subcommands/remove b/plugins/ssh-keys/subcommands/remove index 415d3a528..3e7e5c5fe 100755 --- a/plugins/ssh-keys/subcommands/remove +++ b/plugins/ssh-keys/subcommands/remove @@ -1,10 +1,11 @@ #!/usr/bin/env bash set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions" -source "$PLUGIN_CORE_AVAILABLE_PATH/ssh-keys/functions" +source "$PLUGIN_AVAILABLE_PATH/ssh-keys/functions" remove_key() { declare desc="Removes key from authorized_keys" + local cmd="ssh-keys:remove" shift local name="$1" verify_ssh_key_file