Hello,
I’m brand new to crowdsec. I have a reverse proxy (nginx) and ssh, installed on a Raspberry 4 (Raspberry OS).
I installed the nginx bouncer with the official documentation and Nginx does not start because it do not found the ffi module.
nginx: [error] init_by_lua error: /usr/lib/crowdsec/lua/plugins/crowdsec/iputils.lua:22: module 'ffi' not found:
no field package.preload['ffi']
no file '/usr/lib/crowdsec/lua/ffi.lua'
no file './ffi.lua'
no file '/usr/local/share/lua/5.1/ffi.lua'
no file '/usr/local/share/lua/5.1/ffi/init.lua'
no file '/usr/local/lib/lua/5.1/ffi.lua'
no file '/usr/local/lib/lua/5.1/ffi/init.lua'
no file '/usr/share/lua/5.1/ffi.lua'
no file '/usr/share/lua/5.1/ffi/init.lua'
no file './ffi.lua'
no file './ffi.so'
no file '/usr/local/lib/lua/5.1/ffi.so'
no file '/usr/lib/aarch64-linux-gnu/lua/5.1/ffi.so'
no file '/usr/lib/lua/5.1/ffi.so'
no file '/usr/local/lib/lua/5.1/loadall.so'
stack traceback:
[C]: in function 'require'
/usr/lib/crowdsec/lua/plugins/crowdsec/iputils.lua:22: in main chunk
[C]: in function 'require'
/usr/lib/crowdsec/lua/crowdsec.lua:4: in main chunk
[C]: in function 'require'
init_by_lua:2: in main chunk
nginx: configuration file /etc/nginx/nginx.conf test failed
nginx.service: Control process exited, code=exited, status=1/FAILURE
I try to find this module and it does not exist on my server.
sudo find / -name ffi.*
The Lua package seems to be installed
sudo apt list lua* | grep installed
WARNING: apt does not have a stable CLI interface. Use with caution in scripts.
lua-any/stable,stable,now 27 all [installed,automatic]
lua-cjson/stable,now 2.1.0+dfsg-2.1 arm64 [installed]
lua-sec/stable,now 1.0-1 arm64 [installed,automatic]
lua-socket/stable,now 3.0~rc1+git+ac3201d-4 arm64 [installed,automatic]
lua5.1/stable,now 5.1.5-8.1+b3 arm64 [installed]
lua5.3/stable,now 5.3.3-1.1+b1 arm64 [installed]
lua5.4/stable,now 5.4.2-2 arm64 [installed]
luajit/stable,now 2.1.0~beta3+dfsg-5.3 arm64 [installed]
luarocks/stable,stable,now 2.4.2+dfsg-1.1 all [installed]
I guest the Lua package is not loaded by nginx. I do not see it with this command.
sudo ldd /usr/sbin/nginx
linux-vdso.so.1 (0x0000007f8b0a5000)
libdl.so.2 => /lib/aarch64-linux-gnu/libdl.so.2 (0x0000007f8af13000)
libpthread.so.0 => /lib/aarch64-linux-gnu/libpthread.so.0 (0x0000007f8aee2000)
libcrypt.so.1 => /lib/aarch64-linux-gnu/libcrypt.so.1 (0x0000007f8ae99000)
libpcre.so.3 => /lib/aarch64-linux-gnu/libpcre.so.3 (0x0000007f8ae27000)
libssl.so.1.1 => /lib/aarch64-linux-gnu/libssl.so.1.1 (0x0000007f8ad8a000)
libcrypto.so.1.1 => /lib/aarch64-linux-gnu/libcrypto.so.1.1 (0x0000007f8aad9000)
libz.so.1 => /lib/aarch64-linux-gnu/libz.so.1 (0x0000007f8aaaf000)
libc.so.6 => /lib/aarch64-linux-gnu/libc.so.6 (0x0000007f8a939000)
/lib/ld-linux-aarch64.so.1 (0x0000007f8b075000)
I think that a missing package is the root cause. But I installed the required packages, indicated into the official documentation
sudo apt install nginx lua5.1 libnginx-mod-http-lua luarocks gettext-base lua-cjson
Have you an idea of the problem ?