Skip to content

Commit

Permalink
feat: Add KAYOBE_AUTOMATION_SSH_PRIVATE_KEY_NAME
Browse files Browse the repository at this point in the history
The variable `KAYOBE_AUTOMATION_SSH_PRIVATE_KEY_NAME` allows for
alternative key names to be used instead of the hardcoded `id_rsa.`

Note: It defaults to `id_rsa` to prevent any breaking changes.
  • Loading branch information
jackhodgkiss committed Apr 5, 2024
1 parent b00f285 commit 57e8246
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ Use the examples in examples/\* for inspiration.

`KAYOBE_AUTOMATION_SSH_PRIVATE_KEY`: Private key used to login to kayobe managed hosts

`KAYOBE_AUTOMATION_SSH_PRIVATE_KEY_NAME` Name of private key used to login to kayobe managed hosts. Defaults to id_rsa.

`KAYOBE_AUTOMATION_LOG_LEVEL`: Verbosity of logging. Choose one of: `debug`, `info`, `warn`, `error`

`KAYOBE_VAULT_PASSWORD`: Kayobe vault password.
Expand Down
8 changes: 4 additions & 4 deletions functions
Original file line number Diff line number Diff line change
Expand Up @@ -551,10 +551,10 @@ function setup_ssh_agent {
function inject_ssh_keys {
# These are read when generating kolla passwords
if [ ! -z ${KAYOBE_AUTOMATION_SSH_PRIVATE_KEY:+x} ]; then
echo "${KAYOBE_AUTOMATION_SSH_PRIVATE_KEY}" >~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa
ssh-keygen -y -f ~/.ssh/id_rsa >~/.ssh/id_rsa.pub
chmod 600 ~/.ssh/id_rsa.pub
echo "${KAYOBE_AUTOMATION_SSH_PRIVATE_KEY}" >"~/.ssh/${KAYOBE_AUTOMATION_SSH_PRIVATE_KEY_NAME:-id_rsa}"
chmod 600 "~/.ssh/${KAYOBE_AUTOMATION_SSH_PRIVATE_KEY_NAME:-id_rsa}"
ssh-keygen -y -f "~/.ssh/${KAYOBE_AUTOMATION_SSH_PRIVATE_KEY_NAME:-id_rsa}" >"~/.ssh/${KAYOBE_AUTOMATION_SSH_PRIVATE_KEY_NAME:-id_rsa}.pub"
chmod 600 "~/.ssh/${KAYOBE_AUTOMATION_SSH_PRIVATE_KEY_NAME:-id_rsa}.pub"
fi
}

Expand Down

0 comments on commit 57e8246

Please sign in to comment.