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

Abierto
#191 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 2 días

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
5/5
Tiempo estimado
Más de una semana
Aptitud para principiantes
38/100
Tipo de issue
Nueva funcionalidad
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
android, java, kotlin, react, typescript

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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.
Lenguaje dominante
Java
Estrellas
44
Forks
25
Merge medio
1 d 13 h
PR fusionados (30 d)
80

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de MDMesh-app/MDMesh

Todos los issues de MDMesh-app/MDMesh

Issues similares

Más issues de Java

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.