Skip to content

ocpu/constellation-dns

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Constellation DNS

A DNS server implementation written in Rust with caching.

Overview

Constellation DNS is a DNS server built in Rust that provides basic DNS resolution with caching capabilities. It supports both UDP and TCP protocols and includes configuration management for zone files and server settings.

Features

  • Basic Protocol Support: Full DNS over UDP and TCP support
  • TLS/DNS-over-TLS Support - RFC 7858
  • DNSSEC Support - RFC 4035
  • Monitoring: Comprehensive metrics and logging
  • Configuration: Flexible TOML-based configuration system
  • Zone Management: Dynamic zone loading and management through BIND9 zone files and SQLite
  • Query Forwarding: Support for forwarding queries to other DNS servers RFC 1035 Section 7

Quick Start

Prerequisites

  • Linux system with systemd
  • Rust 1.70+ (for building from source)

Installation

  1. Build from source:
git clone https://github.com/your-org/constellation-dns.git
cd constellation-dns
cargo build --release
  1. Install system-wide:
sudo cp target/release/constellation-dns /usr/local/bin/
sudo chmod +x /usr/local/bin/constellation-dns
  1. Set up configuration:
sudo mkdir -p /etc/constellation-dns/zones
sudo mkdir -p /var/lib/constellation-dns
sudo cp config.toml.example /etc/constellation-dns/config.toml
  1. Install as systemd service:
sudo cp constellation-dns.service /etc/systemd/system/
sudo systemctl daemon-reload
sudo systemctl enable constellation-dns
sudo systemctl start constellation-dns

Basic Usage

Start the server with default configuration:

constellation-dns start

Start with custom configuration file:

constellation-dns start --config /path/to/config.toml

Configuration

Constellation DNS uses TOML for configuration. Copy config.toml.example to get started:

[server]
listen = "0.0.0.0"
port = 53
tcp_enabled = true
udp_enabled = true

[cache]
max_entries = 10000
default_ttl = 300

[dnssec]
enabled = true
validate_responses = true

[zone]
zone_directory = "/etc/constellation-dns/zones"
reload_interval = 300

[metrics]
enabled = true
bind_address = "127.0.0.1:9153"

Zone Management

Zone files should be placed in the configured zone directory (default: /etc/constellation-dns/zones/). The server supports standard DNS zone file format.

Example zone file (example.com.zone):

$ORIGIN example.com.
$TTL 3600

@   IN  SOA ns1.example.com. admin.example.com. (
        2023010101  ; Serial
        3600        ; Refresh
        1800        ; Retry
        1209600     ; Expire
        86400       ; Minimum TTL
    )

@   IN  NS  ns1.example.com.
@   IN  NS  ns2.example.com.

@   IN  A   192.0.2.1
www IN  A   192.0.2.2

Development

Building

# Debug build
cargo build

# Release build
cargo build --release

# Run tests
cargo test

# Check code formatting
cargo fmt --check

# Run linter
cargo clippy

Project Structure

src/
├── main.rs           # Application entry point
├── config/           # Configuration management
├── packet/           # DNS packet parsing and construction
├── proto/            # DNS protocol implementation
├── cache/            # Caching subsystem
├── zone/             # Zone file management
├── db/               # Database operations
└── types.rs          # Common type definitions

License

This project is licensed under the MIT License - see the LICENSE file for details.

About

A DNS server

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages