Skip to content

Commit

Permalink
Merge pull request #83 from dokku/josegonzalez-patch-1
Browse files Browse the repository at this point in the history
Error out if there is no ssh private key
  • Loading branch information
josegonzalez authored Oct 16, 2023
2 parents a8aa6c7 + 3e838c7 commit d1363fd
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions bin/setup-ssh
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@ echo "$SSH_PRIVATE_KEY" | tr -d '\r' >/root/.ssh/id_rsa
chmod 600 /root/.ssh/id_rsa
chmod 700 /root/.ssh

if [ ! -s /root/.ssh/id_rsa ]; then
log-error "No private ssh key found"
log-error "Ensure SSH_PRIVATE_KEY environment variable has your ssh private key as its contents"
exit 1
fi

if [ -n "$SSH_HOST_KEY" ]; then
log-info "Adding SSH_HOST_KEY to known_hosts"
echo "$SSH_HOST_KEY" >>"/root/.ssh/known_hosts"
Expand Down

0 comments on commit d1363fd

Please sign in to comment.