Skip to content

Enhancement | Enable using SSH Agent Forwarding #60

@estenrye

Description

@estenrye

Observed Behavior

  • nodeletctl expects to be provided an SSH Private Key file.
  • When no SSH Private Key file is provided in cluster.yml, nodeletctl defaults to connecting with /root/.ssh/id_rsa
  • nodeletctl does not attempt to connect using identities in SSH Agent, before falling back to a specified file based identity.

SSHPrivateKeyFile: "/root/.ssh/id_rsa",

sshKey, err := ioutil.ReadFile(cfg.SSHPrivateKeyFile)
if err != nil {
return nil, fmt.Errorf("Failed to read private key: %s", cfg.SSHPrivateKeyFile)
}

Desired Behavior

  • When no SSH Private Key is provided, attempt to connect using an identity in the SSH Agent, or default to the user's default identity in their SSH config.

Why is this important

As a DevOps Engineer, I have set up my environment with an SSH Proxy Bastion Host as shown below:

network diagram

The private key in this scenario resides on my laptop, but nodectl resides on the SSH Proxy host where I am executing Ansible.

I use SSH Agent forwarding on my laptop to allow Ansible to SSH into the hosts without requiring the private key reside on the SSH Proxy host. This improves security by ensuring I don't have an over-privileged, unencrypted SSH key residing on a host inside the trusted network zone if the SSH Bastion host were to be compromised.

How to repeat my setup.

Clone this repo at tag v0.0.1

git clone --branch v0.0.1 git@github.com:platform9/infa-sandbox.git

Follow the following steps to provision an environment in an AWS account:

infra-sandbox Readme

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions