Skip to content

Commit

Permalink
Merge pull request #120 from dokku/116-passphrase
Browse files Browse the repository at this point in the history
feat: add support for setting an ssh passphrase to use for ssh commands
  • Loading branch information
josegonzalez authored Sep 14, 2024
2 parents bd618c7 + e687580 commit c730419
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,10 @@ The following environment variables are supported:
- `SSH_PRIVATE_KEY`:
- description: A private SSH key that has push acces to your Dokku instance
- required: true
- `SSH_PASSPHRASE`:
- description: If set, the passphrase to use when interacting with an SSH key that has a passphrase
- required: false
- default: ''
- `TRACE`:
- description: Allows users to debug what the action is performing by enabling shell trace mode
- required: false
Expand Down
8 changes: 8 additions & 0 deletions bin/setup-ssh
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,14 @@ else
chmod 600 "/root/.ssh/known_hosts"
fi

if [ -n "$SSH_PASSPRHASE" ]; then
export SSH_ASKPASS="/root/.ssh/askpass.sh"
export SSH_ASKPASS_REQUIRE=force
# shellcheck disable=SC2016
printf '#!/bin/sh\necho "$SSH_PASSPRHASE"\n' >"$SSH_ASKPASS"
chmod +x "$SSH_ASKPASS"
fi

log-info "Adding SSH Key to ssh-agent"
eval "$(ssh-agent -s)"
ssh-add /root/.ssh/id_rsa

0 comments on commit c730419

Please sign in to comment.