Skip to content
dancaescuPublic

About

Cloudflare hot-swap DNS server based on MyDNS

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

82 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MyDNS - SQL-based DNS server

This is the MyDNS package.  MyDNS is a simple, non-recursive Internet
name daemon which serves records directly from an SQL database.  It
currently works with either MySQL or PostgreSQL.

This fork continues that lineage and adds the following modernisations:
(Maintained by Dan Caescu <dan.caescu@multitel.net> – 18-Nov-2025)

  * **Cloudflare mirror support** – the daemon can now read zones and records
    from the `cloudflare_*` tables alongside the classic `soa/rr`
    tables. When both are configured it merges the datasets, so this fork
    can act as a hot standby for Cloudflare-hosted domains while still
    serving any legacy zones that live in the MyDNS schema. New config
    keys (`cloudflare-soa-table`, `cloudflare-rr-table`,
    `cloudflare-default-ns`, `cloudflare-default-mbox`) control this
    behaviour.
  * **Texinfo 6.8 compatibility** – building the documentation no longer
    fails on modern distros; we ship a patched GNU FDL appendix so
    `makeinfo` completes without workarounds.
  * **Tested MySQL build/install flow** – bootstrap/configure/build steps
    were refreshed for current Debian/Ubuntu systems, including sample
    configs under `/etc/mydns/` and init/systemd units in `debian/`.
  * **Cloudflare automation** – credentials for API-driven tooling now
    live in `cloudflare.ini` (ignored from commits unless intentionally
    populated); upcoming scripts will reuse this file.
  * **IPv6-aware tools** – the AXFR importer and utilities now use
    modern socket APIs so they can reach IPv4 or IPv6 masters.  Example:
    `mydnsimport -o -a [::1]+5400 example.com` runs an IPv6 transfer for
    a locally reachable test server.
  * **Multi-host MySQL failover** – `db-host2`..`db-host4` plus
    `db-host-policy` let you describe up to four SQL servers and choose
    between sequential, round-robin, or least-used selection. The daemon
    and utilities automatically fall back to the next host when a
    connection fails (currently up to four hosts per config).
  * **LOC (RFC 1876) records** – textual LOC data in the `rr` table is
    now parsed and emitted in the correct binary format, so geographic
    coordinates work just like in BIND zone files.
  * **NRPE monitoring helper** – `contrib/check_mydns.py` checks database
    connectivity, process health, and DNS responses for Nagios/Icinga.

## Version 1.3.0 - Enterprise DNS Features (28-Nov-2025)

MyDNS 1.3.0 represents a major milestone, transforming MyDNS into an enterprise-grade
authoritative DNS server with modern protocol support and advanced security features.

### Security and Authentication

  * **TSIG Authentication (RFC 2845)** – Complete cryptographic transaction
    authentication for DNS messages. Supports HMAC-MD5, SHA1, SHA224, SHA256,
    SHA384, and SHA512 algorithms. Includes replay attack protection via
    time-based fudge factors and request-response MAC chaining. Database-backed
    key storage with zone-specific and operation-specific permissions.
    Full audit logging of authenticated operations.

  * **DNS UPDATE Protocol (RFC 2136)** – Dynamic DNS updates with atomic
    transaction support. Implements prerequisite checking (YXDOMAIN, NXDOMAIN,
    YXRRSET, NXRRSET) and all update operations (ADD, DELETE, DELETE_ALL).
    Access control via TSIG keys or IP-based ACLs with CIDR notation.
    Complete audit trail of all update operations.

  * **Extended ACL System** – Multi-user zone ACLs for fine-grained access
    control. Users can define zone-specific and global ACLs via web UI.
    Priority-based rule evaluation with "first match wins" policy. Supports
    CIDR notation for network ranges. Real-time statistics tracking.

### Zone Transfer and Synchronization

  * **IXFR Protocol (RFC 1995)** – Incremental zone transfer with automatic
    serial number-based change tracking. Database triggers capture ADD, DELETE,
    and MODIFY operations automatically. Falls back to AXFR when IXFR is
    unavailable or inefficient. Reduces bandwidth usage by 90-99% for large
    zones with small changes. Per-zone retention policies for change history.

  * **NOTIFY Protocol (RFC 1996)** – Push notification system for immediate
    slave synchronization. UDP listener on configurable port (default 5300)
    with non-blocking I/O. Master IP validation and TSIG-authenticated NOTIFY
    support. Automatic AXFR/IXFR trigger on validated notifications. Reduces
    zone propagation time from minutes to under 1 second.

  * **In-Memory Zone Storage (Memzone)** – Shared memory-based zone storage
    enabling 100% MySQL-free slave server operation. Uses mmap for ultra-fast
    query responses (10,000x faster than database lookups). Hash table-based
    O(1) lookups with RW-locks for concurrent access. Full GeoIP and ACL
    functionality from memory. Integration with AXFR transfer system.
    Configuration via zone-masters.conf file.

### Modern DNS Features

  * **DNSSEC Support (RFC 4033/4034/4035)** – Comprehensive DNSSEC implementation
    with DNSKEY, DS, RRSIG, NSEC, NSEC3, and NSEC3PARAM record types. NSEC3
    hash computation with configurable iterations and salt. Database-backed key
    storage and management. Automated background signing operations via queue.
    Key generation and rollover procedures. Zone-specific DNSSEC parameters.

  * **DNS over HTTPS (RFC 8484)** – Complete DoH server with TLS 1.2+ support.
    Implements both GET (base64url) and POST (binary) HTTP methods. Runs in
    separate pthread to avoid blocking standard DNS operations. IPv6 dual-stack
    on configurable port (default 8443, supports 443 with privileges). Per-server
    configuration for port, path, and TLS certificates. Request/response
    statistics tracking.

  * **DNS Caching / Recursive Resolver** – Intelligent caching system with
    configurable cache size (default 384MB) and TTL range (120-7200 seconds).
    Multiple upstream DNS servers with failover (Cloudflare, Google, Quad9).
    Three-tier configuration hierarchy: database → mydns.conf → hardcoded
    defaults. Reduces upstream query load by 80-95%. Optimized for both master
    (with MySQL) and slave (without MySQL) deployments.

  * **Modern DNS Record Types** – Support for 17 additional DNS record types:
    CAA (RFC 8659), CERT (RFC 4398), HTTPS (RFC 9460), LOC (RFC 1876),
    OPENPGPKEY (RFC 7929), SMIMEA (RFC 8162), SSHFP (RFC 4255), SVCB (RFC 9460),
    TLSA (RFC 6698), URI (RFC 7553), DNAME (RFC 6672), and more. Total of 28
    supported record types.

### Management and Deployment

  * **Modern Web UI** – React-based DNS Manager with Node.js backend API.
    Multi-user support with role-based access control. Users can add their own
    Cloudflare API credentials for zone syncing. Zone-specific ACLs for
    firewall/access control. Real-time monitoring and statistics. Mobile-friendly
    interface built with Radix UI components.

  * **Multi-User Cloudflare Integration** – Users can add personal Cloudflare
    credentials via web UI for syncing their own zones. AES-256-GCM encryption
    for API keys at rest. Per-credential sync status tracking. Python sync script
    reads from both global config and database. Automatic zone synchronization
    via cron.

  * **Ansible Automation** – Complete Ansible playbooks for automated deployment.
    Python generator script (`generate_ansible.py`) creates playbooks from
    contrib/ directory automatically. Playbooks for: MyDNS server, Web UI,
    GeoIP sensors, Cloudflare sync, database schemas. Tag-based execution for
    selective deployment.

  * **Automatic SOA Serial Management** – Date-based SOA serial auto-increment
    in YYYYMMDDNN format. MySQL triggers handle serial updates automatically
    on record changes. Supports up to 99 zone changes per day. Skips
    auto-increment for slave zones. Eliminates manual serial management errors.

### Performance and Architecture

  * **10,000x Faster Lookups** – Memzone provides 100ns response time vs 1ms
    for database queries. Hash table-based memory structure with concurrent
    access via RW-locks.

  * **90-99% Bandwidth Reduction** – IXFR transfers only zone changes instead
    of entire zones. Dramatically reduces network usage for large zones.

  * **Sub-Second Zone Propagation** – NOTIFY protocol reduces slave update
    time from minutes to under 1 second. Non-blocking UDP listener with
    select() integration.

  * **80-95% Query Load Reduction** – DNS cache reduces upstream recursive
    queries by caching common lookups locally. Configurable TTL and cache size.

  * **Database-Free Operation** – Memzone enables slave servers to run without
    MySQL. Zone data loaded from AXFR transfers into shared memory. Perfect for
    distributed slave deployments.

### Documentation and Schema

Over 8,500 lines of comprehensive documentation covering:
  - Implementation guides for TSIG, IXFR, NOTIFY, DNSSEC, DoH
  - Deployment guides for master/slave setups
  - Configuration hierarchy documentation
  - Testing procedures and troubleshooting
  - Multi-user features and web UI integration
  - Ansible automation and monitoring

9 database schema files:
  - tsig-schema.sql - TSIG authentication
  - dnsupdate-schema.sql - DNS UPDATE protocol
  - axfr-ixfr-schema.sql - IXFR incremental transfers
  - dnssec-schema.sql - DNSSEC signing
  - doh-schema.sql - DNS over HTTPS
  - dns-cache-schema.sql - DNS caching configuration
  - user-cloudflare-acl-schema.sql - Multi-user Cloudflare & ACLs
  - axfr-slave-schema.sql - MySQL-free slave support
  - soa-serial-trigger.sql - Automatic serial management

You can still find the original package at:

     http://mydns.bboy.net/

This repository (https://github.com/dancaescu/dns) tracks the
above additions and any further Multitel-specific improvements.

MySQL has a homepage on the WWW at the following URL:

     http://www.mysql.com/

PostgreSQL has a homepage on the WWW at the following URL:

     http://www.postgresql.org/

Code contributions and input are appreciated.  See the TODO file for a
list of things that need to be done.

MyDNS allows internationalization via GNU gettext.  Translations
are encouraged and gladly accepted.

If you are looking for the web interface for MyDNS, it's included in
the MyDNS distribution as contrib/admin.php.  See contrib/README for
installation instructions.


## Project History

- **12-May-2004 – 18-Jan-2006**
  Don Moore <bboy@bboy.net>
  Original author and maintainer of MyDNS through version 1.1.0

- **23-Jan-2009 – 26-Mar-2009**
  Howard Wilkinson <howard@cohtech.com>
  Maintained MyDNS-NG versions 1.2.8.18 through 1.2.8.27

- **18-Nov-2025 – present**
  Dan Caescu <dan.caescu@multitel.net>
  Current maintainer from version 1.2.8.30 onwards. Released version 1.3.0
  on 28-Nov-2025 with TSIG, DNS UPDATE, IXFR, NOTIFY, DNSSEC, DoH, DNS
  caching, memzone, multi-user features, and modern web UI

About

Cloudflare hot-swap DNS server based on MyDNS

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages