Feature request: enforce Private DNS (DNS-over-TLS host) per configuration

Aperta
#191 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 2 giorni

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
38/100
Tipo di issue
Funzionalità
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
android, java, kotlin, react, typescript

Direzione di ricerca

Start by reading the existing configuration revision and policy flows for factory reset and Safe Mode, then trace how config.apply outcomes reach the console and device telemetry. The issue calls for changes across server, Android agent, and console, including validation and API 29+ behavior. Done means the selected mode and lock are applied and reported, unsupported or failed outcomes are visible, and unmanaged mode restores the default.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

enhancement
Area

Server / REST API

The problem

Problem

We run MDMesh in a boarding school dormitory (~50 student phones, QR-enrolled as Device Owner, kiosk mode with an allowlist of study and communication apps). Kiosk keeps students inside the allowed apps, but several allowed apps open links in an in-app browser (Chrome Custom Tabs or a WebView): Gemini, ChatGPT, Telegram and others. A Custom Tab opens inside the calling app's task, so LockTask doesn't stop it, and students can reach any website from there.

The app itself is legitimate and needed (AI assistants for homework, messengers to reach parents). What we need to restrict is the open web behind it, and kiosk can't do that.

The practical fix is DNS filtering (NextDNS, AdGuard DNS, Cloudflare Family, a self-hosted resolver…). DNS filtering covers every app, in-app browsers included. Today we set Private DNS by hand on each phone, which:

  • doesn't scale: every new or re-enrolled phone needs a manual step, and a missed phone is unfiltered;
  • isn't enforced: if a student ever reaches Settings, they can switch Private DNS off;
  • can't be audited: the console doesn't show which phones actually have it.

A router-level DNS only covers the dorm Wi-Fi, not mobile data.

I checked v0.4.0: the agent has no Private DNS policy yet.

Why it belongs in MDMesh

Android provides this for Device Owners directly (API 29+, Android 10). No VPN app or root is needed:

  • DevicePolicyManager.setGlobalPrivateDnsModeSpecifiedHost(admin, host) forces DNS-over-TLS to a given host for the whole device, on Wi-Fi and mobile data.
  • DevicePolicyManager.setGlobalPrivateDnsModeOpportunistic(admin) restores the Android default.
  • UserManager.DISALLOW_CONFIG_PRIVATE_DNS stops the user from changing it.

It fits the existing desired-state model the same way Block factory reset and Safe Mode do. I'd expect schools, kiosks and frontline fleets to want it as well.

Proposed solution

Proposed solution

Configuration (e.g. under Configuration → Network, next to the new connectivity mode):

  • Private DNS: Not managed (default) / Automatic (opportunistic) / Host
  • Private DNS host: text field, shown when Host is chosen, e.g. abc123.dns.nextdns.io
  • Lock Private DNS setting: on/off (DISALLOW_CONFIG_PRIVATE_DNS)

Server

  • New configuration columns (e.g. privateDnsMode, privateDnsHost, lockPrivateDns), included in the configuration revision.
  • Validate the host on save: a hostname only, no scheme, port or path.

Agent (new policy module, like the factory-reset and Safe Mode ones)

  • Host: call setGlobalPrivateDnsModeSpecifiedHost. Report the result in the config.apply outcomes:
    • PRIVATE_DNS_SET_NO_ERROR → applied
    • PRIVATE_DNS_SET_ERROR_HOST_NOT_SERVING → failed, with a reason, so the console shows it, and retry at the next check-in. The host can fail its check while the phone is offline.
    • API < 29 → unsupported
  • Automatic: call setGlobalPrivateDnsModeOpportunistic.
  • Not managed: leave the device as it is. If the agent applied a mode before, restore Automatic once and clear the lock, the same way the Safe Mode block is lifted when nothing asks for it.
  • Apply the lock restriction independently of the mode.
  • Report the current mode and host (getGlobalPrivateDnsMode / getGlobalPrivateDnsHost) in telemetry, so the device page can show it.

Console

  • Show the Private DNS mode and host on the device page.
  • Flag devices where it's failed or unsupported in Needs attention.

Notes

  • Private DNS doesn't stop an app that does its own DNS-over-HTTPS. Admins should also block bypass methods on the resolver side (NextDNS has a "Block bypass methods" option). A sentence in the docs would help.
  • Older agents should ignore the new keys, as with other additive protocol changes.

Happy to test a build on our fleet (Samsung, Redmi/Xiaomi, Honor, TECNO; Android 12–16) before release.

Alternatives considered

No response

Before submitting
  • I searched existing issues and discussions for the same idea.
Lingua principale
Java
Stelle
44
Fork
25
Merge medio
1g 13h
PR unite (30g)
80

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di MDMesh-app/MDMesh

Tutte le issue di MDMesh-app/MDMesh

Issue simili

Altre issue su Java

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.