package ssh-agent

  1. Overview
  2. Docs
Ssh-agent protocol parser and serialization implementation


Dune Dependency






Published: 04 Apr 2022


OCaml ssh-agent

An ssh-agent protocol implementation in OCaml.

This library offers angstrom/faraday parsers/serializers for the ssh agent protocol as well as some helper functions for implementing an ssh-agent. In the cmd/ directory you find two simple example applications:

  • ssh_add: this application connects to $SSH_AUTH_SOCK, generates a private key (rsa or ed25519 are supported), adds it to the ssh-agent and exits. Note that it doesn't save the public key anywhere or removes it from the agent, and is only good for polluting your ssh-agent with random keys. You may want to write the public key to a file and then remove it from the agent using ssh-add -d

  • ssh_agent_server: this application listens on a socket ocaml-ssh-agent.sock in CWD, and implements a very basic ssh-agent. It supports adding keys, removing keys and signing using rsa or ed25519 keys. It does not support concurrent connections and is not suitable for Production Use™.

These applications are not built by default. To build or run them using dune you must do so manually:

$ dune build cmd/ssh_add.exe cmd/ssh_agent_server.exe # to build
$ dune exec -- cmd/ssh_add.exe --help # to run ssh_add
$ dune exec -- cmd/ssh_agent_server.exe # to run ssh_agent_server

For the Qubes OS unikernel using this library see qubes-mirage-ssh-agent.

Dependencies (9)

  1. cstruct
  2. mirage-crypto-ec < "1.0.0"
  3. mirage-crypto-pk < "1.0.0"
  4. mirage-crypto < "1.0.0"
  5. faraday >= "0.6"
  6. angstrom >= "0.15.0"
  7. ppx_cstruct build & >= "5.2.0"
  8. dune >= "1.0"
  9. ocaml >= "4.08.0"

Dev Dependencies (2)

  1. alcotest with-test
  2. mirage-crypto-rng with-test & < "0.11.0"

Used by (1)

  1. ssh-agent-unix = "0.4.0"

Conflicts (2)

  1. ppxlib < "0.9.0"
  2. result < "1.5"

Innovation. Community. Security.