Skip to content

[systemd-resolved] Support for differing configuration per domain #18056

Closed

Description

@lclarkmichalek

Background

I'm deploying Consul. Consul runs a process on each host, exposing (among many other things) a DNS interface. This allows for service discovery via lookups under the consul domain.

For example, if I have a prometheus service configured, I might configure some other piece of software to find it via the prometheus.service.barrethouse.consul DNS name.

Configuring systemd-resolved

I would like random applications in the system to be able to resolve these DNS records, so I want to make them accessible via systemd-resolved. The consul documentation recommends configuring the consul agent as the sole entry in resolved's DNS= setting. It also recommends some iptables shenanigans, so I'm not going take its recommendations as gospel.

Ideally, I want to be able to direct queries under the consul domain to 127.0.0.1:8600, while having a different configuration for other domains. In particular, I'd like to enable DNSOverTLS for queries not to consul. However, it's not clear how to do this at the moment.

An idealized configuration

My dream is to be able to specify something like this

[Resolve]
DNS=127.0.0.1:8600
Domains=~consul
DNSOverTLS=no

[Resolve]
DNS=1.1.1.1#cloudflare-dns.com
FallbackDNS=1.1.1.1#cloudflare-dns.com
Domains=~.
DNSOverTLS=yes

That is, for the [Resolve] blocks to be essentially keyed on the Domains entry, and not merged. At the moment, I believe the above configuration file is equivalent to the following:

[Resolve]
DNS=127.0.0.1:8600 1.1.1.1#cloudflare-dns.com
FallbackDNS=1.1.1.1#cloudflare-dns.com
Domains=~consul ~.
DNSOverTLS=yes

This is based on the following, from the resolved.conf man page:

When multiple files specify the same option, for options which accept just a single value,
the entry in the file with the lexicographically latest name takes precedence. For options
which accept a list of values, entries are collected as they occur in files sorted lexicographically.

Request

  • Is my understanding of the behaviour of multiple [Resolve] blocks correct?
  • Is specifying different configurations for different domains possible in systemd-resolved today?
  • If not, is it within the scope of the systemd-resolved project?

Activity

  1. added
    RFE 🎁
    on Jan 4, 2021
  2. vlada-dudr commented on Jan 14, 2021

    @vlada-dudr

    If one wants to configure one such a service, then it might enough to enable DNS to loopback and route requests there with standard tooling systemd, already has

  3. ivan1986 commented on Sep 27, 2021

    @ivan1986

    Want same feture, but for opennic domain (geek, lib, pirate and other)

  4. aadnehovda commented on Oct 26, 2021

    @aadnehovda

    I'm not sure I really understand why resolved seems to be designed around per-interface routing domains in the first place. Why does the DNS server/domain have to be tied to a specific interface? Because of the integration with networkd?

  5. jonesmz commented on Jan 30, 2022

    @jonesmz

    This feature can also be useful for environments that use active directory. Queries for the active directory's name should go to the AD DNS, but queries to any other top level domain should go to a non-AD DNS server.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    RFE 🎁resolve

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions