Code Monkey home page Code Monkey logo

nginx-cleantalk-service's Introduction

Nginx lua-based module to filter spam POST requests to protect your website from spam bots by the blacklist.

Dependencies:

  • nginx-extras
  • lua-cjson

Install:

  • Debian/Ubuntu: apt install nginx-extras lua-cjson
  • Add nginx/conf.d/cache.conf to /etc/nginx/conf.d/ and set cache params as you want.
  • Add include /etc/nginx/snippets/cleantalk-api.conf; before protected location (Its API cache location)
  • Add this to "location" that you want to protect: set $apikey '123456789'; access_by_lua_file /etc/nginx/scripts/cleantalk.lua
  • Set $apikey to your key (Get it from: https://cleantalk.org/register?platform=api)
  • Do service nginx reload for apply changes

How its works?

When someone makes a POST request, parse it and grab email and IP (regex-based). IP and Email will be checked with the CleanTalk Database and if they are currently blacklisted then the visitor sees the block screen. If not then the POST request will be approved.

If there is no IP in the POST request โ€” "http_remote_addr" (Real client address) will be used.

How Does the CleanTalk Database of Spam IP & Email Work?

CleanTalk analyzes spambots activity from more than 320,000 websites. We process about 2 millions of requests every day.

IPs and emails are being added to the CleanTalk Database only if they showed spam activity on several websites at once in a short period of time. Addresses that haven't shown any spam activity for the past 14 days will be deleted from the database. It allows us to keep the database information in the freshest state.

Spam activity data of IPs/emails are being updated in real-time.

Learn more about CleanTalk BlackList

How Is It Helpful

CleanTalk anti-spam module allows you to block bad IP addresses on your web server. Protect from spam attacks Block requests with fake emails Block other types of attacks on a web server from bad IP addresses using POST requests. Reduce web server load

Also, you can use CleanTalk API "spam_check" to check IP and Email via CleanTalk BlackList.

TODO:

  • Remove additional "/spam_check" location for proxy requests
  • Add session mechanics support (for protect entire folder w/o additional requests)?
  • Remove cjson dependencies (Possible to parse Json to native "lua table")
  • Add "GET" data support?
  • Better code and optimisation?

nginx-cleantalk-service's People

Contributors

dvershinin avatar foxexe avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.