$ show paulmillr/encrypted-dns
This repository is a toolchain for generating Apple Configuration Profiles (.mobileconfig) that configure DNS over HTTPS (DoH) and DNS over TLS (DoT) on iOS, iPadOS, and macOS devices. It maintains a curated registry of public encrypted DNS providers (e.g., AdGuard, Cloudflare, Quad9, CleanBrowsing) with metadata such as server addresses, filtering capabilities, and region. The build pipeline reads provider definitions from JSON files under src/, generates unsigned profiles in profiles/, optionally signs them with CMS digital signatures using a user-provided ECC certificate, and places signed versions in signed/. It also produces multi-language README files (English, Simplified Chinese, Traditional Chinese) with provider tables and installation links. The architecture is a set of TypeScript scripts executed via npm commands (build, sign, new, test). There is no runtime server or daemon; the output is static files intended for manual installation by end users. The interactive CLI (npm run new) guides users through creating new provider profiles with validation and optional signing. The codebase demonstrates solid engineering practices: deterministic UUIDs (v5) for stable profile identifiers, CMS signing with both Node.js crypto and OpenSSL parity tests, and a modular design that separates provider data, language templates, and build logic. While the repository is primarily a build tool, it also serves as a reference for encrypted DNS provider capabilities and a practical solution for deploying encrypted DNS on Apple devices. The signed profiles provide authenticity verification, and the multi-language support broadens accessibility. The code is well-structured and maintainable, though it relies on external certificates for signing and manual updates to provider data when server endpoints change.
The LLM identified 1 files worth highlighting for reuse:
Exports `signFile()` and `outPath()` functions that sign a .mobileconfig file with a CMS (Cryptographic Message Syntax) digital signature using a provided ECC private key and certificate. The function reads the plist XML, generates a detached CMS SignedData blob, and appends it to the file. This component is self-contained (imports only Node.js built-in modules: crypto, fs, path) and can be reused in any project that needs to sign Apple configuration profiles or similar plist files. It demonstrates non-obvious skill in handling ASN.1 encoding and CMS structure without external libraries.