OPNsense
  • Home
  • Help
  • Search
  • Login
  • Register

  • OPNsense Forum »
  • English Forums »
  • Web Proxy Filtering and Caching (Moderator: fabian) »
  • HAProxy and Crowdsec, with Lua5.4 and 5.3 conflict
« previous next »
  • Print
Pages: [1]

Author Topic: HAProxy and Crowdsec, with Lua5.4 and 5.3 conflict  (Read 904 times)

Handosense

  • Newbie
  • *
  • Posts: 1
  • Karma: 0
    • View Profile
HAProxy and Crowdsec, with Lua5.4 and 5.3 conflict
« on: March 11, 2024, 05:34:42 am »
Hi all,

I'm currently trying to set up crowdsec so that it works with my system, particularly the crowdsec-haproxy-bouncer.  But, I'm having trouble figuring out how to get haproxy to use Lua5.4, and not Lua5.3. Thoughts?



Here's the long explanation:
I have the following packages & versions:

haproxy 2.8.5_4
os-haproxy 4.3
crowdsec 1.6.0_1
os-crowdsec 1.0.7
lua53   5.3.6_1
lua54   5.4.6_1


I'm trying to link them together by installing a crowdsec haproxy bouncer (https://doc.crowdsec.net/u/bouncers/haproxy/), which i was able to compile via makefile.

Over on the HAProxy side, i took the contents of /etc/crowdsec/bouncers/crowdsec-haproxy-bouncer.conf (https://github.com/crowdsecurity/cs-haproxy-bouncer/blob/031e1e37fea48a97d9e102f660b47027510c5a9f/lib/crowdsec.lua#L4), and set it as "content" when adding to Advanced -> Lua Scripts -> Add.


Additionally, i had to go through /usr/ports/converters/lua-json/ to install lua-json.

deep breath So here's the problem:
i was able to install lua-json, but only on 5.4.  However, when trying to run the lua scripts on haproxy, i now see it complains for lua5.3:

```
[NOTICE] (60070) : haproxy version is 2.8.5-aaba8d0
[NOTICE] (60070) : path to executable is /usr/local/sbin/haproxy
[ALERT] (60070) : config : parsing [/usr/local/etc/haproxy.conf.staging:23] : Lua runtime error: /tmp/haproxy/lua/Crowdsec.lua:3: module 'json' not found:
no field package.preload['json']
no file '/tmp/haproxy/lua/json.lua'
no file '/usr/local/share/lua/5.3/json.lua'
no file '/usr/local/share/lua/5.3/json/init.lua'
no file '/usr/local/lib/lua/5.3/json.lua'
no file '/usr/local/lib/lua/5.3/json/init.lua'
no file './json.lua'
no file './json/init.lua'
no file './json.lua'
no file '/usr/local/lib/lua/5.3/json.so'
no file '/usr/local/lib/lua/5.3/loadall.so'
no file './json.so'
[ALERT] (60070) : config : Error(s) found in configuration file : /usr/local/etc/haproxy.conf.staging
[ALERT] (60070) : config : Fatal errors found in configuration.
```
Upon further look, HAProxy does use 5.3:

$ pkg info -r lua53
lua53-5.3.6_1:
        haproxy28-2.8.7


Any idea how I can do either of the following?
 - Have HAProxy (and other packages) run lua 5.4
 - Install lua-json so it works on 5.3 as well as 5.4?

« Last Edit: March 11, 2024, 05:50:24 am by Handosense »
Logged

  • Print
Pages: [1]
« previous next »
  • OPNsense Forum »
  • English Forums »
  • Web Proxy Filtering and Caching (Moderator: fabian) »
  • HAProxy and Crowdsec, with Lua5.4 and 5.3 conflict
 

OPNsense is an OSS project © Deciso B.V. 2015 - 2024 All rights reserved
  • SMF 2.0.19 | SMF © 2021, Simple Machines
    Privacy Policy
    | XHTML | RSS | WAP2