Fixed a segfault during an SSH connection failure.
[libpwmd.git] / README.SSH
blob4cf8e4ddad9acee25fb288117c999cdf3d66e635
1 Beginning with version 6 of libpwmd remote access to a pwmd server using
2 libssh2 has been available. The functions pwmd_ssh_connect() and
3 pwmd_ssh_connect_async() are used to connect to the server. After resolving
4 the hostname and connecting, an ssh session is created and the hostkey is
5 verified against a file containing known hosts. Note that only public key
6 authentication is supported and without a passphrase.
8 After verification succeeds, a channel is opened which spawns a shell. This
9 shell should execute a proxy to the pwmd server by connecting to the local
10 socket. I use 'socat', it's really handy.
12 In order to get this to work you need to put the following in your
13 ~/.ssh/authorized_keys file. It should be prepended to the hash of the public
14 key that your libpwmd client will use:
16     command="socat gopen:$HOME/.pwmd/socket -"
18 So now when libpwmd spawns the SSH shell, 'socat' will read the stdin of the
19 SSH shell and redirect it to the pwmd connection. The output of pwmd works the
20 same way, only in reverse.
22 You can use pwmc to try it out:
24     # Get the servers public key. Make sure the hostname is correct and not
25     # hijacked when getting the hostkey.
26     pwmc --get-hostkey --host hostname > host_file
28     # Generate an SSH key that the client will use. Copy the contents of
29     # the generated public key to the SSH servers authorized_keys file and
30     # prepend the above mentioned line to it. You will need both the generated
31     # public and private keys when connecting to the server.
32     ssh-keygen -f keyfile
34     # List the contents of the pwmd 'datafile' on the remote SSH server by
35     # connecting as the specified 'user'.
36     echo list | pwmc --host hostname --known-hosts host_file \
37         --user user --identity keyfile datafile
39 Ben Kibbey <bjk@luxsci.net>
40 http://bjk.sourceforge.net/pwmd/