morph icon indicating copy to clipboard operation
morph copied to clipboard

Do not re-establish ssh connection while copying each and every secret

Open flokli opened this issue 5 years ago • 4 comments
trafficstars

It might make sense to have morph use the go ssh client implementation instead of shelling out to the ssh binary.

This should be a way to address morph failing to deploy without ssh in $PATH (also see https://github.com/NixOS/nixpkgs/issues/78106)

On top of that, it might make deploying secrets faster, because we can better reuse an existing session instead of creating a new one each and every time.

cc @johanot

flokli avatar Jan 20 '20 14:01 flokli

@flokli Thanks for this. We actually thought about that when writing the first versions of morph. One major argument against this is to align with how nix copy handles remote ssh stores: https://github.com/NixOS/nix/blob/master/src/libstore/ssh.cc#L103 . Since nix copy is also invoked directly by morph, we might risk having two diverging ssh-environments present at a single morph invocation. Besides that, there are plenty of positive arguments for this suggestion :).

johanot avatar Jan 20 '20 14:01 johanot

This is somewhat scary - how do you envision this to break?

flokli avatar Jan 21 '20 23:01 flokli

see also @andrew-d 's comment here: https://github.com/NixOS/nixpkgs/pull/78107#issuecomment-577012848

johanot avatar Jan 26 '20 13:01 johanot

That's right - didn't think about smartcards and such.

Another idea - can we

A) set ControlMasterand friends (to reuse a master connection when invoking ssh commands) B) open a ssh connection once and copy over all secrets inside the same connection?

flokli avatar Jan 31 '20 12:01 flokli