Demystifying abra + ssh logic #27
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
For the benefit of myself + coop-cloud/organising#250 and friends. This is a work-in-progress as I don't even understand how this stuff works yet due to lack of time and too much to do.
We have 2 ways to make ssh connections, 1. is the default docker client method 2. is using the built-in golang ssh lib. We need 2. because we want to handle ssh host keys correctly. That happens here:
56c3e070f5/pkg/ssh/ssh.go (L59-L102)
As I've just investigated, 1. seems to actually require using the
/usr/bin/ssh
command (😱) to build the connection. This meansabra
actually relies on theopenssh-client
package being installed on your system! Just learned this. That happens here:56c3e070f5/pkg/upstream/commandconn/connection.go (L26-L50)
Using 2. supports
ssh-agent
and password auth connection methods wheressh-agent
supports having multiple keys (which you can check by runningssh-add -L
).abra
will first try to read the docker context string (docker context ls
,ssh://...
) and build the connection details from that. Failing that, it will try to read~/.ssh/config
details via56c3e070f5/pkg/ssh/ssh.go (L536-L577)
This is quite chaotic but hopefully can be a starting point for cleaning it up!
More to come.
Refs:
So, this code passes no explicit
-i <my-key-path
via56c3e070f5/pkg/upstream/commandconn/connection.go (L23)
and actually relies also on thessh-agent
having a loaded key! That is the same logic as our built-in ssh lib logic which is good. We may want to pass that key path to be more explicit.I do think we can converge on some solid "have your
ssh-agent
setup" docs for this.This will be documented in https://docs.coopcloud.tech/operators/trouble/#configuring-ssh.
https://docs.coopcloud.tech/abra/trouble/#ssh-connection-issues