Terrastack Director is a lightweight, high-performance DNS forwarder and proxy built for modern cloud environments.
Developed in Rust for maximum performance and memory safety, it securely forwards DNS queries to upstream resolvers with low latency and high reliability.
- DNS Forwarding – Efficiently proxy DNS queries to any upstream resolver.
- Caching – Reduce latency and upstream load with built-in query caching.
- Memory Safe – Fully implemented in Rust, eliminating common security vulnerabilities.
- Lightweight & Cloud-Native – Runs anywhere — from bare metal to containers.
[ Client ] → [ Terrastack Director ] → [ Upstream Resolver(s) ]
The Director acts as a secure DNS server for clients, receiving DNS queries (potentially over TLS) from local clients or internal applications, and then forwarding them to your chosen upstream DNS servers.
You can install Terrastack Director either from source using Cargo or by using Docker.
Ensure you have Rust and Cargo installed. If not, you can install them via rustup: https://rustup.rs/
- Clone the repository:
git clone https://github.com/terrastack-cloud/director.git cd director - Build the project:
The executable will be located at
cargo build --release
target/release/director. - Install (optional):
This will install
cargo install --path .directorto your Cargo bin directory, making it available in your PATH.
Terrastack Director can be easily deployed using Docker. The official Docker image is available on ghcr.io/terrastack-cloud/director.
- Pull the Docker image:
docker pull ghcr.io/terrastack-cloud/director:latest
- Run the Docker container:
This command runs the director in detached mode, mapping the default ports. You can customize port mappings and mount a custom
docker run -d -p 8080:8080/tcp -p 8081:8081/udp -p 8082:8082/tcp -p 8083:8083/tcp --name director ghcr.io/terrastack-cloud/director:latest
config.ymlif needed.
Terrastack Director can be configured using a config.yml (or config.toml) file or environment variables.
You can generate a default configuration file using the generate command:
# Generate default YAML configuration
director generate --format yaml > config.yml
# Generate default TOML configuration
director generate --format toml > config.toml
# Generate default environment variables
director generate --format env > .envHere's an example config.yml with default values:
listen:
http: 0.0.0.0:8080
udp: 0.0.0.0:8081
tcp: 0.0.0.0:8082
tls: 0.0.0.0:8083
upstreams:
- 1.1.1.1:53
- 8.8.8.8:53
cache:
ttl: 300
enabled: trueTerrastack Director supports both DNS over TLS (DoT) and DNS over HTTPS (DoH).
DNS over TLS (DoT):
To enable DoT, configure the tls_cert_config section in your config.yml to specify the paths to your TLS certificate and private key.
tls_cert_config:
cert_path: /path/to/your/cert.pem
key_path: /path/to/your/key.pemDNS over HTTPS (DoH):
For DoH, you can specify the https_endpoint in your config.yml. This defines the URL path where DoH queries will be served. The default value is /dns-query. The TLS certificate configured in tls_cert_config will also be used for the HTTPS server.
https_endpoint: /dns-queryAll configuration options can also be set via environment variables, prefixed with DIRECTOR_. For example:
DIRECTOR_LISTEN_HTTP=0.0.0.0:8080DIRECTOR_UPSTREAMS=1.1.1.1:53,8.8.8.8:53DIRECTOR_CACHE_ENABLED=trueDIRECTOR_CACHE_TTL=300DIRECTOR_TLS_CERT_CONFIG_CERT_PATH=/path/to/your/cert.pemDIRECTOR_TLS_CERT_CONFIG_KEY_PATH=/path/to/your/key.pemDIRECTOR_HTTPS_ENDPOINT=/dns-query
Once installed and configured, you can run Terrastack Director using the run command.
To start the director with a specific configuration file:
director run --config-file config.ymlIf no --config-file is specified, the director will look for config.yml, config.yaml, or config.toml in the current directory, and then apply environment variables.
For more complex Docker deployments, you can use docker-compose.
-
Create a
configdirectory and generate yourconfig.yml:mkdir -p config director generate --format yaml > config/config.yml # Edit config/config.yml as needed, especially for TLS paths if used
-
Create a
docker-compose.ymlfile:services: director: image: ghcr.io/terrastack-cloud/director:latest container_name: director volumes: - ./config:/app/config # If using TLS, mount your cert and key files # - ./certs:/app/certs ports: - "8080:8080/tcp" # HTTP - "8081:8081/udp" # UDP - "8082:8082/tcp" # TCP - "8083:8083/tcp" # TLS command: run --config-file /app/config/config.yml restart: unless-stopped
- Note on TLS: If you are using TLS, ensure your
cert_pathandkey_pathinconfig/config.ymlpoint to the locations inside the container (e.g.,/app/certs/cert.pem). You would also need to uncomment and adjust thevolumesentry forcerts.
- Note on TLS: If you are using TLS, ensure your
-
Run Docker Compose:
docker-compose up -d
director --help
director run --help
director generate --help- Website: https://terrastack.cloud
- Issues & feedback: GitHub Issues