I put up a vps with nginx and the logs show dodgy requests within minutes, how do you guys deal with these?

Edit: Thanks for the tips everyone!

  • ItsGhost@sh.itjust.works
    link
    fedilink
    English
    arrow-up
    10
    ·
    1 year ago

    Seconded, not only is CrowdSec a hell of a lot more resource efficient (Go vs Python IIRC), having it download a list of known bad actors for you in advance really slows down what it needs to process in the first place. I’ve had servers DDoSed just by fail2ban trying to process the requests.

    • Alfi@lemmy.alfi.casa
      link
      fedilink
      English
      arrow-up
      3
      ·
      edit-2
      1 year ago

      Hi,

      Reading the thread I decided to give it a go, I went ahead and configured crowdsec. I have a few questions, if I may, here’s the setup:

      • I have set up the basic collections/parsers (mainly nginx/linux/sshd/base-http-scenarios/http-cve)
      • I only have two services open on the firewall, https and ssh (no root login, ssh key only)
      • I have set up the firewall bouncer.

      If I understand correctly, any attack detected will result in the ip being banned via iptables rule (for a configured duration, by default 4 hours).

      • Is there any added value to run the nginx bouncer on top of that, or any other?
      • cscli hub update/upgrade will fetch new definitions for collections if I undestand correctly. Is there any need to run this regularly, scheduled with let’s say a cron job, or does crowdsec do that automatically in the background?
      • ItsGhost@sh.itjust.works
        link
        fedilink
        English
        arrow-up
        1
        ·
        1 year ago

        Well I was expecting some form of notification for replies, but still, seen it now.

        My understanding of this is limited having mostly gotten as far as you have and been satisfied.

        For other bouncers, there’s actually a few decisions you can apply. By default the only decision is BAN which as the name suggests just outright blocks the IP at whatever level your bouncer runs at (L4 for firewall and L7 for nginx). The nginx bouncer can do more thought with CAPTCHA or CHALLENGE decisions to allow false alerts to still access your site. I tried writing something similar for traefik but haven’t deployed anything yet to comment further.

        Wih updates, I don’t have them on automated, but I do occasionally go in and run a manual update when I remember (usually when I upgrade my OPNSense firewall that’s runs it). I don’t think it’s a bad idea at all to automate them, however the attack vectors don’t change that often. One thing to note, newer scenarios only run on the latest agent, something I discovered recently when trying to upgrade. I believe it will refuse to update them if it would cause them to break in this way, but test it yourself before enabling corn