SkyLothar / lua-resty-jwt

JWT For The Great Openresty
Apache License 2.0
513 stars 179 forks source link

JWT token verification problem (undefined symbol: EVP_MD_CTX_create) #103

Open jaceksocha opened 1 year ago

jaceksocha commented 1 year ago

Hi,

I'm facing some problems during jwt verification, which manifests itself as:

< HTTP/1.1 500 Internal Server Error < Server: openresty/1.21.4.1

(in openresty logs):

2023/06/19 20:44:32 [error] 1410#1410: *2 lua entry thread aborted: runtime error: /usr/local/openresty/site/lualib/resty/evp.lua:216: /usr/local/openresty/luajit/lib/libluajit-5.1.so.2: undefined symbol: EVP_MD_CTX_create stack traceback: coroutine 0: [C]: in function '__index' /usr/local/openresty/site/lualib/resty/evp.lua:216: in function 'verify' /usr/local/openresty/site/lualib/resty/jwt.lua:812: in function 'verify' access_by_lua(nginx.conf:89):30: in main chunk, client: 127.0.0.1, server: localhost, request: "GET / HTTP/1.1", host: "localhost"

My stack:

Openresty version : apt-cache policy openresty openresty: Installed: 1.21.4.1-1~focal1

lua-resty-jwt: opm info lua-resty-jwt Name : lua-resty-jwt Version : 0.1.11

lua-resty-hmac: opm info lua-resty-hmac Name : lua-resty-hmac Version : 0.06

OS: lsb_release -a No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 20.04.5 LTS Release: 20.04 Codename: focal

openssl openssl OpenSSL> version OpenSSL 1.1.1f 31 Mar 2020

lua code :

` location / {

          access_by_lua_block {

              local jwt = require("resty.jwt")
              local auth_header = ngx.var.http_Authorization
              local token
              local key = [[ -----BEGIN PUBLIC KEY-----
              <PUBLIC>
              -----END PUBLIC KEY-----
              ]]

              if auth_header then
                  token = string.match(auth_header, "Bearer%s+(.+)")
              end

              local verified = jwt:verify(key, token)

              if not verified then
                   ngx.exit(ngx.HTTP_UNAUTHORIZED)`

==================

It looks similar as old issue with openssl1.1: https://github.com/zmartzone/lua-resty-openidc/issues/161 https://github.com/zmartzone/lua-resty-openidc/issues/162

I there anybody who had similar problem ? Or maybe I'm doing something wrong ...

zAbleXY commented 7 months ago

Have you slove this problem yet? I still have this problem.

Details

2024/04/23 16:45:23 [error] 829033#829033: *31177 lua entry thread aborted: runtime error: /usr/local/openresty/site/lualib/resty/evp.lua:216: /usr/local/openresty/luajit/lib/libluajit-5.1.so.2: undefined symbol: EVP_MD_CTX_create stack traceback: coroutine 0: [C]: in function '__index' /usr/local/openresty/site/lualib/resty/evp.lua:216: in function 'verify' /usr/local/openresty/site/lualib/resty/jwt.lua:812: in function 'verify'