项目作者: emnsen

项目描述 :
Block crawl(bad bot) bot requests
高级语言: Python
项目地址: git://github.com/emnsen/basic-nginx-fw.git
创建时间: 2019-01-03T12:06:22Z
项目社区:https://github.com/emnsen/basic-nginx-fw

开源协议:

下载


Usage

  1. sudo apt install ipset iptables
  2. ipset create blacklist hash:ip
  3. iptables -A FORWARD -m set --match-set blacklist src -j DROP
  4. chmod +x parser.py logfilter.sh run.sh
  5. chmod -R 777 ips/ logs/ results/
  6. ./parser.py

Cron

  1. */5 * * * * /usr/bin/python3.5 /PATH/parser.py >> /PATH/cron.log 2>&1

Notes:

  1. If you are going to use the root user crontab IN, do not forget to manually assign the BASE_PATH variable.
  2. Nginx log path variable: ACCESS_LOG_FILE in parser.py
  3. The last 5 minutes are scanned. Check out the logfilter.sh file if you want to change it