/ Build with SSL

Building SSL

How do you build-in SSL support to jsish? (question asked in a Forum post)

Currently SSL build is not supported by configure.

I (pmacdona) have built jsish with SSL before, 2 different ways:

  • Linking in the Ubuntu built WebSockets (doesn't work anymore), and
  • Build WebSockets with CMAKE and enable SSL there.

This second way should still work, and involves (from memory) editing the jsi Makefile and setting USECMAKE=1. Then edit websockets/Makefile and set the various *SSL* flags to 1. Note the result will not be static as it becomes dependent upon gnutls and/or openssl shared libs.

Note there is a side project to fix this by forking Libwebsocket


bwtiffin First up, it was mostly flailing and failing.

Trying to get the first build, from the initial instructions above, and a make clean in jsi and jsi/websocket dirs.

src/jsiWebSocket.c:2763 missing a semi-colon

Then tried make Websocket.so in jsi/ that seemed to work, but symbols are probably not in place.

Added -lssl, -lcrypto to PROGLDFLAGS in jsi/Makefile, got further but lws_dump_json_context needed to be commented out in src/jsiWebSocket.c:2523 and line 2714, the libwebsockets I have in /usr/lib64 does not have the lwsdumpjson_context symbols (or this is a sign that I've blended the make/build).

In case there is a hint here; last compile line completed with:

gcc -I. -Isrc -Wall -Wsign-compare -Wtype-limits -Wuninitialized -DJSI__MAIN=1
-g -Og -O0 -Iwebsocket/src/lib  -Iwebsocket/src/build -Iwebsocket/unix
-Iwebsocket/build/unix -Isqlite/src -frecord-gcc-switches -fpic
-DJSI_CONF_ARGS=\"\" src/jsiLexer.o src/jsiFunc.o src/jsiValue.o
src/jsiRegexp.o src/jsiPstate.o src/jsiInterp.o src/jsiUtils.o src/jsiProto.o
src/jsiFilesys.o src/jsiChar.o src/jsiString.o src/jsiBool.o src/jsiNumber.o
src/jsiArray.o src/jsiLoad.o src/jsiHash.o src/jsiOptions.o src/jsiStubs.o
src/jsiFormat.o src/jsiJSON.o src/jsiCmds.o src/jsiFileCmds.o src/jsiObj.o
src/jsiSignal.o src/jsiTree.o src/jsiCrypto.o src/jsiDString.o src/jsiMath.o
src/jsmn.o src/jsiZvfs.o src/jsiUtf8.o src/jsiUserObj.o src/jsiSocket.o
src/jsiSqlite.o src/jsiWebSocket.o src/jsiMySql.o src/jsiCData.o
src/jsiMarkdown.o src/jsiVfs.o src/parser.o src/linenoise.o src/jsiEval.o
sqlite/build/unix/libsqlite3.a src/main.o -rdynamic -o jsish_ -lm -lssl
-lcrypto websocket/build/unix/libwebsockets.a -ldl -lpthread -lz

(all one line, edited in Vim with word wrap and code block indent)

Completed, but jsish Interp.conf('hasOpenSSL') is still false. Fairly lost in the forest. Build passes all tests, but still not right somewhere.

Was unsure if this build is supposed to be EXTWEBSOCKET or MODWEBSOCKET and kinda gave up for now. Will require more reading through the build system first, as flailing can only get you so far. I'm pretty sure I have a blendo set of make rules now. Unsure if the goal is LWS in jsish or LWS from a loadable module.

Feel free to remove this part of the wiki page after reading. I'll try and make a better report after a read through with proper notes on steps taken, starting fresh.


Find a way to build-in SSL support statically with lib musl.

bwtiffin, might I suggest looking at mbedTLS? It's our fave here for embedded work, and seems well supported in libwebsockets.


Use an SSL web server that supports Reverse Proxy.

bwtiffin, will check that angle as well. soweb (Hiawatha with an application hook, is Reverse Proxy ready).