Skip to content

[BUG] Grain does not report configured nameservers for systemd-resolved #57618

Closed

Description

@OrangeDog

Description
On systems using systemd-resolved, by default the /etc/resolv.conf file lists 127.0.0.53 as the nameserver (for clients not using the libc or bus APIs). The list of actual nameservers is available e.g. via systemd-resolve --status, or resolvectl dns on newer systems.

I'm not sure when resolvectl was added. It's not available in 237 but is in 245.

Setup
A default install of e.g. Ubuntu 18.04 (server).

Steps to Reproduce the behavior

# salt '*' grains.get dns
minion:
    ----------
    domain:
    ip4_nameservers:
        - 127.0.0.53
    ip6_nameservers:
    nameservers:
        - 127.0.0.53
    options:
        - edns0
    search:
        - local
    sortlist:
# systemd-resolve --status | tail

Link 2 (ens3)
      Current Scopes: DNS
       LLMNR setting: yes
MulticastDNS setting: no
      DNSSEC setting: no
    DNSSEC supported: yes
         DNS Servers: 1.1.1.1
                      1.0.0.1
          DNS Domain: local

Expected behavior
The system's actual configured nameservers should be returned.

Versions Report

salt --versions-report (Provided by running salt --versions-report. Please also mention any differences in master/minion versions.)
Salt Version:
           Salt: 3000.3

Dependency Versions:
           cffi: Not Installed
       cherrypy: Not Installed
       dateutil: 2.6.1
      docker-py: Not Installed
          gitdb: 2.0.3
      gitpython: 2.1.8
         Jinja2: 2.10
        libgit2: 0.26.0
       M2Crypto: 0.32.0
           Mako: Not Installed
   msgpack-pure: Not Installed
 msgpack-python: 0.5.6
   mysql-python: Not Installed
      pycparser: Not Installed
       pycrypto: 2.6.1
   pycryptodome: Not Installed
         pygit2: 0.26.2
         Python: 3.6.9 (default, Apr 18 2020, 01:56:04)
   python-gnupg: 0.4.1
         PyYAML: 3.12
          PyZMQ: 16.0.2
          smmap: 2.0.3
        timelib: Not Installed
        Tornado: 4.5.3
            ZMQ: 4.2.5

System Versions:
           dist: Ubuntu 18.04 bionic
         locale: ISO-8859-1
        machine: x86_64
        release: 4.15.0-101-generic
         system: Linux
        version: Ubuntu 18.04 bionic

Activity

  1. added
    bug
    on Jun 10, 2020
  2. added this to the Approved milestone on Jun 11, 2020
  3. added
    severity-medium
    on Jun 11, 2020
  4. nee2c commented on Jun 15, 2020

    @nee2c
    Contributor

    If not mistaken resolvectl was added 16.10. I don't know if there is any thing to update in salt as the grain just parse /etc/resolv.conf. Ubuntu resolvectl dose not update /etc/reolv.conf. I have a state for ubuntu 16.10 =< create syslink to /run/resolvconf/resolv.conf (not 100% on that path). I don't know why ubuntu is setup like this.

  5. OrangeDog commented on Jun 15, 2020

    @OrangeDog
    ContributorAuthor

    resolvectl was added 16.10

    It's not available in 18.04, so I doubt that. Did you mean systemd-resolved?

    the grain just parse /etc/resolv.conf

    Yes, that's why it doesn't work.

    I don't know why ubuntu is setup like this.

    Because it is the recommended mode of operation. If you replace the symlink then clients that use it will lose local resolution, DNSSEC, and other functionality.

  6. added
    Aluminium
    on Jul 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Aluminiumbugseverity-medium

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions