I got into the self-hosting scene this year when I wanted to start up my own website run on old recycled thinkpad. A lot of time was spent learning about ufw, reverse proxies, header security hardening, fail2ban.

Despite all that I still had a problem with bots knocking on my ports spamming my logs. I tried some hackery getting fail2ban to read caddy logs but that didnt work for me. I nearly considered giving up and going with cloudflare like half the internet does. But my stubbornness for open source self hosting and the recent cloudflare outages this year have encouraged trying alternatives.

Coinciding with that has been an increase in exposure to seeing this thing in the places I frequent like codeberg. This is Anubis, a proxy type firewall that forces the browser client to do a proof-of-work security check and some other nice clever things to stop bots from knocking. I got interested and started thinking about beefing up security.

I’m here to tell you to try it if you have a public facing site and want to break away from cloudflare It was VERY easy to install and configure with caddyfile on a debian distro with systemctl. In an hour its filtered multiple bots and so far it seems the knocks have slowed down.

https://anubis.techaro.lol/

My botspam woes have seemingly been seriously mitigated if not completely eradicated. I’m very happy with tonights little security upgrade project that took no more than an hour of my time to install and read through documentation. Current chain is caddy reverse proxy -> points to Anubis -> points to services

Good place to start for install is here

https://anubis.techaro.lol/docs/admin/native-install/

  • Appoxo@lemmy.dbzer0.com
    link
    fedilink
    English
    arrow-up
    3
    ·
    6 days ago

    Maybe you know the answer to my question:
    If I’d want to use any app that doesnt run in a webbrowser (e.g. the native jellyfin app), how would that work? Does it still work then?

    • SmokeyDope@piefed.socialOP
      link
      fedilink
      English
      arrow-up
      1
      ·
      6 days ago

      It explicitly checks for web browser properties to apply challenges and all its challenges require basic web functionality like page refresh. Unless the connection to your server involves handling a user agents string it won’t work, I think this I how it is anyway. Hope this helped.

      • Appoxo@lemmy.dbzer0.com
        link
        fedilink
        English
        arrow-up
        1
        ·
        6 days ago

        Assuming what you said is correct, it wouldnt help my use case.
        Not hosting any page meant for public consumption anyway so it’s not really important.
        But thanks for answering :)

    • chaospatterns@lemmy.world
      link
      fedilink
      English
      arrow-up
      1
      ·
      6 days ago

      If the app is just a WebView wrapper around the application, then the challenge page would load and try to be evaluated.

      If it’s a native Android/iOS app, then it probably wouldn’t work because the app would try to make HTTP API calls and get back something unexpected.

  • 0_o7@lemmy.dbzer0.com
    link
    fedilink
    English
    arrow-up
    30
    arrow-down
    1
    ·
    6 days ago

    I don’t mind Anubis but the challenge page shouldn’t really load an image. It’s wasting extra bandwidth for nothing.

    Just parse the challenge and move on.

    • Allero@lemmy.today
      link
      fedilink
      English
      arrow-up
      24
      arrow-down
      1
      ·
      6 days ago

      Afaik, you can set it up not to have any image, or have any other one.

      • Voroxpete@sh.itjust.works
        link
        fedilink
        English
        arrow-up
        10
        arrow-down
        4
        ·
        edit-2
        6 days ago

        It’s actually a brilliant monetization model. If you want to use it as is, it’s free, even for large corporate clients.

        If you want to get rid of the puppygirls though, that’s when you have to pay.

        • frongt@lemmy.zip
          link
          fedilink
          English
          arrow-up
          3
          arrow-down
          1
          ·
          6 days ago

          It’s open source, so you could always just patch it without paying too. But you should support the maintainers if you think they deserve it.

    • Kilgore Trout@feddit.it
      link
      fedilink
      English
      arrow-up
      19
      arrow-down
      1
      ·
      edit-2
      6 days ago

      It’s a palette of 10 colours. I would guess it uses an indexed colorspace, reducing the size to a minimum.
      edit: 28 KB on disk

      • CameronDev@programming.dev
        link
        fedilink
        English
        arrow-up
        12
        arrow-down
        3
        ·
        6 days ago

        A HTTP get request is a few hundred bytes. The response is 28KB. Thats 280x. If a large botnet wanted to denial of service an Anubis protected site, requesting that image could be enough.

        Ideally, Anubis should serve as little data as possible until the POW is completed. Caching the POW algorithm (and the image) to a CDN would also mitigate the issue.

        • teolan@lemmy.world
          link
          fedilink
          English
          arrow-up
          9
          arrow-down
          2
          ·
          6 days ago

          The whole point of Anubis is to not have to go through a CDN to sustain scrapping botnets

          • CameronDev@programming.dev
            link
            fedilink
            English
            arrow-up
            5
            ·
            6 days ago

            I dunno that is true, nothing in the docs indicates that it is explicitly anti-CDN. And using a CDN for a static javascript resource and an image isn’t the same as running the entire site through a CDN proxy.

        • Kilgore Trout@feddit.it
          link
          fedilink
          English
          arrow-up
          1
          ·
          2 days ago

          I might agree, still one could argue that brand recognisability is contributing to the service as well.

          • CameronDev@programming.dev
            link
            fedilink
            English
            arrow-up
            1
            ·
            2 days ago

            Definitely, which is why i suggested hosting the image + js on a CDN. Keeps brand awareness, and lets the CDN take the brunt of any malicious activity. with a bit of code-golfing, the data served by Anubis directly prior to POW could be a few hundred bytes, without impacting its functionality.

    • quick_snail@feddit.nl
      link
      fedilink
      English
      arrow-up
      8
      ·
      edit-2
      6 days ago

      Great article, but I disagree about WAFs.

      Try to secure a nonprofit’s web infrastructure with as 1 IT guy and no budget for devs or security.

      It would be nice if we could update servers constantly and patch unmaintained code, but sometimes you just need to front it with something that plugs those holes until you have the capacity to do updates.

      But 100% the WAF should be run locally, not a MiTM from evil US corp in bed with DHS.

  • quick_snail@feddit.nl
    link
    fedilink
    English
    arrow-up
    29
    arrow-down
    4
    ·
    6 days ago

    Kinda sucks how it makes websites inaccessible to folks who have to disable JavaScript for security.

    • poVoq@slrpnk.net
      link
      fedilink
      English
      arrow-up
      31
      arrow-down
      6
      ·
      6 days ago

      I kinda sucks how AI scrapers make websites inaccessible to everyone 🙄

          • quick_snail@feddit.nl
            link
            fedilink
            English
            arrow-up
            1
            arrow-down
            5
            ·
            edit-2
            6 days ago

            Lol I’m the sysadmin for many sites that doesn’t have these issues, so obviously I do…

            It you’re the one that thinks you need this trash pow fronting for a static site, then clearly you’re the one who is ignorant

            • poVoq@slrpnk.net
              link
              fedilink
              English
              arrow-up
              12
              ·
              6 days ago

              Obviously I don’t think you need Anubis for a static site. And if that is what your admin experience is limited too, than you have a strong case of dunning krueger.

              • quick_snail@feddit.nl
                link
                fedilink
                English
                arrow-up
                1
                ·
                edit-2
                3 days ago

                99% of the pages that Anubis is fronting are static.

                It’s an abuse if the tool that’s harming the internet.

                • poVoq@slrpnk.net
                  link
                  fedilink
                  English
                  arrow-up
                  1
                  ·
                  3 days ago

                  Lol, wat? I have not seen Anubis even once in front of a static page. You are either making shit up or don’t understand what a static site is 🤦

    • WhyJiffie@sh.itjust.works
      link
      fedilink
      English
      arrow-up
      14
      ·
      6 days ago

      there’s a fork that has non-js checks. I don’t remember the name but maybe that’s what should be made more known

      • quick_snail@feddit.nl
        link
        fedilink
        English
        arrow-up
        3
        ·
        6 days ago

        Please share if you know.

        The only way I know how to do this is running a Tor Onion Service, since the tor protocol has built-in pow support (without js)

        • WhyJiffie@sh.itjust.works
          link
          fedilink
          English
          arrow-up
          8
          ·
          edit-2
          6 days ago

          It’s this one: https://git.gammaspectra.live/git/go-away

          the project name is a bit unfortunate to show for users, maybe change that if you will use it.

          some known privacy services use it too, including the invidious at nadeko.net, so you can check there how it works. It’s one of the most popular inv servers so I guess it cannot be bad, and they use multiple kinds of checks for each visitor

  • Fizz@lemmy.nz
    link
    fedilink
    English
    arrow-up
    5
    arrow-down
    8
    ·
    6 days ago

    Its a fun little project and I like the little character but it doesnt actually do anything at this point.

    • daniskarma@lemmy.dbzer0.com
      link
      fedilink
      English
      arrow-up
      1
      ·
      edit-2
      6 days ago

      I don’t know if “anything”. But surely people overestimate its capabilities.

      It’s only a PoW challenge. Any bot can execute a PoW challenge. For a smal to medium number of bots the energy difference it’s negligible.

      Anubis it’s useful when millions of bots would want to attack a site. Then the energy difference of the PoW (specially because Anubis increase the challenge if there’s a big number of petitions) can be enough to make the attacker desist, or maybe it’s not enough, but at least then it’s doing something.

      I see more useful against DDOS than AI scrapping. And only if the service being DDOS is more heavy than Anubis itself, if not you can get DDOS via anubis petitions. For AI scrapping I don’t see the point, you don’t need millions of bots to scrape a site unless you are talking about a massively big site.

  • sudo@programming.dev
    link
    fedilink
    English
    arrow-up
    51
    arrow-down
    8
    ·
    6 days ago

    I’ve repeatedly stated this before: Proof of Work bot-management is only Proof of Javascript bot-management. It is nothing to a headless browser to by-pass. Proof of JavaScript does work and will stop the vast majority of bot traffic. That’s how Anubis actually works. You don’t need to punish actual users by abusing their CPU. POW is a far higher cost on your actual users than the bots.

    Last I checked Anubis has an JavaScript-less strategy called “Meta Refresh”. It first serves you a blank HTML page with a <meta> tag instructing the browser to refresh and load the real page. I highly advise using the Meta Refresh strategy. It should be the default.

    I’m glad someone is finally making an open source and self hostable bot management solution. And I don’t give a shit about the cat-girls, nor should you. But Techaro admitted they had little idea what they were doing when they started and went for the “nuclear option”. Fuck Proof of Work. It was a Dead On Arrival idea decades ago. Techaro should strip it from Anubis.

    I haven’t caught up with what’s new with Anubis, but if they want to get stricter bot-management, they should check for actual graphics acceleration.

    • SmokeyDope@piefed.socialOP
      link
      fedilink
      English
      arrow-up
      35
      arrow-down
      1
      ·
      edit-2
      6 days ago

      Something that hasn’t been mentioned much in discussions about Anubis is that it has a graded tier system of how sketchy a client is and changing the kind of challenge based on a a weighted priority system.

      The default bot policies it comes with has it so squeaky clean regular clients are passed through, then only slightly weighted clients/IPs get the metarefresh, then its when you get to moderate-suspicion level that JavaScript Proof of Work kicks. The bot policy and weight triggers for these levels, challenge action, and duration of clients validity are all configurable.

      It seems to me that the sites who heavy hand the proof of work for every client with validity that only last every 5 minutes are the ones who are giving Anubis a bad wrap. The default bot policy settings Anubis comes with dont trigger PoW on the regular Firefox android clients ive tried including hardened ironfox. meanwhile other sites show the finger wag every connection no matter what.

      Its understandable why some choose strict policies but they give the impression this is the only way it should be done which Is overkill. I’m glad theres config options to mitigate impact normal user experience.

      • sudo@programming.dev
        link
        fedilink
        English
        arrow-up
        5
        ·
        6 days ago

        Anubis is that it has a graded tier system of how sketchy a client is and changing the kind of challenge based on a a weighted priority system.

        Last I checked that was just User-Agent regexes and IP lists. But that’s where Anubis should continue development, and hopefully they’ve improved since. Discerning real users from bots is how you do proper bot management. Not imposing a flat tax on all connections.

    • rtxn@lemmy.world
      link
      fedilink
      English
      arrow-up
      16
      arrow-down
      3
      ·
      edit-2
      6 days ago

      POW is a far higher cost on your actual users than the bots.

      That sentence tells me that you either don’t understand or consciously ignore the purpose of Anubis. It’s not to punish the scrapers, or to block access to the website’s content. It is to reduce the load on the web server when it is flooded by scraper requests. Bots running headless Chrome can easily solve the challenge, but every second a client is working on the challenge is a second that the web server doesn’t have to waste CPU cycles on serving clankers.

      POW is an inconvenience to users. The flood of scrapers is an existential threat to independent websites. And there is a simple fact that you conveniently ignored: it fucking works.

      • sudo@programming.dev
        link
        fedilink
        English
        arrow-up
        5
        arrow-down
        2
        ·
        6 days ago

        Its like you didn’t understand anything I said. Anubis does work. I said it works. But it works because most AI crawlers don’t have a headless browser to solve the PoW. To operate efficiently at the high volume required, they use raw http requests. The vast majority are probably using basic python requests module.

        You don’t need PoW to throttle general access to your site and that’s not the fundamental assumption of PoW. PoW assumes (incorrectly) that bots won’t pay the extra flops to scrape the website. But bots are paid to scape the website users aren’t. They’ll just scale horizontally and open more parallel connections. They have the money.

        • poVoq@slrpnk.net
          link
          fedilink
          English
          arrow-up
          5
          arrow-down
          3
          ·
          6 days ago

          You are arguing a strawman. Anubis works because because most AI scrapers (currently) don’t want to spend extra on running headless chromium, and because it slightly incentivises AI scrapers to correctly identify themselves as such.

          Most of the AI scraping is frankly just shoddy code written by careless people that don’t want to ddos the independent web, but can’t be bothered to actually fix that on their side.

          • sudo@programming.dev
            link
            fedilink
            English
            arrow-up
            3
            arrow-down
            1
            ·
            edit-2
            6 days ago

            You are arguing a strawman. Anubis works because because most AI scrapers (currently) don’t want to spend extra on running headless chromium

            WTF, That’s what I already said? That was my entire point from the start!? You don’t need PoW to force headless usage. Any JavaScript challenge will suffice. I even said the Meta Refresh challenge Anubis provides is sufficient and explicitly recommended it.

            • poVoq@slrpnk.net
              link
              fedilink
              English
              arrow-up
              3
              arrow-down
              4
              ·
              6 days ago

              And how do you actually check for working JS in a way that can’t be easily spoofed? Hint: PoW is a good way to do that.

              Meta refresh is a downgrade in usability for everyone but a tiny minority that has disabled JS.

              • sudo@programming.dev
                link
                fedilink
                English
                arrow-up
                3
                ·
                6 days ago

                And how do you actually check for working JS in a way that can’t be easily spoofed? Hint: PoW is a good way to do that.

                Accessing the browsers API in any way is way harder to spoof than some hashing. I already suggested checking if the browser has graphics acceleration. That would filter out the vast majority of headless browsers too. PoW is just math and is easy to spoof without running any JavaScript. You can even do it faster than real JavaScript users something like Rust or C.

                Meta refresh is a downgrade in usability for everyone but a tiny minority that has disabled JS.

                What are you talking about? It just refreshes the page without doing any of the extra computation that PoW does. What extra burden does it put on users?

                • poVoq@slrpnk.net
                  link
                  fedilink
                  English
                  arrow-up
                  2
                  arrow-down
                  2
                  ·
                  6 days ago

                  If you check for GPU (not generally a bad idea) you will have the same people that currently complain about JS, complain about this breaking with their anti-fingerprinting browser addons.

                  But no, you can’t spoof PoW obviously, that’s the entire point of it. If you do the calculation in Javascript or not doesn’t really matter for it to work.

                  In the current shape Anubis has zero impact on usability for 99% of the site visitors, not so with meta refresh.

    • url@feddit.fr
      link
      fedilink
      Français
      arrow-up
      16
      arrow-down
      1
      ·
      6 days ago

      Did i forgot to mention it doesnt work without js that i keep disabled

  • perishthethought@piefed.social
    link
    fedilink
    English
    arrow-up
    10
    ·
    6 days ago

    I don’t really understand what I am seeing here, so I have to ask – are these Security issues a concern?

    https://github.com/TecharoHQ/anubis/security

    I have a server running a few tiny web sites, so I am considering this, but I’m always concerned about the possibility that adding more things to it could make it less secure, versus more. Thanks for any thoughts.

    • artyom@piefed.social
      link
      fedilink
      English
      arrow-up
      3
      arrow-down
      1
      ·
      6 days ago

      This isn’t really a security issue as much as it is a DDOS issue.

      Imagine you own a brick and mortar store. And periodically one thousand fucking people sprint into your store and start recording the UPCs on all the products, knocking over every product in the store along the way. They don’t buy anything, they’re exclusively there to collect information from your store which they can use to grift investors and burn precious resources, and if they fuck your shit up in the process, that’s your problem.

      This bot just sits at the door and ensures the people coming in there are actually shoppers interested in the content of some items of your store.

    • lime!@feddit.nu
      link
      fedilink
      English
      arrow-up
      17
      ·
      6 days ago

      all of the issues listed are closed so any recent version is fine.

      also, you probably don’t need to deploy this unless you have a problem with bots.

    • SmokeyDope@piefed.socialOP
      link
      fedilink
      English
      arrow-up
      5
      ·
      6 days ago

      Security issues are always a concern the question is how much. Looking at it they seem to at most be ways to circumvent the Anubis redirect system to get to your page using very specific exploits. These are marked as m low to moderate priority and I do not see anything that implies like system level access which is the big concern. Obviously do what you feel is best but IMO its not worth sweating about. Nice thing about open source projects is that anyone can look through and fix, if this gets more popular you can expect bug bounties and professional pen testing submissions.

  • termaxima@slrpnk.net
    link
    fedilink
    English
    arrow-up
    2
    ·
    5 days ago

    I am very annoyed that I have to enable cloudflare’s JavaScript on so many websites, I would much prefer if more of them used Anubis so I didn’t have third-party JavaScript running as often.

    ( coming from an annoying user who tries to enable the fewest things possible in NoScript )

    • SmokeyDope@piefed.socialOP
      link
      fedilink
      English
      arrow-up
      26
      arrow-down
      5
      ·
      7 days ago

      You know the thing is that they know the character is a problem/annoyance, thats how they grease the wheel on selling subscription access to a commecial version with different branding.

      https://anubis.techaro.lol/docs/admin/botstopper/

      pricing from site

      Commercial support and an unbranded version

      If you want to use Anubis but organizational policies prevent you from using the branding that the open source project ships, we offer a commercial version of Anubis named BotStopper. BotStopper builds off of the open source core of Anubis and offers organizations more control over the branding, including but not limited to:

      • Custom images for different states of the challenge process (in process, success, failure)
      • Custom CSS and fonts
      • Custom titles for the challenge and error pages
      • “Anubis” replaced with “BotStopper” across the UI
      • A private bug tracker for issues

      In the near future this will expand to:

      • A private challenge implementation that does advanced fingerprinting to check if the client is a genuine browser or not
      • Advanced fingerprinting via Thoth-based advanced checks

      In order to sign up for BotStopper, please do one of the following:

      • Sign up on GitHub Sponsors at the $50 per month tier or higher
      • Email sales@techaro.lol with your requirements for invoicing, please note that custom invoicing will cost more than using GitHub Sponsors for understandable overhead reasons

      I have to respect the play tbh its clever. Absolutely the kind of greasy shit play that Julian from the trailer park boys would do if he were an open source developer.

      • webghost0101@sopuli.xyz
        link
        fedilink
        English
        arrow-up
        28
        arrow-down
        4
        ·
        6 days ago

        I wish more projects did stuff like this.

        It just feels silly and unprofessional while being seriously useful. Exactly my flavour of software, makes the web feel less corporate.

      • Nate Cox@programming.dev
        link
        fedilink
        English
        arrow-up
        10
        arrow-down
        5
        ·
        6 days ago

        I can’t access the page to validate this because I don’t allow JS; isn’t that gated behind a paywall?

        • CoyoteFacts@piefed.ca
          link
          fedilink
          English
          arrow-up
          4
          arrow-down
          1
          ·
          6 days ago

          It looks like it might be; I just know someone that has a site using it and they use a different mascot, so I thought it would have been trivial. I kind of wonder why it wouldn’t be possible to just docker bind mount a couple images into the right path, but I’m guessing maybe they obfuscate/archive the file they’re reading from or something?

          • Axolotl@feddit.it
            link
            fedilink
            English
            arrow-up
            6
            arrow-down
            1
            ·
            6 days ago

            It’s actually possible, also, it’s open source so nothing stop you from making your fork with your own images and build it

          • Nate Cox@programming.dev
            link
            fedilink
            English
            arrow-up
            8
            arrow-down
            5
            ·
            6 days ago

            Lots of idol worship in the dev community, question the current darling and people get upset.

            • Lemminary@lemmy.world
              link
              fedilink
              English
              arrow-up
              4
              arrow-down
              4
              ·
              edit-2
              6 days ago

              Not idol worship, rather, it’s silly to complain about JS when tools like NoScript allow you to selectively choose what runs instead of guessing what it is. It’s simply a documentation page like it says on the URL. I mean, they’re incredibly tame on the danger scale to leave your guard all the way up and instead take a jab at the entire community that had nothing to do with your personal choices.

              • Nate Cox@programming.dev
                link
                fedilink
                English
                arrow-up
                6
                arrow-down
                4
                ·
                6 days ago

                Who jabbed at anything?

                I can’t get to that page, so I asked a question about the contents.

                Someone here is being silly, we just disagree about who.

                • Lemminary@lemmy.world
                  link
                  fedilink
                  English
                  arrow-up
                  4
                  arrow-down
                  4
                  ·
                  edit-2
                  6 days ago

                  It gets quite silly when you blame the entire dev community for supposedly downvoting you over ideals rather than being overly strict about them. I also prefer HTML-first and think it should be the norm, but I draw the line somewhere reasonable.

                  I can’t get to that page, so I asked a question

                  Yeah, and you can run the innocuous JS or figure out what it is from the URL. You’re tying your own hands while dishing it out to everyone else.

        • M.int@lemmy.zip
          link
          fedilink
          English
          arrow-up
          5
          arrow-down
          1
          ·
          6 days ago

          You can just fork it and replace the image.

          The authors talks about it here on their blog a bit more.

      • quick_snail@feddit.nl
        link
        fedilink
        English
        arrow-up
        5
        ·
        edit-2
        6 days ago

        sure, but they have to maintain it.

        Wazuh ships with rules that are maintained by wazuh. Less code rot.

        • Victor@lemmy.world
          link
          fedilink
          English
          arrow-up
          2
          ·
          6 days ago

          That’s really good, could be worth looking into in that case. 👍 Thanks for following up!