ws: Use libssh in a threadsafe manner

http://api.libssh.org/master/libssh_tutor_threads.html

Closes #1582
Reviewed-by: Marius Vollmer <marius.vollmer@redhat.com>