2020-10-07 11:49:14 -03:00
|
|
|
# lua-cs-bouncer
|
|
|
|
|
|
|
|
> Lua module to allow ip (or not) from CrowdSec API.
|
|
|
|
|
|
|
|
# Install & Config
|
|
|
|
|
2020-10-07 11:50:14 -03:00
|
|
|
`git clone https://github.com/crowdsecurity/lua-cs-bouncer.git`
|
2020-10-07 11:49:14 -03:00
|
|
|
|
|
|
|
## Install script
|
|
|
|
|
|
|
|
```
|
|
|
|
sudo ./install.sh
|
|
|
|
```
|
|
|
|
:warning: the installation script works only on Debian/Ubuntu
|
|
|
|
|
|
|
|
## From source
|
|
|
|
|
|
|
|
### Requirements
|
|
|
|
|
|
|
|
```
|
|
|
|
apt-get install lua5.3
|
|
|
|
apt-get install lua-sec
|
|
|
|
```
|
|
|
|
|
|
|
|
### With make
|
|
|
|
```
|
|
|
|
sudo make install
|
|
|
|
```
|
|
|
|
|
|
|
|
### Manually
|
|
|
|
|
|
|
|
- Create folder `/usr/local/lua/crowdsec/`:
|
|
|
|
```
|
|
|
|
mkdir -p /usr/local/lua/crowdsec/
|
|
|
|
```
|
|
|
|
|
2020-10-07 11:50:14 -03:00
|
|
|
- Copy the `lua-cs-bouncer/lib/*.lua` into `/usr/local/lua/crowdsec/`:
|
2020-10-07 11:49:14 -03:00
|
|
|
```
|
2020-10-07 11:50:14 -03:00
|
|
|
cp ./lua-cs-bouncer/lib/*.lua /usr/local/lua/crowdsec
|
2020-10-07 11:49:14 -03:00
|
|
|
```
|
|
|
|
|
2020-10-07 11:50:14 -03:00
|
|
|
- Copy the `lua-cs-bouncer/template.conf` into `/usr/local/lua/crowdsec/crowdsec.conf`:
|
2020-10-07 11:49:14 -03:00
|
|
|
```
|
2020-10-07 11:50:14 -03:00
|
|
|
cp ./lua-cs-bouncer/template.conf /usr/local/lua/crowdsec/crowdsec.conf
|
2020-10-07 11:49:14 -03:00
|
|
|
```
|
|
|
|
|
|
|
|
## Configuration
|
|
|
|
|
|
|
|
The configuration is located by default in `/usr/local/lua/crowdsec/crowdsec.conf`:
|
|
|
|
|
|
|
|
```
|
|
|
|
API_URL=http://localhost:8080 <-- the API url
|
|
|
|
API_KEY= <-- the API Key generated with `cscli bouncers add -n <bouncer_name>`
|
2021-09-09 09:25:30 -03:00
|
|
|
LOG_FILE=/var/log/crowdsec_lua_bouncer.log <-- path to log file
|
2021-09-09 06:08:14 -03:00
|
|
|
LOG_LEVEL=INFO <-- log level (INFO, WARN, DEBUG, ERROR, FATAL)
|
2020-10-07 11:49:14 -03:00
|
|
|
CACHE_EXPIRATION=1 <-- in seconds
|
|
|
|
CACHE_SIZE=1000 <-- cache size
|
2021-02-08 13:32:56 -03:00
|
|
|
REQUEST_TIMEOUT=0.2 <-- Maximum duration in seconds for a request to LAPI
|
2020-10-07 11:49:14 -03:00
|
|
|
```
|