Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SSH config support #880

Open
stacab opened this issue Sep 10, 2021 · 9 comments
Open

SSH config support #880

stacab opened this issue Sep 10, 2021 · 9 comments

Comments

@stacab
Copy link

stacab commented Sep 10, 2021

/kind enhacement

Using this provider, one can use SSH to connect to libvirt daemon on remote host. It can be done via connection uri with parameters like user, hostname, keyfile, etc.

It would be very helpful to be able to provider Host, as defined in ~/.ssh/config which already has these parameters (user, hostname, keyfile) defined. AFAIK, native Go's ssh client library cannot do this, however, there's ssh_config which can parse OpenSSH config files.

Example:

Given that functionality is implemented, following uri:
uri = "qemu-ssh://[email protected]/system?keyfile=/home/myuser/.ssh/id_rsa"

is equivalent to
uri = "qemu-ssh://machine"
given that in ~/.ssh/config there's following content:

Host machine
        HostName host.example.org
        User root
        IdentityFile /home/myuser/.ssh/id_rsa

Motivation:
in AWS provider, one can specify multiple ways of connecting to AWS API. One of them is profile. If there's profile named foo configured on machine of engineer John with his credentials and profile with different credentials for engineer Daphne on her machine also named foo, they can share the same Terraform configuration with ease because profile name is the same. I wanted something similar for this provider.

I do know it might be very specific usage and you may not be keen on including feature. However, if it is okay with you, I can implement this.

@inflatador
Copy link

Not sure if this covers your use case, but a similar feature request was just merged to main . Apologies in advance if you are looking for something else.

@stacab
Copy link
Author

stacab commented Sep 14, 2021

Hi @inflatador
I did look at mentioned PR but AFAIK, this does not implement what I want. It does implement support for SSH agent but configuration file is parsed by client (ssh command in case of openssh) - at least from what I was able to get from investigation.

@frgomes
Copy link

frgomes commented Sep 15, 2021

@inflatador :: The latest 0.6.11 presented a regression in my case.

This is the connection string I was using with 0.6.10:

qemu+ssh://[email protected]/system?keyfile=$HOME/.ssh/id_ed25519_laptop.example.com

Now it is failing with 0.6.11.

In more than 25 years using more than 12 flavors of Unixes, I've never had to use ssh-agent and I do not feel comfortable with the idea of being forced to use it at this point. I'm reverting to 0.6.10.

Probably the most powerful approach and arguably most popular approach for configuring a ssh client is populating ~/.ssh/config.

@stacab
Copy link
Author

stacab commented Oct 1, 2021

@dmacvicar WDYT?

@dmacvicar
Copy link
Owner

@inflatador :: The latest 0.6.11 presented a regression in my case.

This is the connection string I was using with 0.6.10:

qemu+ssh://[email protected]/system?keyfile=$HOME/.ssh/id_ed25519_laptop.example.com

Now it is failing with 0.6.11.

In more than 25 years using more than 12 flavors of Unixes, I've never had to use ssh-agent and I do not feel comfortable with the idea of being forced to use it at this point. I'm reverting to 0.6.10.

Probably the most powerful approach and arguably most popular approach for configuring a ssh client is populating ~/.ssh/config.

@frgomes can you please read #886 (comment) check if that solves it for you, and contribute to data in #886.
It is clear that I will not add a feature only because another functionality is not working as expected.

@dmacvicar
Copy link
Owner

@dmacvicar WDYT?

In general I like the use-case you describe, about sharing a terraform configuration and keeping the user-specific settings local to the user.

I am only worried about this changing the ssh settings behinds user backs and then generating bug reports. Any idea how to avoid that?

@frgomes
Copy link

frgomes commented Oct 10, 2021

@dmacvicar : I will test along the week and give feedback. I'm sorry for delay. Thanks a lot for your support. 💯

@matrohon
Copy link

@dmacvicar @frgomes is #933 a potential fix for this issue?

@scabala
Copy link
Contributor

scabala commented Sep 10, 2024

Related to #1058

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants