Investigate dropping reliance on /usr/bin/ssh for docker client connections #251
Closed
opened 2021-11-18 20:24:57 +00:00 by decentral1se
·
5 comments
Labels
Clear labels
abra
awaiting-feedback
backups
bug
build
ci/cd
community organising
contributing
coopcloud.tech
design
documentation
duplicate
enhancement
fedi
fedi-infra
finance
funding
good first issue
help wanted
installer
legal
performance
proposal
question
security
test
wontfix
Everything to do with abra
Ping/pong on comms
Something is not working
Go build related issues
Getting the robots into the mix
Opening this thing up
Contributors stuff
Our main website
Design thinking required
Let's write things together
This issue or pull request already exists
New feature
Democratic decision making
Money things
Anything related to grant funding
Easy start with development
Need some help
Installation related issues
Performance related
Large change which requires feedback & decisin making
More information is needed
Securing our shit
Unit or integration test suite
This won't be fixed
Milestone
No items
No Milestone
Projects
Clear projects
No projects
Assignees
3wordchant
aadil (Aadil Ayub)
abra-bot (Abra Bot)
ammaratef45
amras (Sarma)
Apfelwurm
BornDeleuze
Brooke
carla
cas (Cassowary)
coopcloud
cyrnel
decentral1se (d1)
dede
devydave
fauno (fauno)
iexos
jade (Jade Ambrose)
jjsfunhouse
jmakdah2 (Jackie Makdah)
joe-irving (Joe Irving)
kawaiipunk (KawaiiPunk)
knoflook
kolaente
lambdabundesverband
linnealovespie (April)
moosemower
moritz
notplants
oxaliq (sorrel)
p4u1
pharaohgraphy (Andrew 🐦🔥❤️🔥✴️)
renovate-bot (Comrade Renovate Bot)
ripclap
simon
sixsmith (Sixsmith)
stevensting
trav (Trav Fryer)
val (val (he/him))
yksflip
Clear assignees
No Assignees
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: toolshed/organising#251
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Describe the current behavior
abraactually relies on/usr/bin/sshexisting which is bad for portability.Steps to reproduce
Do anything with
abra.Describe the expected behavior
Not the worst but so far it looked it was totally a self-reliant single binary.
Maybe we can re-use the built-in ssh lib to avoid this reliance.
Any idea how this might be fixed?
Use
pkg/ssh/...to pass something to the dialer code inpkg/upstream/....The built-in ssh lib seems to have a matching signature via https://pkg.go.dev/golang.org/x/crypto/ssh#Client.DialTCP which gives a
net.Connwhich we might be able to use as a drop-in replacement here! Also https://pkg.go.dev/golang.org/x/crypto/ssh#NewServerConn? Something to investigate soon.commit: 6ef15e0a26fbe98b2394606af9c17847c8e95948 (head)
i renamed /usr/bin/ssh and tried to run abra but this is all i'm getting:
FATA[0000] error during connect: Get "http://docker.example.com/v1.24/containers/json?filters=%7B%22name%22%3A%7B%22traefik_cc_marinara_xyz%22%3Atrue%7D%7D&limit=0": exec: "ssh": executable file not found in $PATHi think i don't understand. Doesn't ssh-agent still require openssh to be installed?
yeh its a bit difficult to unpack but here is what i know:
759a00eeb3/pkg/upstream/commandconn/connection.go (L59)- you can do this yourself, just runssh myserver.com docker system dial-stdioand then you can type out http requests to docker like a telnet session.759a00eeb3/pkg/upstream/commandconn/commandconn.gowhich seems to be an implementation of a thing that produces something that looks and works like anet.Connbut specific to what docker expects - hence it is hard to drop this code because then we need to reimplement their weirdness (still possible I hope! this would make a lot of problems go away)sshon the cli, it does a few things, one is reading the~/.ssh/configfile but also if the keys require a passphrase, it asksssh-agent(a process running in the background and part ofopenssh-client) to load that password)abrarequires/usr/bin/sshto exist and currentlyssh-agentbecause we do759a00eeb3/pkg/ssh/ssh.go (L70)~/.ssh/configin759a00eeb3/pkg/ssh/ssh.go (L537)and also also the docker context itself in759a00eeb3/pkg/ssh/ssh.go (L490)ok the way i understand this is we need a
net.Conn-like object for docker library to throw its api calls at and it's returned by net/ssh library that needs ssh binary to be installed. If that's right then we have 4 options?things were easier back in ye olden days when abra was written in bash
https://docs.coopcloud.tech/abra/trouble/#ssh-connection-issues