Join the community today
Register Now

Nginx Automated Geo Ban

Discussion in 'Nginx, PHP-FPM & MariaDB MySQL' started by Floren, Aug 25, 2014.

Tags:
  1. Floren

    Floren Active Member

    148
    77
    28
    Jun 6, 2014
    Ratings:
    +77
    Local Time:
    5:19 PM
    We implemented this at AXIVO, since we had many users hammering our servers unnecessarily.
    @eva2000, I'm sure you can work something to adjust the tutorial for Centminmod? The idea is to demonstrate how easy is to implement a solid ban solution in Nginx, without the complexity of fail2ban, etc.

    I'm sure others will be interested to add an automated layer of security. However, the question is how to determine the proper number of strikes for a busy server? I think GoAccess will allow you to this, then you can tweak the number of strikes easy.


    Tutorial Link
     
  2. eva2000

    eva2000 Administrator Staff Member

    50,489
    11,667
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,095
    Local Time:
    7:19 AM
    Nginx 1.25.x
    MariaDB 10.x
    Interesting approaching to banning users :)

    Curious if you're doing anything to handle legit users like Google and search bots, 3rd party web monitoring services that check your servers every 60 seconds etc ?
     
  3. Floren

    Floren Active Member

    148
    77
    28
    Jun 6, 2014
    Ratings:
    +77
    Local Time:
    5:19 PM
    @eva2000, it is a very good idea to add exception for that. Easiest way would be to filter the Useragent, I'm going to add this to the script.
     
  4. Floren

    Floren Active Member

    148
    77
    28
    Jun 6, 2014
    Ratings:
    +77
    Local Time:
    5:19 PM
    Actually i'll let you hacker your way into script, @eva2000. That script was provided as a tutorial. :)
    Is pretty easy, add a grep -v and use an array to store the Useragent exceptions.
     
  5. eva2000

    eva2000 Administrator Staff Member

    50,489
    11,667
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,095
    Local Time:
    7:19 AM
    Nginx 1.25.x
    MariaDB 10.x
    no worries :)

    Has me thinking though, are there ways to stress and load test your Axivo YUM repo to see how much capacity it can handle ? How much bandwidth is your Axivo YUM repo consuming on average/peaks ?