mitchellkrogza / nginx-ultimate-bad-bot-blocker

Nginx Block Bad Bots, Spam Referrer Blocker, Vulnerability Scanners, User-Agents, Malware, Adware, Ransomware, Malicious Sites, with anti-DDOS, Wordpress Theme Detector Blocking and Fail2Ban Jail for Repeat Offenders
Other
3.97k stars 477 forks source link

[INSTALLATION] ./install-ngxblocker requires 'pidof' #399

Closed weiqj closed 4 years ago

weiqj commented 4 years ago

sudo yum install sysvinit-tools Loaded plugins: priorities, update-motd, upgrade-helper amzn-main | 2.1 kB 00:00
amzn-updates | 3.8 kB 00:00
No package sysvinit-tools available. Error: Nothing to do

itoffshore commented 4 years ago

yum provides pidof

& install the correct package

weiqj commented 4 years ago

yum provides pidof

& install the correct package

I believe it is an Amazon Linux specific issue. The installation breaks with wrong error message.

weiqj commented 4 years ago

I just checked the code,

find_binary() {
        local x= path= binary=$1 bin_paths='/bin /usr/bin /usr/local/bin /usr/sbin /usr/local/sbin /root/bin /root/.bin'

On Amazon Limux, pidof is located in /sbin, which doesn't seem to be in the list.

weiqj commented 4 years ago

I can confirm that adding /sbin to the bin_paths solved the problem.

However, the two include lines below were added to the wrong location. I had to manually correct it.

  include /etc/nginx/bots.d/ddos.conf;
  include /etc/nginx/bots.d/blockbots.conf;
itoffshore commented 4 years ago

the code that controls where the includes are inserted is around line 460 of setup-ngxblocker:

line=$(find_includes $MAIN_CONF sendfile last http first '\}' last )

different distributions use different style nginx.conf so it is difficult to cover every use case