Code Monkey home page Code Monkey logo

unbound-docker's Introduction

Logo

Alpine Linux Based Unbound Hyperlocal & DNSSEC Validating DNS Server Multiarch Docker Image

Maintainer

Statistics

Docker Logo


Docker Image Version Docker Image Size Docker Pulls Docker Stars

Github Logo


Maintenance GitHub version Release date Latest commit main branch License

Commit Activity Forks Stars Issues Pull Requests

Build Multiarch Unbound Docker Image Build Multiarch OpenSSL BuildEnv Docker Image Build Multiarch Libevent BuildEnv Docker Image

Available Docker Tags

Tags

Changes

You can view the changelogs in the Releases section.

Table of Contents

What is Unbound

Unbound is a validating, recursive, caching DNS resolver.

It is designed to be fast and lean and incorporates modern features based on open standards. Late 2019, Unbound has been rigorously audited, which means that the code base is more resilient than ever.

Source: unbound.net

About this Image

This container image is based on Alpine Linux with focus on security, performance and a small image size. The unbound process runs in the context of a non-root user, is sealed with chroot and makes use of unprivileged ports (5335 tcp/udp).

Unbound is configured as an DNSSEC validating DNS resolver, which directly queries DNS root servers utilizing zone transfers holding a local copy of the root zone (see IETF RFC 8806) to build a "hyperlocal" setup as an upstream DNS server in combination with Pi-hole for adblocking in mind, but works also as a standalone server. However, even though the image is intended to run a "hyperlocal" setup, it does not necessarily mean that it has to be used that way. You are absolutely free to edit the unbound.conf file according to your own needs and requirements, especially if you'd rather like to use an upstream DNS server which provides DoT or DoH features instead of using the "hyperlocal" feature.

To provide always the latest versions, the following software components are self compiled in the build process using separated workflows and are not just installed:

The image is completely built online via a GitHub Action and not locally on my systems. All components as well as the Internic files (root.hints and root.zone) are verified with their corresponding PGP keys and signature files if available to guarantee maximum security and trust.

Unbound is compiled with hardening security features such as PIE (Position Independent Executables), which randomizes the application's position in memory which makes attacks more difficult and RELRO (Relocation Read-Only) which also can mitigate exploitations.

Features
Feature Supported
chroot โœ…
Unprivileged user โœ…
DNSSEC โœ…
DNSCrypt โœ…
DNSTap โŒ
DNS64 โœ…
Draft-0x20 (caps-for-id: yes) โœ…
DNS over HTTPS โœ…
DNS over TLS โœ…
QName Minimization โœ…
Auth. zones with local copy of root zone โœ…
Aggressive use of DNSSEC-Validated Cache โœ…
Response Policy Zones โœ…
EDNS Client Subnet โŒ

I hope you enjoy the image.

Installation

Current multiarch-builds of the image are available on Docker Hub and is the recommended source of installation on any Linux-based 386, arm, arm64 or amd64 platform.

How to use this Image

You should adapt the /usr/local/unbound/unbound.conf file and my example docker-compose.yaml file to your needs. The compose file also deploys Pi-hole for blocking ads and to prevent tracking as well as Watchtower for keeping your images up to date.

To provide a better structuring of the unbound.conf file, directories for optionally storing zone and other configuration files as well as for your certificates and the unbound.log file have been created and can be mounted as volumes:

The config files in the conf.d and zones.d folders must be named with the suffix .conf to prevent issues with specific host configurations.

The splitted configuration files located in unbound/examples/usr/local/unbound are only meant to give you an impression on how to separating and structuring the configs. Please mind that those files are examples which also needs to be edited and even updated (root.key, root.zone, root.hints in the iana.d folder) to make them work for your environment if you intend to use them. It might be necessary to fix permissions and ownership of the files put in the persistent volumes if unbound refuses to start. You can access the running image by executing the following command in your shell: sudo docker exec -ti madnuttah-unbound /bin/sh. If you have assigned a different name for the image than madnuttah-unbound, this must be adjusted of course.

Other than that, splitting ain't really necessary as your standard unbound.conf will perfectly do the job.

Folder Structure

Filesystem
/usr/local/
โ”œโ”€โ”€ libevent/
โ”‚   โ””โ”€โ”€ ...
โ”œโ”€โ”€ openssl/
โ”‚   โ””โ”€โ”€ ... 
โ”œโ”€โ”€ sbin/
โ”‚   โ”œโ”€โ”€ unbound.sh 
โ”‚   โ””โ”€โ”€ ...
โ”œโ”€โ”€ unbound/
โ”‚   โ”œโ”€โ”€ certs.d/
โ”‚   โ”‚   โ””โ”€โ”€ ...
โ”‚   โ”œโ”€โ”€ conf.d/
โ”‚   โ”‚   โ””โ”€โ”€ *.conf
โ”‚   โ”œโ”€โ”€ iana.d/
โ”‚   โ”‚   โ”œโ”€โ”€ root.hints
โ”‚   โ”‚   โ”œโ”€โ”€ root.key
โ”‚   โ”‚   โ””โ”€โ”€ root.zone
โ”‚   โ”œโ”€โ”€ log.d/
โ”‚   โ”‚   โ””โ”€โ”€ unbound.log
โ”‚   โ”œโ”€โ”€ unbound.d/
โ”‚   โ”‚   โ”œโ”€โ”€ lib/
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ libunbound.*
โ”‚   โ”‚   โ”œโ”€โ”€ sbin/
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ unbound
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ unbound-anchor
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ unbound-checkconf
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ unbound-control
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ unbound-control-setup
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ unbound-host
โ”‚   โ”‚   โ”œโ”€โ”€ null
โ”‚   โ”‚   โ”œโ”€โ”€ random
โ”‚   โ”‚   โ”œโ”€โ”€ urandom
โ”‚   โ”‚   โ””โ”€โ”€ unbound.pid
โ”‚   โ”œโ”€โ”€ zones.d/
โ”‚   โ”‚   โ””โ”€โ”€ *.conf
โ”‚   โ””โ”€โ”€ unbound.conf 
โ”œโ”€โ”€ ...
...

Networking

Port Description
5335 Listening Port (TCP/UDP)

If you want to use this image as a standalone DNS resolver without Pi-hole, the given ports must be changed to 53 (TCP/UDP) in your unbound.conf and docker-compose.yaml.

Standard Usage

The best way to get started is using docker-compose. I have provided a combined Pi-hole/Unbound/Watchtower docker-compose.yaml sample which I'm using in slightly modified form that makes use of a MACVLAN network which must be adapted to your network environment and to suit your needs for development or production use. Especially all entries in angle brackets (<>) needs your very attention!

I prefer using a MACVLAN network configuration instead of a bridged or rather unsafe host network, but other network configurations will run as well.

Anyway, you can also spin up the container with the following command:

docker run --name madnuttah-unbound -d \
-p 5335:5335/udp \
-p 5335:5335/tcp \
--restart=unless-stopped \
madnuttah/unbound:latest

Documentation and Feedback

Documentation

In-depth documentation for NLnetLabs Unbound is available on the Unbound project's website and here goes a direct link to the documentation of the default unbound.conf file.

There's also a dedicated Unbound documentation website which can be accessed using this link.

Feedback

Feel free to contact me through a GitHub Issue if you have any questions, requests for new features or encounter problems with the image.

Contributing

If you like to contribute to this repository, take a look at the Contributing Guidelines.

Acknowledgements

Licenses

License

Unless otherwise specified, all code is released under the MIT license. See the LICENSE for details.

Licenses for other components

Legal

Please note that this is a work of a private contributor and I'm neither affiliated with NLnetLabs or Pi-hole nor is NLnetLabs or Pi-hole involved in the development of the image. The marks and properties, 'Unbound' and 'Pi-hole' are properties of NLnetLabs and Pi-hole respectively. All rights in the source codes, including logos relating to said marks and properties belong to their respective owners.

Social

Stay up-to-date with the development by following my social media accounts:

Follow me on Mastodon
Follow me on Twitter

unbound-docker's People

Contributors

madnuttah avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.