nginx-lua icon indicating copy to clipboard operation
nginx-lua copied to clipboard

Libluajit-5.1.so.2: undefined symbol: EVP_CIPHER_CTX_init

Open ploynomail opened this issue 1 year ago • 1 comments

Describe the bug I am using nginx-lua as the basic image and making an OIDC proxy based on lua-resty-openidc, but there is a problem, which may be caused by the lua-resty-session dependency package. I don't know if it's my fault or what, so I'm here to ask you for help.

To Reproduce Build a Docker image from this dockerfile:


FROM fabiocicerchia/nginx-lua:1.22.0-debian-compat


RUN apt-get update && apt-get install -y \
	build-essential \
	libpcre3 \
	libpcre3-dev \
	zlib1g \
	zlib1g-dev

# install prerequisites for lua-resty-openidc
RUN luarocks install lua-cjson
RUN luarocks install lua-resty-http
RUN luarocks install lua-resty-jwt
RUN luarocks install lua-resty-session
RUN luarocks install lua-resty-string

# install lua-resty-openidc
RUN luarocks install lua-resty-openidc

WORKDIR /usr/local/share/lua/5.1/resty

WORKDIR /

# COPY conf/nginx.conf /etc/nginx/nginx.conf

when visiting url following error occurs:

2023/12/14 09:27:12 [error] 26#26: *4 lua entry thread aborted: runtime error: /usr/local/share/lua/5.1/resty/aes.lua:170: /usr/local/lib/libluajit-5.1.so.2: undefined symbol: EVP_CIPHER_CTX_init
stack traceback:
coroutine 0:
        [C]: in function '__index'
        /usr/local/share/lua/5.1/resty/aes.lua:170: in function 'get_cipher'
        /usr/local/share/lua/5.1/resty/session/ciphers/aes.lua:76: in function 'encrypt'
        ...local/share/lua/5.1/resty/session/strategies/default.lua:149: in function 'save'
        /usr/local/share/lua/5.1/resty/session.lua:302: in function 'save'
        /usr/local/share/lua/5.1/resty/session.lua:626: in function 'start'
        /usr/local/share/lua/5.1/resty/openidc.lua:1454: in function 'authenticate'
        access_by_lua(nginx.conf:161):94: in main chunk, client: 192.168.64.1, server: , request: "GET / HTTP/1.1", host: "192.168.64.50:3000"

==> logs/access.log <==
192.168.64.1 - - [14/Dec/2023:09:27:12 +0000] "GET / HTTP/1.1" 500 579 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36"

I replaced many different versions of nginx-lua and they had the same error, so I assume it's not the nginx version or something similar that caused the problem. I'm not an expert in lua and I hope I can get your help.

ploynomail avatar Dec 14 '23 09:12 ploynomail

@ploynomail thank you for reporting the problem, could you please try with the newer versions of nginx (i.e. 1.25)?

I tried with the following and should work without errors:

FROM fabiocicerchia/nginx-lua:1.25.3-debian


RUN apt-get update && apt-get install -y \
	build-essential \
	libpcre3 \
	libpcre3-dev \
	zlib1g \
	zlib1g-dev

# install prerequisites for lua-resty-openidc
RUN luarocks install lua-cjson
RUN luarocks install lua-resty-http
RUN luarocks install lua-resty-jwt
RUN luarocks install lua-resty-session
RUN luarocks install lua-resty-string

# install lua-resty-openidc
RUN luarocks install lua-resty-openidc

WORKDIR /usr/local/share/lua/5.1/resty

WORKDIR /

# COPY conf/nginx.conf /etc/nginx/nginx.conf

fabiocicerchia avatar Dec 16 '23 15:12 fabiocicerchia