Skip to content

initial ssh (client) support using awa-ssh#362

Closed
hannesm wants to merge 5 commits intomirage:masterfrom
hannesm:awa-future
Closed

initial ssh (client) support using awa-ssh#362
hannesm wants to merge 5 commits intomirage:masterfrom
hannesm:awa-future

Conversation

@hannesm
Copy link
Member

@hannesm hannesm commented Jun 27, 2019

ssh.ml is mainly a copy of tcp.ml, some adjustment were needed since in the tcp protocol the client first sends a request, while in ssh a command (git-receive-pack or git-upload-pack) is executed (with the path to the repository as argument) which starts by emitting data.

this means that git-receive/upload-pack needs to be passed while the connection is established (as done with ?cmd here), i.e. before there's a FLOW (or NET as it is called here).

@samoht
Copy link
Member

samoht commented Jun 27, 2019

That looks great!

Do you think we can avoid duplicating some much code in tcp.ml/ssh.ml. The protocols are mostly similar (apart the message prefixes if I remember correctly) so I hope there is a way to share more code :-)

@hannesm
Copy link
Member Author

hannesm commented Jun 27, 2019

@samoht I'd hope so, yes. I don't expect this PR to be merged as is, but would appreciate if someone could think about the code and come up with the right abstractions. please take also the dual PR for conduit/mirage-conduit mirage/ocaml-conduit#296 into consideration.

@hannesm
Copy link
Member Author

hannesm commented Apr 13, 2020

How to use this code in an application?

This PR adds git+ssh protocol support to ocaml-git. In order to get a git+ssh client, you'll need as well:

  • conduit (basically to handle these ssh:// urls) with this PR
  • awa (the actual ssh implementation) from here

For your convenience, the opam repository https://github.com/roburio/git-ssh-dns-mirage3-repo acts as an overlay for git+ssh support (opam repo add git-ssh https://github.com/roburio/git-ssh-dns-mirage3-repo should be all you need in your switch).

As application, the primary DNS unikernel is an example, TL;DR: in config.ml it has two new command-line parameters "seed" and "authenticator", in unikernel.ml it stitches this together into a "HTTP header" (that's what irmin and git and conduit API allowed) see here and passes this to Store.remote. The seed is a random string (use awa_gen_key to generate your own) used to produce the private key, the authenticator should be the SHA256 fingerprint of the remote host. As remote you can then use ssh://my-server/my-repo.git (or ssh://git@github.com/mirage/ocaml-git.git).

For a non-MirageOS application, it is likely that a similar patch, as done for conduit-mirage, has to be applied to conduit-lwt-unix.

@dinosaure
Copy link
Member

Close by #395 which integrate properly SSH.

@dinosaure dinosaure closed this Sep 2, 2020
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

Successfully merging this pull request may close these issues.

3 participants