I read a comment on here some time ago where the person said they were using cloudflared to expose some of their self-hosted stuff to the Internet so they can access it remotely.

I am currently using it to expose my RSS feed reader, and it works out fine. I also like the simplicity of Cloudflare’s other offerings.

Any thoughts on why cloudflared is not a good idea? What alternatives would you suggest? How easy/difficult are they to setup?

  • Dave@lemmy.nz
    link
    fedilink
    English
    arrow-up
    70
    ·
    10 months ago

    I think concerns come in two flavours:

    1. Privacy/security: Cloudflare terminates HTTPS, which means they decrypt your data on their side (e.g. browser to cloudflare section) then re-encrypt for the second part (cloudflare to server). They can therefore read your traffic, including passwords. Depending on your threat model, this might be a concern or it might not. A counterpoint is that Cloudflare helps protect your service from bad actors, so it could be seen to increase security.
    2. Cloudflare is centralised. The sidebar of this community states “A place to share alternatives to popular online services that can be self-hosted without giving up privacy or locking you into a service you don’t control.”, and Cloudflare is for sure a service you don’t control, and arguably you’re locked into it if you can’t access your stuff without it. Some people think Coudflare goes against the ethos of self-hosting.

    With that said, you’ll find several large lemmy instances (and many small ones) use cloudflare. While you’ll easily find people against its use, you’ll find many more people in the self-hosted community using it because it’s (typically) free and it works. If you want to use it, and you’re ok with the above, then go ahead.

    • Nibodhika@lemmy.world
      link
      fedilink
      English
      arrow-up
      22
      ·
      10 months ago

      There’s a third point which is: Things in CloudFlare are publicly accessible, so if you don’t put a service on front for authentication and the service you’re exposing has no authentication, a weak password or a security issue, you’re exposing your server directly to the internet and bad actors can easily find it.

      Which is why some services that I don’t want to have complicated passwords are only exposed via Tailscale, so only people inside the VPN can access them.

    • lemmyvore@feddit.nl
      link
      fedilink
      English
      arrow-up
      4
      ·
      10 months ago

      In addition to the above, most of the percieved advantages of CF are non-existent on the free tier that most people use. Their “DDoS protection” just means they’ll drop your tunnel like a hot potato, and their “attack mitigation” on the free tier is a low-effort web app firewall (WAF) that you can replace with a much better and fully customizable self-hosted version.

      • Dave@lemmy.nz
        link
        fedilink
        English
        arrow-up
        4
        ·
        10 months ago

        They explicitly use free DDoS protection as a way to get you in the door, and upsell you on other things. Have you seen them “drop your tunnel like a hot potato”?

        Now obviously if their network is at capacity they would prioritise paying customers, but I’ve never heard of there being an issue with DDoS protection for free users. But I have heard stories of sites enabling Cloudflare while being DDoSed and it resolving the problem.

        • lemmyvore@feddit.nl
          link
          fedilink
          English
          arrow-up
          3
          ·
          edit-2
          10 months ago

          Any stories you’ve heard about websites enabling CF to survive DDoS were not on the free tier, guaranteed.

          Please re-read the description for the free tier. Here’s what “DDoS protection” means on free tier:

          Customers are not charged for attack traffic ever, period. There’s no penalty for spikes due to attack traffic, requiring no chargeback by the customer.

          Will they use some of their capacity to minimize the DDoS effects for their infrastructure? Sure, I mean they have to whether they like or not, since the DNS points at their servers. But will they keep the website going for Joe Freeloader? Don’t count on that. The terms are carefully worded to avoid promising anything of the sort.

          • Dave@lemmy.nz
            link
            fedilink
            English
            arrow-up
            7
            ·
            10 months ago

            They also say “Cloudflare DDoS protection secures websites and applications while ensuring the performance of legitimate traffic is not compromised.”, with a tick to indicate this is included in the Free tier.

            You are honestly the first person I’ve heard complain about Cloudflare failing to protect against DDoS attacks. However, I have no doubt that not having Cloudflare, I would fare no better. So still seems worthwhile to me.

    • keyez@lemmy.world
      link
      fedilink
      English
      arrow-up
      3
      ·
      10 months ago

      I have a cloudflare tunnel setup for 1 service in my homelab and have it connecting to my reverse proxy so the data between cloudflare and my backend is encrypted separately. I get no malformed requests and no issues from cloudflare, even remote public IP data in the headers.

      Everyone mentions this as an issue, and I am sure doing the default of pointing cloudflared at a http local service but it’s not the ONLY option.

      • Dave@lemmy.nz
        link
        fedilink
        English
        arrow-up
        3
        ·
        10 months ago

        I’m not quite sure I get what you’re getting at. If you’re using Cloudflare (for more than just a nameserver), then the client’s browser is connecting to Cloudflare via a Cloudflare SSL certificate. Any password (or other data) submitted will be readable by Cloudflare because the encryption is only between the browser and Cloudflare. They then connect to your reverse proxy, which might have SSL or it might be unencrypted. That’s a second jump done by re-encrypting the data.

        How does the reverse proxy help, when the browser is connecting to Cloudflare not to the reverse proxy?

        • keyez@lemmy.world
          link
          fedilink
          English
          arrow-up
          2
          ·
          10 months ago

          Fair, I was more thinking from the server side not the client side where cloudflare certs are the ones seen first.

    • JonnyJaap@lemmy.world
      link
      fedilink
      English
      arrow-up
      2
      ·
      10 months ago

      The first point is only when you use the tunnel function, right ?

      Because I noticed, if use the tunnel function (hiding your private ip) the sites gets an Cloudflare certificate, but if just using it as DNS (without tunnel) the page has my certificate.

      • Dave@lemmy.nz
        link
        fedilink
        English
        arrow-up
        3
        ·
        10 months ago

        If you use DNS with proxy it still applies, you should get a Cloudflare certificate then. But yes, if you use Cloudflare as DNS only, then it should be direct. I believe you get none of the protection or benefits doing this, you’re just using them as a name server.

        The Cloudflare benefits of bot detection, image caching, and other features all rely on the proxy setting.

        Also if proxying is enabled, your server IP is hidden which helps stop people knowing how to attack your server (e.g. they won’t have an IP address to attempt to SSH into it). You don’t get this protection in DNS only mode either.

        Basically if you’re using DNS only, it’s no different to using the name server from your domain registrar as far as I can tell.