cross-posted from: https://lemmy.world/post/11162262

Hey,

For all of you that are running proper setups and use nftables to protect your servers be aware that pvxe/nftables-geoip now has the ability to generate IP lists by country.

This can be used to, for instance, drop all traffic from specific countries or the opposite, drop everything except for your own country.

https://github.com/pvxe/nftables-geoip/commit/c137151ebc05f4562c56e6802761e0a93ed107a2

Here’s how you can block / track traffic from certain countries:

Previously you had to load the entire geoip DB containing multiple GB and would end up using a LOT of RAM. Those guides aren’t yet updated to use the country specific files but it’s just about changing the include line to whatever you’ve generated with pvxe/nftables-geoip.

  • @[email protected]
    link
    fedilink
    4
    edit-2
    11 months ago

    Mmh. We should use georestriction with caution. Ultimatly the internet was made to connect people. And blocking people based on their origin is an attack on freedom and equality. There are valid use-cases, though. Just don’t take it lightly.

    • @TCB13OP
      link
      English
      3
      edit-2
      11 months ago

      Not people, it’s more about adding an extra protection step for some services like a system management-only VPN or SSH (if not behind the VPN) and it shouldn’t be the only thing deployed. Fail2ban and others should be there as well.

      After all it doesn’t make sense to allow access to your VPN from China or maybe restrict it to your country if you’re not traveling. There’s another use case that is, you need to access some service from another system where you can’t have a VPN and that system doesn’t have a static IP, this increases the security a bit. It should be narrowed down to the ISP ranges level but that’s not always possible.

      • @[email protected]
        link
        fedilink
        4
        edit-2
        11 months ago

        Sure, I didn’t list what I meant by ‘valid use-cases’. If it’s just your private VPN or SSH endpoint, it’s like blocking your bank card from being used abroad. It might backfire once you travel and forgot about it. But I think it’s a valid use case. Ultimately it’s not the countries you want to block but address ranges which get used by attackers. But security is complex, it may not be feasible to allow-list just the carriers you use to connect, or find a suitable blocklist.

        I’d be happy if georestriction wasn’t a thing and I could stream Doctor Who from the BBC and some news sites wouldn’t refuse service to me because I live in the EU and they don’t want to implement the GDPR.

        But I agree, this is just a tool. And it can be used for good things and bad things.

        I don’t complain if the same tool is used to route my requests to a datacenter nearby.