lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On 23/12/2014 19:18, Tim Channon wrote:
I need to use Luasocket to talk to HTTPS servers but Luasec is not
compilable because OpenSSL is not compilable here. (please accept that
is so)

Is using Stunnel a workaround? If so does anyone have any working
examples I can see?



For the benefit of email group archives: -

Key information, it can be done.
Luasocket will work with Stunnel and xmlrpc will work through both enabling HTTPS usage without luasec.

Any settings following are examples only

Key Luasocket information is using the proxy facility.
At a suitable time a string value is needed and enables proxy
http.PROXY = localproxyport
eg. 127.0.0.1:8888
This redirects socket calls via the local proxy, which is stunnel which must mirror the setting. The Luasocket url setting **does not change** so might be http//:someserver/somepath Where the stunnel connect url might be a subset of the above, appears both instances.

stunnel config file will include

[https]
accept  = 127.0.0.1:8888
connect = servernamehere:443
client = yes

On demand stunnel can be done. Under Windows without installing as a service (would need a security barrier crossing) it can be invoked as a command spawn, such as os.execute("start /Dpath stunnel configfile") and then removed via start again and stunnel -exit
Usual firewall crossing has to be enabled for stunnel.

Whole thing will work via automatic scheduling, no user intervention but any Lua process or stunnel interlocking is not covered here.

Security certificate handling is beyond this note.
(stunnel example config will work as-is for low security)

Hopefully libressl portable will become available during 2015.