Is it possible to somehow do it with dub?

Well vibe.d does it with openssl https://github.com/rejectedsoftware/vibe.d. You would have add linker flags to your libssh package. Not sure if the pathes work out.