crowdsecurity / cs-nginx-bouncer

CrowdSec bouncer for Nginx
MIT License
49 stars 9 forks source link

Plesk panel configration files messged up after installing crowdsec-nginx-bouncer #35

Open yashodhank opened 2 years ago

yashodhank commented 2 years ago

After installation web server turned out to be broken and restoring it back to operational status requires cleaning up and reinstallation of sw-nginx package which is provided by Plesk and works well with other Panel integration.

root@e2e-93-181:~/ralph/docker# curl -s https://packagecloud.io/install/repositories/crowdsec/crowdsec/script.deb.sh | sudo bash; sudo apt-get install crowdsec -y; sudo apt install crowdsec-firewall-bouncer-iptables -y; sudo apt install crowdsec-nginx-bouncer -y;
Detected operating system as Ubuntu/focal.
Checking for curl...
Detected curl...
Checking for gpg...
Detected gpg...
Running apt-get update... done.
Installing apt-transport-https... done.
Installing /etc/apt/sources.list.d/crowdsec_crowdsec.list...done.
Importing packagecloud gpg key... done.
Running apt-get update... done.

The repository is setup! You can now install packages.
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
  crowdsec
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 25.5 MB of archives.
After this operation, 95.8 MB of additional disk space will be used.
Get:1 https://packagecloud.io/crowdsec/crowdsec/ubuntu focal/main amd64 crowdsec amd64 1.3.2 [25.5 MB]
Fetched 25.5 MB in 5s (4,755 kB/s)
Preconfiguring packages ...
Selecting previously unselected package crowdsec.
(Reading database ... 118580 files and directories currently installed.)
Preparing to unpack .../crowdsec_1.3.2_amd64.deb ...
You can always run the configuration again interactively by using '/usr/share/crowdsec/wizard.sh -c
Unpacking crowdsec (1.3.2) ...
Setting up crowdsec (1.3.2) ...
Creating /etc/crowdsec/acquis.yaml
find: ‘/var/log/httpd’: No such file or directory
INFO[03/19/2022:07:32:49 AM] crowdsec_wizard: service 'apache2': /var/log/apache2/error.log /var/log/apache2/other_vhosts_access.log
find: ‘/usr/local/openresty/nginx/logs’: No such file or directory
INFO[03/19/2022:07:32:49 AM] crowdsec_wizard: service 'nginx': /var/log/nginx/access.log /var/log/nginx/error.log
INFO[03/19/2022:07:32:49 AM] crowdsec_wizard: service 'sshd': /var/log/auth.log
INFO[03/19/2022:07:32:49 AM] crowdsec_wizard: service 'mysql': /var/log/mysql/error.log
INFO[03/19/2022:07:32:49 AM] crowdsec_wizard: service 'linux': /var/log/syslog /var/log/kern.log
WARN[19-03-2022 07:32:49 AM] can't load CAPI credentials from '/etc/crowdsec/online_api_credentials.yaml' (missing field)
INFO[19-03-2022 07:32:49 AM] push and pull to Central API disabled
INFO[19-03-2022 07:32:49 AM] Machine 'f822a4da0740xxx5af2160fe800a1facEDLtPFtb0vjbkl7H' successfully added to the local API
INFO[19-03-2022 07:32:49 AM] API credentials dumped to '/etc/crowdsec/local_api_credentials.yaml'
WARN[19-03-2022 07:32:50 AM] can't load CAPI credentials from '/etc/crowdsec/online_api_credentials.yaml' (missing field)
INFO[19-03-2022 07:32:50 AM] push and pull to Central API disabled
INFO[19-03-2022 07:32:55 AM] Successfully registered to Central API (CAPI)
INFO[19-03-2022 07:32:55 AM] Central API credentials dumped to '/etc/crowdsec/online_api_credentials.yaml'
WARN[19-03-2022 07:32:55 AM] Run 'sudo systemctl reload crowdsec' for the new configuration to be effective.
Updating hub
INFO[19-03-2022 07:32:55 AM] Wrote new 323836 bytes index to /etc/crowdsec/hub/.index.json
INFO[03/19/2022:07:32:56 AM] crowdsec_wizard: Installing collection 'crowdsecurity/apache2'
INFO[03/19/2022:07:33:00 AM] crowdsec_wizard: Installing collection 'crowdsecurity/linux'
INFO[03/19/2022:07:33:07 AM] crowdsec_wizard: Installing collection 'crowdsecurity/mysql'
INFO[03/19/2022:07:33:08 AM] crowdsec_wizard: Installing collection 'crowdsecurity/sshd'
INFO[03/19/2022:07:33:09 AM] crowdsec_wizard: Installing collection 'crowdsecurity/nginx'
Created symlink /etc/systemd/system/multi-user.target.wants/crowdsec.service → /lib/systemd/system/crowdsec.service.
You can always run the configuration again interactively by using '/usr/share/crowdsec/wizard.sh -c
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
  ipset libipset13
The following NEW packages will be installed:
  crowdsec-firewall-bouncer-iptables ipset libipset13
0 upgraded, 3 newly installed, 0 to remove and 0 not upgraded.
Need to get 2,584 kB of archives.
After this operation, 8,795 kB of additional disk space will be used.
Get:1 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 libipset13 amd64 7.5-1ubuntu0.20.04.1 [53.6 kB]
Get:2 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 ipset amd64 7.5-1ubuntu0.20.04.1 [29.8 kB]
Get:3 https://packagecloud.io/crowdsec/crowdsec/ubuntu focal/main amd64 crowdsec-firewall-bouncer-iptables amd64 0.0.23 [2,500 kB]
Fetched 2,584 kB in 1s (1,971 kB/s)
Selecting previously unselected package libipset13:amd64.
(Reading database ... 118630 files and directories currently installed.)
Preparing to unpack .../libipset13_7.5-1ubuntu0.20.04.1_amd64.deb ...
Unpacking libipset13:amd64 (7.5-1ubuntu0.20.04.1) ...
Selecting previously unselected package ipset.
Preparing to unpack .../ipset_7.5-1ubuntu0.20.04.1_amd64.deb ...
Unpacking ipset (7.5-1ubuntu0.20.04.1) ...
Selecting previously unselected package crowdsec-firewall-bouncer-iptables.
Preparing to unpack .../crowdsec-firewall-bouncer-iptables_0.0.23_amd64.deb ...
Unpacking crowdsec-firewall-bouncer-iptables (0.0.23) ...
Setting up libipset13:amd64 (7.5-1ubuntu0.20.04.1) ...
Setting up ipset (7.5-1ubuntu0.20.04.1) ...
Setting up crowdsec-firewall-bouncer-iptables (0.0.23) ...
cscli/crowdsec is present, generating API key
API Key : xx
Created symlink /etc/systemd/system/multi-user.target.wants/crowdsec-firewall-bouncer.service → /etc/systemd/system/crowdsec-firewall-bouncer.service.
Processing triggers for man-db (2.9.1-1) ...
Processing triggers for libc-bin (2.31-0ubuntu9.7) ...
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
  autoconf automake autotools-dev cpp cpp-9 gcc gcc-9 gcc-9-base libasan5 libatomic1 libcc1-0 libdpkg-perl libfile-fcntllock-perl libgcc-9-dev libisl22 libitm1 liblsan0
  libltdl-dev liblua5.1-0-dev libmpc3 libncurses-dev libnginx-mod-http-image-filter libnginx-mod-http-lua libnginx-mod-http-ndk libnginx-mod-http-xslt-filter libnginx-mod-mail
  libnginx-mod-stream libquadmath0 libreadline-dev libtool libtool-bin libtsan0 libubsan1 lua-any lua-sec lua-socket lua5.1 luarocks m4 nginx nginx-common nginx-core pkg-config
Suggested packages:
  autoconf-archive gnu-standards autoconf-doc gettext cpp-doc gcc-9-locales gcc-multilib make flex bison gdb gcc-doc gcc-9-multilib gcc-9-doc debian-keyring bzr libtool-doc
  ncurses-doc readline-doc gfortran | fortran95-compiler gcj-jdk m4-doc fcgiwrap nginx-doc dpkg-dev
The following packages will be REMOVED:
  sw-nginx
The following NEW packages will be installed:
  autoconf automake autotools-dev cpp cpp-9 crowdsec-nginx-bouncer gcc gcc-9 gcc-9-base libasan5 libatomic1 libcc1-0 libdpkg-perl libfile-fcntllock-perl libgcc-9-dev libisl22
  libitm1 liblsan0 libltdl-dev liblua5.1-0-dev libmpc3 libncurses-dev libnginx-mod-http-image-filter libnginx-mod-http-lua libnginx-mod-http-ndk libnginx-mod-http-xslt-filter
  libnginx-mod-mail libnginx-mod-stream libquadmath0 libreadline-dev libtool libtool-bin libtsan0 libubsan1 lua-any lua-sec lua-socket lua5.1 luarocks m4 nginx nginx-common
  nginx-core pkg-config
0 upgraded, 44 newly installed, 1 to remove and 0 not upgraded.
Need to get 28.9 MB of archives.
After this operation, 108 MB of additional disk space will be used.
Get:1 http://archive.ubuntu.com/ubuntu focal/main amd64 m4 amd64 1.4.18-4 [199 kB]
Get:3 http://archive.ubuntu.com/ubuntu focal/main amd64 autoconf all 2.69-11.1 [321 kB]
Get:2 https://packagecloud.io/crowdsec/crowdsec/ubuntu focal/main amd64 crowdsec-nginx-bouncer amd64 1.0.0 [15.5 kB]
Get:4 http://archive.ubuntu.com/ubuntu focal/main amd64 autotools-dev all 20180224.1 [39.6 kB]
Get:5 http://archive.ubuntu.com/ubuntu focal/main amd64 automake all 1:1.16.1-4ubuntu6 [522 kB]
Get:6 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 gcc-9-base amd64 9.4.0-1ubuntu1~20.04 [19.4 kB]
Get:7 http://archive.ubuntu.com/ubuntu focal/main amd64 libisl22 amd64 0.22.1-1 [592 kB]
Get:8 http://archive.ubuntu.com/ubuntu focal/main amd64 libmpc3 amd64 1.1.0-1 [40.8 kB]
Get:9 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 cpp-9 amd64 9.4.0-1ubuntu1~20.04 [7,501 kB]
Get:10 http://archive.ubuntu.com/ubuntu focal/main amd64 cpp amd64 4:9.3.0-1ubuntu2 [27.6 kB]
Get:11 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 libcc1-0 amd64 10.3.0-1ubuntu1~20.04 [48.8 kB]
Get:12 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 libitm1 amd64 10.3.0-1ubuntu1~20.04 [26.2 kB]
Get:13 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 libatomic1 amd64 10.3.0-1ubuntu1~20.04 [9,284 B]
Get:14 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 libasan5 amd64 9.4.0-1ubuntu1~20.04 [2,752 kB]
Get:15 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 liblsan0 amd64 10.3.0-1ubuntu1~20.04 [835 kB]
Get:16 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 libtsan0 amd64 10.3.0-1ubuntu1~20.04 [2,009 kB]
Get:17 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 libubsan1 amd64 10.3.0-1ubuntu1~20.04 [784 kB]
Get:18 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 libquadmath0 amd64 10.3.0-1ubuntu1~20.04 [146 kB]
Get:19 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 libgcc-9-dev amd64 9.4.0-1ubuntu1~20.04 [2,360 kB]
Get:20 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 gcc-9 amd64 9.4.0-1ubuntu1~20.04 [8,275 kB]
Get:21 http://archive.ubuntu.com/ubuntu focal/main amd64 gcc amd64 4:9.3.0-1ubuntu2 [5,208 B]
Get:22 http://archive.ubuntu.com/ubuntu focal/main amd64 libdpkg-perl all 1.19.7ubuntu3 [230 kB]
Get:23 http://archive.ubuntu.com/ubuntu focal/main amd64 libfile-fcntllock-perl amd64 0.22-3build4 [33.1 kB]
Get:24 http://archive.ubuntu.com/ubuntu focal/main amd64 libltdl-dev amd64 2.4.6-14 [162 kB]
Get:25 http://archive.ubuntu.com/ubuntu focal/main amd64 libncurses-dev amd64 6.2-0ubuntu2 [339 kB]
Get:26 http://archive.ubuntu.com/ubuntu focal/main amd64 libreadline-dev amd64 8.0-4 [141 kB]
Get:27 http://archive.ubuntu.com/ubuntu focal/universe amd64 liblua5.1-0-dev amd64 5.1.5-8.1build4 [122 kB]
Get:28 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 nginx-common all 1.18.0-0ubuntu1.2 [37.5 kB]
Get:29 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 libnginx-mod-http-image-filter amd64 1.18.0-0ubuntu1.2 [14.4 kB]
Get:30 http://archive.ubuntu.com/ubuntu focal-updates/universe amd64 libnginx-mod-http-ndk amd64 1.18.0-0ubuntu1.2 [10.1 kB]
Get:31 http://archive.ubuntu.com/ubuntu focal-updates/universe amd64 libnginx-mod-http-lua amd64 1.18.0-0ubuntu1.2 [153 kB]
Get:32 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 libnginx-mod-http-xslt-filter amd64 1.18.0-0ubuntu1.2 [12.7 kB]
Get:33 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 libnginx-mod-mail amd64 1.18.0-0ubuntu1.2 [42.5 kB]
Get:34 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 libnginx-mod-stream amd64 1.18.0-0ubuntu1.2 [67.3 kB]
Get:35 http://archive.ubuntu.com/ubuntu focal/main amd64 libtool all 2.4.6-14 [161 kB]
Get:36 http://archive.ubuntu.com/ubuntu focal/main amd64 libtool-bin amd64 2.4.6-14 [80.1 kB]
Get:37 http://archive.ubuntu.com/ubuntu focal/universe amd64 lua5.1 amd64 5.1.5-8.1build4 [94.6 kB]
Get:38 http://archive.ubuntu.com/ubuntu focal/universe amd64 lua-any all 25 [4,960 B]
Get:39 http://archive.ubuntu.com/ubuntu focal/universe amd64 lua-socket amd64 3.0~rc1+git+ac3201d-4 [70.5 kB]
Get:40 http://archive.ubuntu.com/ubuntu focal/universe amd64 lua-sec amd64 0.9-3 [32.3 kB]
Get:41 http://archive.ubuntu.com/ubuntu focal/universe amd64 luarocks all 2.4.2+dfsg-1 [97.6 kB]
Get:42 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 nginx-core amd64 1.18.0-0ubuntu1.2 [425 kB]
Get:43 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 nginx all 1.18.0-0ubuntu1.2 [3,620 B]
Get:44 http://archive.ubuntu.com/ubuntu focal/main amd64 pkg-config amd64 0.29.1-0ubuntu4 [45.5 kB]
Fetched 28.9 MB in 7s (4,414 kB/s)
Extracting templates from packages: 100%
Preconfiguring packages ...
(Reading database ... 118650 files and directories currently installed.)
Removing sw-nginx (1.20.2-v.ubuntu.20.04+p18.0.42.0+t220117.1118) ...
Try to disable nginx proxy in Plesk Panel ... done.
Selecting previously unselected package m4.
(Reading database ... 118631 files and directories currently installed.)
Preparing to unpack .../00-m4_1.4.18-4_amd64.deb ...
Unpacking m4 (1.4.18-4) ...
Selecting previously unselected package autoconf.
Preparing to unpack .../01-autoconf_2.69-11.1_all.deb ...
Unpacking autoconf (2.69-11.1) ...
Selecting previously unselected package autotools-dev.
Preparing to unpack .../02-autotools-dev_20180224.1_all.deb ...
Unpacking autotools-dev (20180224.1) ...
Selecting previously unselected package automake.
Preparing to unpack .../03-automake_1%3a1.16.1-4ubuntu6_all.deb ...
Unpacking automake (1:1.16.1-4ubuntu6) ...
Selecting previously unselected package gcc-9-base:amd64.
Preparing to unpack .../04-gcc-9-base_9.4.0-1ubuntu1~20.04_amd64.deb ...
Unpacking gcc-9-base:amd64 (9.4.0-1ubuntu1~20.04) ...
Selecting previously unselected package libisl22:amd64.
Preparing to unpack .../05-libisl22_0.22.1-1_amd64.deb ...
Unpacking libisl22:amd64 (0.22.1-1) ...
Selecting previously unselected package libmpc3:amd64.
Preparing to unpack .../06-libmpc3_1.1.0-1_amd64.deb ...
Unpacking libmpc3:amd64 (1.1.0-1) ...
Selecting previously unselected package cpp-9.
Preparing to unpack .../07-cpp-9_9.4.0-1ubuntu1~20.04_amd64.deb ...
Unpacking cpp-9 (9.4.0-1ubuntu1~20.04) ...
Selecting previously unselected package cpp.
Preparing to unpack .../08-cpp_4%3a9.3.0-1ubuntu2_amd64.deb ...
Unpacking cpp (4:9.3.0-1ubuntu2) ...
Selecting previously unselected package libcc1-0:amd64.
Preparing to unpack .../09-libcc1-0_10.3.0-1ubuntu1~20.04_amd64.deb ...
Unpacking libcc1-0:amd64 (10.3.0-1ubuntu1~20.04) ...
Selecting previously unselected package libitm1:amd64.
Preparing to unpack .../10-libitm1_10.3.0-1ubuntu1~20.04_amd64.deb ...
Unpacking libitm1:amd64 (10.3.0-1ubuntu1~20.04) ...
Selecting previously unselected package libatomic1:amd64.
Preparing to unpack .../11-libatomic1_10.3.0-1ubuntu1~20.04_amd64.deb ...
Unpacking libatomic1:amd64 (10.3.0-1ubuntu1~20.04) ...
Selecting previously unselected package libasan5:amd64.
Preparing to unpack .../12-libasan5_9.4.0-1ubuntu1~20.04_amd64.deb ...
Unpacking libasan5:amd64 (9.4.0-1ubuntu1~20.04) ...
Selecting previously unselected package liblsan0:amd64.
Preparing to unpack .../13-liblsan0_10.3.0-1ubuntu1~20.04_amd64.deb ...
Unpacking liblsan0:amd64 (10.3.0-1ubuntu1~20.04) ...
Selecting previously unselected package libtsan0:amd64.
Preparing to unpack .../14-libtsan0_10.3.0-1ubuntu1~20.04_amd64.deb ...
Unpacking libtsan0:amd64 (10.3.0-1ubuntu1~20.04) ...
Selecting previously unselected package libubsan1:amd64.
Preparing to unpack .../15-libubsan1_10.3.0-1ubuntu1~20.04_amd64.deb ...
Unpacking libubsan1:amd64 (10.3.0-1ubuntu1~20.04) ...
Selecting previously unselected package libquadmath0:amd64.
Preparing to unpack .../16-libquadmath0_10.3.0-1ubuntu1~20.04_amd64.deb ...
Unpacking libquadmath0:amd64 (10.3.0-1ubuntu1~20.04) ...
Selecting previously unselected package libgcc-9-dev:amd64.
Preparing to unpack .../17-libgcc-9-dev_9.4.0-1ubuntu1~20.04_amd64.deb ...
Unpacking libgcc-9-dev:amd64 (9.4.0-1ubuntu1~20.04) ...
Selecting previously unselected package gcc-9.
Preparing to unpack .../18-gcc-9_9.4.0-1ubuntu1~20.04_amd64.deb ...
Unpacking gcc-9 (9.4.0-1ubuntu1~20.04) ...
Selecting previously unselected package gcc.
Preparing to unpack .../19-gcc_4%3a9.3.0-1ubuntu2_amd64.deb ...
Unpacking gcc (4:9.3.0-1ubuntu2) ...
Selecting previously unselected package libdpkg-perl.
Preparing to unpack .../20-libdpkg-perl_1.19.7ubuntu3_all.deb ...
Unpacking libdpkg-perl (1.19.7ubuntu3) ...
Selecting previously unselected package libfile-fcntllock-perl.
Preparing to unpack .../21-libfile-fcntllock-perl_0.22-3build4_amd64.deb ...
Unpacking libfile-fcntllock-perl (0.22-3build4) ...
Selecting previously unselected package libltdl-dev:amd64.
Preparing to unpack .../22-libltdl-dev_2.4.6-14_amd64.deb ...
Unpacking libltdl-dev:amd64 (2.4.6-14) ...
Selecting previously unselected package libncurses-dev:amd64.
Preparing to unpack .../23-libncurses-dev_6.2-0ubuntu2_amd64.deb ...
Unpacking libncurses-dev:amd64 (6.2-0ubuntu2) ...
Selecting previously unselected package libreadline-dev:amd64.
Preparing to unpack .../24-libreadline-dev_8.0-4_amd64.deb ...
Unpacking libreadline-dev:amd64 (8.0-4) ...
Selecting previously unselected package liblua5.1-0-dev:amd64.
Preparing to unpack .../25-liblua5.1-0-dev_5.1.5-8.1build4_amd64.deb ...
Unpacking liblua5.1-0-dev:amd64 (5.1.5-8.1build4) ...
Selecting previously unselected package nginx-common.
Preparing to unpack .../26-nginx-common_1.18.0-0ubuntu1.2_all.deb ...
Unpacking nginx-common (1.18.0-0ubuntu1.2) ...
Selecting previously unselected package libnginx-mod-http-image-filter.
Preparing to unpack .../27-libnginx-mod-http-image-filter_1.18.0-0ubuntu1.2_amd64.deb ...
Unpacking libnginx-mod-http-image-filter (1.18.0-0ubuntu1.2) ...
Selecting previously unselected package libnginx-mod-http-ndk.
Preparing to unpack .../28-libnginx-mod-http-ndk_1.18.0-0ubuntu1.2_amd64.deb ...
Unpacking libnginx-mod-http-ndk (1.18.0-0ubuntu1.2) ...
Selecting previously unselected package libnginx-mod-http-lua.
Preparing to unpack .../29-libnginx-mod-http-lua_1.18.0-0ubuntu1.2_amd64.deb ...
Unpacking libnginx-mod-http-lua (1.18.0-0ubuntu1.2) ...
Selecting previously unselected package libnginx-mod-http-xslt-filter.
Preparing to unpack .../30-libnginx-mod-http-xslt-filter_1.18.0-0ubuntu1.2_amd64.deb ...
Unpacking libnginx-mod-http-xslt-filter (1.18.0-0ubuntu1.2) ...
Selecting previously unselected package libnginx-mod-mail.
Preparing to unpack .../31-libnginx-mod-mail_1.18.0-0ubuntu1.2_amd64.deb ...
Unpacking libnginx-mod-mail (1.18.0-0ubuntu1.2) ...
Selecting previously unselected package libnginx-mod-stream.
Preparing to unpack .../32-libnginx-mod-stream_1.18.0-0ubuntu1.2_amd64.deb ...
Unpacking libnginx-mod-stream (1.18.0-0ubuntu1.2) ...
Selecting previously unselected package libtool.
Preparing to unpack .../33-libtool_2.4.6-14_all.deb ...
Unpacking libtool (2.4.6-14) ...
Selecting previously unselected package libtool-bin.
Preparing to unpack .../34-libtool-bin_2.4.6-14_amd64.deb ...
Unpacking libtool-bin (2.4.6-14) ...
Selecting previously unselected package lua5.1.
Preparing to unpack .../35-lua5.1_5.1.5-8.1build4_amd64.deb ...
Unpacking lua5.1 (5.1.5-8.1build4) ...
Selecting previously unselected package lua-any.
Preparing to unpack .../36-lua-any_25_all.deb ...
Unpacking lua-any (25) ...
Selecting previously unselected package lua-socket:amd64.
Preparing to unpack .../37-lua-socket_3.0~rc1+git+ac3201d-4_amd64.deb ...
Unpacking lua-socket:amd64 (3.0~rc1+git+ac3201d-4) ...
Selecting previously unselected package lua-sec:amd64.
Preparing to unpack .../38-lua-sec_0.9-3_amd64.deb ...
Unpacking lua-sec:amd64 (0.9-3) ...
Selecting previously unselected package luarocks.
Preparing to unpack .../39-luarocks_2.4.2+dfsg-1_all.deb ...
Unpacking luarocks (2.4.2+dfsg-1) ...
Selecting previously unselected package nginx-core.
Preparing to unpack .../40-nginx-core_1.18.0-0ubuntu1.2_amd64.deb ...
Unpacking nginx-core (1.18.0-0ubuntu1.2) ...
Selecting previously unselected package nginx.
Preparing to unpack .../41-nginx_1.18.0-0ubuntu1.2_all.deb ...
Unpacking nginx (1.18.0-0ubuntu1.2) ...
Selecting previously unselected package pkg-config.
Preparing to unpack .../42-pkg-config_0.29.1-0ubuntu4_amd64.deb ...
Unpacking pkg-config (0.29.1-0ubuntu4) ...
Selecting previously unselected package crowdsec-nginx-bouncer.
Preparing to unpack .../43-crowdsec-nginx-bouncer_1.0.0_amd64.deb ...
Unpacking crowdsec-nginx-bouncer (1.0.0) ...
Setting up libncurses-dev:amd64 (6.2-0ubuntu2) ...
Setting up libfile-fcntllock-perl (0.22-3build4) ...
Setting up nginx-common (1.18.0-0ubuntu1.2) ...

Configuration file '/etc/default/nginx'
 ==> Modified (by you or by a script) since installation.
 ==> Package distributor has shipped an updated version.
   What would you like to do about it ?  Your options are:
    Y or I  : install the package maintainer's version
    N or O  : keep your currently-installed version
      D     : show the differences between the versions
      Z     : start a shell to examine the situation
 The default action is to keep your current version.
*** nginx (Y/I/N/O/D/Z) [default=N] ?
Installing new version of config file /etc/init.d/nginx ...
Installing new version of config file /etc/logrotate.d/nginx ...
Installing new version of config file /etc/nginx/fastcgi.conf ...
Installing new version of config file /etc/nginx/fastcgi_params ...
Installing new version of config file /etc/nginx/mime.types ...
Installing new version of config file /etc/nginx/nginx.conf ...
Installing new version of config file /etc/nginx/win-utf ...
Created symlink /etc/systemd/system/multi-user.target.wants/nginx.service → /lib/systemd/system/nginx.service.
Setting up m4 (1.4.18-4) ...
Setting up lua-socket:amd64 (3.0~rc1+git+ac3201d-4) ...
Setting up libreadline-dev:amd64 (8.0-4) ...
Setting up lua5.1 (5.1.5-8.1build4) ...
update-alternatives: using /usr/bin/lua5.1 to provide /usr/bin/lua (lua-interpreter) in auto mode
update-alternatives: using /usr/bin/luac5.1 to provide /usr/bin/luac (lua-compiler) in auto mode
Setting up libnginx-mod-http-xslt-filter (1.18.0-0ubuntu1.2) ...
Setting up autotools-dev (20180224.1) ...
Setting up libquadmath0:amd64 (10.3.0-1ubuntu1~20.04) ...
Setting up libnginx-mod-http-ndk (1.18.0-0ubuntu1.2) ...
Setting up libmpc3:amd64 (1.1.0-1) ...
Setting up libatomic1:amd64 (10.3.0-1ubuntu1~20.04) ...
Setting up libdpkg-perl (1.19.7ubuntu3) ...
Setting up autoconf (2.69-11.1) ...
Setting up libubsan1:amd64 (10.3.0-1ubuntu1~20.04) ...
Setting up libisl22:amd64 (0.22.1-1) ...
Setting up libnginx-mod-http-lua (1.18.0-0ubuntu1.2) ...
Setting up libcc1-0:amd64 (10.3.0-1ubuntu1~20.04) ...
Setting up liblsan0:amd64 (10.3.0-1ubuntu1~20.04) ...
Setting up libitm1:amd64 (10.3.0-1ubuntu1~20.04) ...
Setting up gcc-9-base:amd64 (9.4.0-1ubuntu1~20.04) ...
Setting up libtsan0:amd64 (10.3.0-1ubuntu1~20.04) ...
Setting up automake (1:1.16.1-4ubuntu6) ...
update-alternatives: using /usr/bin/automake-1.16 to provide /usr/bin/automake (automake) in auto mode
Setting up libnginx-mod-mail (1.18.0-0ubuntu1.2) ...
Setting up lua-sec:amd64 (0.9-3) ...
Setting up liblua5.1-0-dev:amd64 (5.1.5-8.1build4) ...
Setting up libnginx-mod-http-image-filter (1.18.0-0ubuntu1.2) ...
Setting up lua-any (25) ...
Setting up libnginx-mod-stream (1.18.0-0ubuntu1.2) ...
Setting up libltdl-dev:amd64 (2.4.6-14) ...
Setting up libasan5:amd64 (9.4.0-1ubuntu1~20.04) ...
Setting up pkg-config (0.29.1-0ubuntu4) ...
Setting up cpp-9 (9.4.0-1ubuntu1~20.04) ...
Setting up nginx-core (1.18.0-0ubuntu1.2) ...
Not attempting to start NGINX, port 80 is already in use.
Setting up nginx (1.18.0-0ubuntu1.2) ...
Setting up luarocks (2.4.2+dfsg-1) ...
Making manifest for /usr/local/lib/luarocks/rocks
Warning: This looks like a local rocks tree, but you did not pass --local-tree.
Generating index.html for /usr/local/lib/luarocks/rocks
Setting up libgcc-9-dev:amd64 (9.4.0-1ubuntu1~20.04) ...
Setting up cpp (4:9.3.0-1ubuntu2) ...
Setting up gcc-9 (9.4.0-1ubuntu1~20.04) ...
Setting up libtool (2.4.6-14) ...
Setting up crowdsec-nginx-bouncer (1.0.0) ...
Installing https://luarocks.org/lua-resty-http-0.17.0.beta.1-0.src.rock
lua-resty-http 0.17.0.beta.1-0 is now installed in /usr/local (license: 2-clause BSD)

Installing https://luarocks.org/lua-cjson-2.1.0.6-1.src.rock
gcc -O2 -fPIC -I/usr/include/lua5.1 -c lua_cjson.c -o lua_cjson.o
gcc -O2 -fPIC -I/usr/include/lua5.1 -c strbuf.c -o strbuf.o
gcc -O2 -fPIC -I/usr/include/lua5.1 -c fpconv.c -o fpconv.o
gcc -shared -o cjson.so -L/usr/local/lib lua_cjson.o strbuf.o fpconv.o
lua-cjson 2.1.0.6-1 is now installed in /usr/local (license: MIT)

cscli/crowdsec is present, generating API key
API Key : xxxx
Restart nginx to enable the crowdsec bouncer : sudo systemctl restart nginx

If you want to setup captcha remediation, follow official documentation :
https://docs.crowdsec.net/docs/bouncers/nginx#when-using-captcha-remediation
Setting up gcc (4:9.3.0-1ubuntu2) ...
Setting up libtool-bin (2.4.6-14) ...
Processing triggers for ufw (0.36-6ubuntu1) ...
Processing triggers for systemd (245.4-4ubuntu3.15) ...
Processing triggers for man-db (2.9.1-1) ...
Processing triggers for install-info (6.7.0.dfsg.2-5) ...
Processing triggers for libc-bin (2.31-0ubuntu9.7) ...
root@e2e-93-181:~/ralph/docker# sudo systemctl status nginx
● nginx.service - A high performance web server and a reverse proxy server
     Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled)
     Active: inactive (dead)
       Docs: man:nginx(8)

Mar 19 07:24:00 e2e-93-181 systemd[1]: Stopping Startup script for nginx service...
Mar 19 07:24:00 e2e-93-181 systemd[1]: nginx.service: Succeeded.
Mar 19 07:24:00 e2e-93-181 systemd[1]: Stopped Startup script for nginx service.
Mar 19 07:24:00 e2e-93-181 systemd[1]: Starting Startup script for nginx service...
Mar 19 07:24:00 e2e-93-181 nginx[545344]: nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
Mar 19 07:24:00 e2e-93-181 nginx[545344]: nginx: configuration file /etc/nginx/nginx.conf test is successful
Mar 19 07:24:00 e2e-93-181 systemd[1]: Started Startup script for nginx service.
Mar 19 07:33:43 e2e-93-181 systemd[1]: Stopping Startup script for nginx service...
Mar 19 07:33:43 e2e-93-181 systemd[1]: nginx.service: Succeeded.
Mar 19 07:33:43 e2e-93-181 systemd[1]: Stopped Startup script for nginx service.
buixor commented 2 years ago

Hello !

Thanks for the feedback. It seems that plesk is providing its own nginx package (sw-nginx). We will see if the bouncer works with their package, or provide an alternative installation method for those that are using 3rd party packages of nginx.

franciscopaniskaseker commented 1 year ago

Hi @buixor do you need any help here to make crowdsec nginx bouncer possible with plesk? I mean, we can do with firewall boucner, but when most of the accounts are under cloudflare, for example, crowdsec firewall bouncer will not be helpful.

I am not sure which is the easiest option: try to make it able to run with sw-nginx or maybe build some nginx proxy container (that can read cloudflare real ips) and execute some iptables rules to filter the traffic, as bitninja container solution does.

what do you think?

hitesh-pathak commented 9 months ago

@franciscopaniskaseker I know the question was not addressed to me, but I have been struggling with nginx + cloudflare too.

For the second suggestion "an nginx proxy that sees real IPs and then adding iptables rules to filter traffic", one problem will be that iptables will not be able to see the real IPs (particularly if the traffic is encrypted, as cloudflare puts those in a request header cf-connecting-ip)

For unencrypted traffic, I've seen people use something like iptables --match string --algo bm --icase "cf-connecting-ip: <IP>" -j DROP

But string matching is relatively slow, and this won't work for https traffic :(

Sorry if I completely misunderstood your comment.