Skip to content

Commit

Permalink
ddev auth ssh should all available private keys, fixes #1291, fixes #…
Browse files Browse the repository at this point in the history
  • Loading branch information
rfay committed Nov 30, 2018
1 parent d965c64 commit 02e937c
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
1 change: 1 addition & 0 deletions containers/ddev-ssh-agent/Dockerfile
Expand Up @@ -28,6 +28,7 @@ FROM alpine:3.8
RUN apk add --no-cache \
bash \
expect \
file \
openssh \
socat \
sudo \
Expand Down
9 changes: 4 additions & 5 deletions containers/ddev-ssh-agent/files/entry.sh
Expand Up @@ -49,16 +49,15 @@ case "$1" in
;;

# Manage SSH identities
ssh-add)
ssh-add)
shift # remove argument from array

# Add keys id_rsa and id_dsa from /root/.ssh using cat so it will work regardless of permissions
# docker toolbox mounts files as 0777, which ruins the normal technique.
set +o errexit
keyfiles=$( \ls ~/.ssh/id_[rs]sa 2>/dev/null)
keyfiles=$(file ~/.ssh/* | awk -F: '/private key/ { print $1 }')
set -o errexit
true
if [ $keyfiles ] ; then
if [ ! -z "$keyfiles" ] ; then
for key in $keyfiles; do
perm=$(stat -c %a "$key")
if [ $perm = "777" ] ; then
Expand All @@ -68,7 +67,7 @@ case "$1" in
fi
done
else
echo "No keys matching id_[rd]sa were found in the directory."
echo "No private keys were found in the directory."
fi

# Return first command exit code
Expand Down
2 changes: 1 addition & 1 deletion pkg/version/version.go
Expand Up @@ -49,7 +49,7 @@ var RouterTag = "v1.4.0" // Note that this can be overridden by make

var SSHAuthImage = "drud/ddev-ssh-agent"

var SSHAuthTag = "v1.4.0"
var SSHAuthTag = "20181122_load_all_keys"

// COMMIT is the actual committish, supplied by make
var COMMIT = "COMMIT should be overridden"
Expand Down

0 comments on commit 02e937c

Please sign in to comment.