I'm trying to create a little http(s) client using lua-http. I've never run into these issues before so I think they are related to Ubuntu, but I'm (clearly) no expert. My current platform is Ubuntu 18 LTS. I was initially receiving what I'll describe as a missing cipher error when I was using openssl 1.1.0 so I upgraded to 1.1.1a based on the directions here:
I removed and reinstalled lua-http/cqueues/luaossl after the upgrade and now I am getting the following errors:
starttls: error:14094410:SSL routines:ssl3_read_bytes:sslv3 alert handshake failure
starttls: error:1416F086:SSL routines:tls_process_server_certificate:certificate verify failed:unable to get local issuer certificate
starttls: error:1416F086:SSL routines:tls_process_server_certificate:certificate verify failed:self signed certificate in certificate chain
I checked luaossl to ensure it's pointing at the correct version of openssl and everything seems copacetic. I've used luarocks to create a "package" repository, so the init.lua file simply sets the package.path and package.cpath to point to the correct lua_modules directory (same as the lua code at the bottom of this message).
russellh@sfm-dev:~/lua/sfiot_client$ ./lua -i init.lua
Lua 5.3.5 Copyright (C) 1994-2018 Lua.org, PUC-Rio
> ssl = require 'openssl'
> for i,v in pairs(ssl) do print(i,v) end
extensionSupported function: 0x7fb87ff08840
version function: 0x7fb87ff15750
VERSION_TEXT OpenSSL 1.1.1b 26 Feb 2019
I recognize that all three errors are different, but I'm wondering if I'm missing a root CA package? I also recognize that this could be asked on the askubuntu site, or even an openssl support site, or even the lua-http github site, but I thought I'd start here for future searchability. Finally, here is my source code:
package.cpath = './lua_modules/lib/lua/5.3/?.so;./?.so'
package.path = './lua_modules/share/lua/5.3/?.lua;./lua_modules/share/lua/5.3/?/init.lua;./lua_modules/share/lua/5.3/?.lua;./lua_modules/share/lua/5.3/?/init.lua;./?.lua;./?/init.lua'
local request = require 'http.request'
local rolling_logger = require "logging.rolling_file"
local conf = require('config')
local logger = rolling_logger(conf.base_path .. "/" .. conf.debug_file_name, conf.file_roll_size or 1024*1024*10, conf.max_log_files or 31)
if not logger then
local uri = arg
local req_timeout = 10
local req = request.new_from_uri(uri)
local headers, stream = req:go(req_timeout)
if headers == nil then
logger:error("failed. no headers")
--return nil, "request failed"
if not stream then
--~ for i,v in pairs(stream) do
--~ print (i,v)
local body, err = stream:get_body_as_string()
if not body and err then
logger:error("failed. no body.")
--return nil, "request failed."