contrib: Add helper to build Android dependencies.
[libpwmd.git] / README.SSH
blob8f08aca54fbcd55be4609f472d75c5958c6db171
1 libpwmd supports remote access to a pwmd server via TLS and SSH by using the
2 libssh2 library. Libssh2 supports being built with various crypto engines and
3 libpwmd has been tested and works well when libssh2 is built with the OpenSSL
4 crypto engine. Other engines may or may not work.
6 The pwmd_connect() function is used to connect to the remote pwmd host by
7 prefixing the socket with ssh:// followed by an optional username then the
8 hostname.  After resolving the hostname and connecting, an ssh session is
9 created and the hostkey is verified against a file containing known hosts.
11 After verification succeeds, a channel is opened which spawns a shell. This
12 shell should execute a proxy to the pwmd server by connecting to the local
13 socket. I use 'socat', it's really handy.
15 In order to get this to work you need an SSH server that supports this
16 feature. OpenSSH works well. Then put the following in your
17 ~/.ssh/authorized_keys file on the machine running the ssh and pwmd server. It
18 should be prepended to the public key portion of the private key that your
19 libpwmd client will use:
21     command="socat UNIX-CONNECT:$HOME/.pwmd/socket -" ... identity.pub ...
23 Now when libpwmd connects, the SSH server spawns the shell and 'socat' will
24 send the SSH connection IO to the pwmd socket, and vice-versa.
26 You can use pwmc to try it out:
27     # Generate an SSH key that the client will use. Then copy the contents of
28     # the generated public key to the SSH servers authorized_keys file and
29     # prepend the above mentioned line to it.
30     ssh-keygen -f keyfile
32     # If you have an ssh agent running, you can also do the following and omit
33     # the --identity command line option below:
34     ssh-add keyfile
36     # List the contents of the pwmd 'datafile' on the remote SSH server by
37     # connecting as the specified 'user'. If you have an ssh agent running and
38     # did the above command, you can omit the --identity option.
39     echo list | pwmc --socket ssh://user@hostname --identity keyfile datafile
42 Ben Kibbey <bjk@luxsci.net>
43 https://gitlab.com/bjk/libpwmd