I’m asking for Android specifically, but I’m curious what else is out there.

For example, some apps work without internet but may use it if it’s available. I might want to block that without having to turn off wifi, force stopping it, and wiping the cache/data.

Similarly, maybe I only want to use the app over a VPN and want to prevent accidentally opening it without first turning the VPN on.

  • jet@hackertalks.com
    link
    fedilink
    English
    arrow-up
    16
    ·
    edit-2
    5 months ago

    On Android, there’s a VPN in f Droid that acts as a firewall, so you can say this app has internet this app doesn’t have internet

    To ensure that this program only works with a VPN, you can set up a work profile require always on VPN in the Android settings, then this app running in the work profile must use the VPN no matter what

    GrapheneOS has the internet kill switch built in for any app anywhere.

    Depending on your threat model, you need to be very careful, just because an app doesn’t have direct internet access, doesn’t mean it can’t talk to Google Play and pass messages that way. In the Android model, apps can talk to each other consensually, and you can’t stop that

    For desktop computers, we’d be talking about virtual machines and network names bases to enforce your policy rules. Qubes is the gold standard here.

        • Cheradenine@sh.itjust.works
          link
          fedilink
          English
          arrow-up
          6
          ·
          5 months ago

          With RethinkDNS you can block an app completely, allow the app (WiFi, cellular, or both) and block certain domains. You can also use DNS block lists, force or exclude apps from either VPN or Orbot. Block apps not in use, block when DNS is bypassed. A bunch more stuff.

        • Desyn0xox@lemmy.ml
          link
          fedilink
          English
          arrow-up
          2
          ·
          5 months ago

          Been using it for a while, and am pretty happy with it. It has some nice features, and works pretty well for me, so I’d recommend giving it a try. I believe it, unfortunately, doesn’t support OVPN though. But as I understand Wireguard are to be preferred over OVPN anyways.

      • jet@hackertalks.com
        link
        fedilink
        English
        arrow-up
        3
        ·
        5 months ago

        I’m not sure. That might be it.

        I use grapheneos so I can just turn off network access in the app info panel and still use my VPN.

  • Ton the Supermassive@lemm.ee
    link
    fedilink
    English
    arrow-up
    12
    ·
    5 months ago

    Tracker Control - it basically checks for trackers that the apps use, and you can block internet access for individual apps. It’s also on f-droid.

        • peregus@lemmy.world
          link
          fedilink
          English
          arrow-up
          1
          ·
          5 months ago

          Oh, I see, , “normal” tracker. I’ve asked because I thought it could be something different since the OP was asking to block Internet and not the tracker. I’ve had a look at the app and it doesn’t seems to me that it can block Internet access to other apps.

            • peregus@lemmy.world
              link
              fedilink
              English
              arrow-up
              1
              ·
              5 months ago

              From what I’ve seen, it can block the Internet for all the OS, not for single apps. But I’m not using that app, so I may be wrong.

              • Ton the Supermassive@lemm.ee
                link
                fedilink
                English
                arrow-up
                2
                ·
                5 months ago

                In the picture its blocking the internet for a single app - that app being “blinkist”. You mean you want to block Google Play only?

                • peregus@lemmy.world
                  link
                  fedilink
                  English
                  arrow-up
                  1
                  ·
                  5 months ago

                  Oh, I see! I missed that. Is it possible to block the Internet to Google Play Services?

  • englislanguage@lemmy.sdf.org
    link
    fedilink
    English
    arrow-up
    10
    ·
    5 months ago

    Netguard is a FOSS Android app which kinda works like a firewall. You can allow/block network access on a per-application basis. You can limit access e.g. on WiFi or on mobile etc. It also supports blocklists, supplementing your ad blocker.

    To the Android OS, Netguard acts as if it were a VPN.

    Limitations:

    • if you want to filter Android system services, you will break things. You will need to spend some time to do it right.
    • Chaining it to another VPN is only possible via SOCKS proxy
    • if you want to route some app’s traffic via VPN and others not, I think that is not possible. You could, however, manually turn off an app’s internet connection before disconnecting the VPN, if that is not too error-prone for you.

    The app is very stable, I have been using it for about 5 years without problems. For most use cases it is fire-and-forget, i.e. I rarely open the app any more.

    • peregus@lemmy.world
      link
      fedilink
      English
      arrow-up
      3
      ·
      5 months ago

      I use it too and I like it, but OP needs to keep in mind that the apps that rely on Google Play Services will still have “Internet access” directly with it and Netguard can’t do anything about it. WhatsApp for example: you can block Internet access to the apps, but it will still be able to send/receive messages.

      • 𝘋𝘪𝘳𝘬@lemmy.ml
        link
        fedilink
        English
        arrow-up
        1
        ·
        5 months ago

        Came here to say NetGuard, too.

        I did the allowlist approach and first blocked all and everything and then fiddled with the permissions and now have a good set of settings for stock Android. It’s doable within a few days while regularly using the devices and then allowing things as soon as you notice something does not work as expected.

  • TheDarkQuark@lemmy.world
    link
    fedilink
    English
    arrow-up
    10
    ·
    5 months ago

    There’s a built-in network toggle for applications (in their respective App Info / Permissions page) in GrapheneOS. So, if you’re on Graphene, it’s a piece of cake.

    Else, you might want to look into NetGuard (https://f-droid.org/packages/eu.faircode.netguard/), which offers app-wise internet blocking.

    As for the “using app over a VPN” thing, you can just turn on “Always-on VPN” and “Block connections without VPN” toggles in Settings / Network and Internet / VPN / .

  • retrieval4558@mander.xyz
    link
    fedilink
    English
    arrow-up
    5
    ·
    5 months ago

    To prevent it using Internet at all, you can turn off individual apps access to WiFi and mobile data easily

    To bind to a VPN, I use protonVPN, and I’m pretty sure the Android app has the split tunnelling feature to allow this as well. Not sure if that protects against leaks, but you could just have the VPN on all the time and use androids VPN settings to prevent any data usage outside the VPN

  • AnEilifintChorcra@sopuli.xyz
    link
    fedilink
    English
    arrow-up
    4
    ·
    5 months ago

    You should be able to kind of do both through android settings

    Settings -> Apps -> YourApp -> Mobile data usage -> Allow Network access and Mobile Data

    For VPN you’ll need to add a VPN and then Settings -> Network and Internet -> VPN -> YourVPN -> Always on VPN and Block Connections without VPN. This blocks all apps. There is 2 issues with this though, Blocking connections will block split tunneling connections set up through VPNs and also potentially this depending on the apps you’re using https://mullvad.net/en/blog/dns-traffic-can-leak-outside-the-vpn-tunnel-on-android

  • GregorGizeh@lemmy.zip
    link
    fedilink
    English
    arrow-up
    4
    ·
    5 months ago

    Aside from what the others said, my VPN (also on GOS) has a kill switch function, i set it to maximum and this way the phone simply can’t connect to the internet at all unless it uses the VPN.

  • Imprint9816@lemmy.dbzer0.com
    link
    fedilink
    English
    arrow-up
    2
    ·
    5 months ago

    For the majority of connections you can. Some connections bypass your VPN and there is nothing you can do about it. Its been reported to Google by multiple groups, including Mullvad but Google refuses to fix this.

  • apis@beehaw.org
    link
    fedilink
    English
    arrow-up
    1
    ·
    5 months ago

    You could try NextDNS. It won’t let you designate access per app, but you can create custom blocklists. Short-term logging makes it easy to see at a glance which domains are being requested, and it doesn’t take long to get it all set up so that your apps only contact stuff which is strictly necessary in your view. Also comes with many blocklists to choose from, as well as other useful settings.