saltstack / saltstack/salt

[Feature] Add +search to dig module for attempting to resolve non-FQDNs

Open
#68,090 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Feature
Dominant language
Python
Stars
15.7k
Forks
5.6k
Avg merge
2d 44m
Merged PRs (30d)
80

Description

Description
When using dig.(A / AAAA / CNAME) functions, they will not attempt to lookup a host using the searchlist / domain directive in resolv.conf

If dig is not installed, dnsutil.(A / AAAA ) will work correctly. Once the dig binary is available however, the dig modules take precedence and A / AAAA non-FQDN search functionality becomes broken.

Setup
/etc/resolv.conf :

nameserver 8.8.8.8
nameserver 8.8.4.4
search google.com
  • on-prem machine
  • VM (Virtualbox, KVM, etc. please specify)
  • VM running on a cloud service, please be explicit and add details
  • container (Kubernetes, Docker, containerd, etc. please specify)
  • or a combination, please be explicit
  • jails if it is FreeBSD
  • classic packaging
  • onedir packaging
  • used bootstrap to install

Steps to Reproduce the behavior

user@minion01:~ $ ping -q -c 1 web           
PING www3.l.google.com (192.178.49.206) 56(84) bytes of data.

--- www3.l.google.com ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 24.581/24.581/24.581/0.000 ms

user@minion01:~ $ which dig
user@minion01:~ $ sudo salt-call dnsutil.A web
local:
    - 192.178.49.206
user@minion01:~ $ sudo salt-call dnsutil.AAAA web
local:
    - 2607:f8b0:402a:80a::200e

user@minion01:~ $ sudo salt-call dig.A web
'dig' __virtual__ returned False: The dig execution module cannot be loaded: the dig binary is not in the path.

user@minion01:~ $ sudo salt-call pkg.install dnsutils
local:
    ----------
    bind9-dnsutils:
        ----------
        new:
            1:9.18.33-1~deb12u2
        old:
    dnsutils:
        ----------
        new:
            1:9.18.33-1~deb12u2
        old:
user@minion01:~ $ which dig
/usr/bin/dig
user@minion01:~ $ sudo salt-call dnsutil.A web
local:

user@minion01:~ $ sudo salt-call dnsutil.AAAA web
local:

user@minion01:~ $ sudo salt-call dig.A web
local:

user@minion01:~ $ sudo salt-call dig.AAAA web
local:

Expected behavior
The dig module should use the +search argument for A / AAAA / CNAME lookups like you would expect from a standard CLI.

Versions Report

salt --versions-report
Salt Version:
          Salt: 3006.11
 
Python Version:
        Python: 3.10.17 (main, May 11 2025, 04:06:37) [GCC 11.2.0]
 
Dependency Versions:
          cffi: 1.16.0
      cherrypy: unknown
  cryptography: 42.0.5
      dateutil: 2.8.1
     docker-py: Not Installed
         gitdb: Not Installed
     gitpython: Not Installed
        Jinja2: 3.1.6
       libgit2: 1.7.1
  looseversion: 1.0.2
      M2Crypto: Not Installed
          Mako: Not Installed
       msgpack: 1.0.2
  msgpack-pure: Not Installed
  mysql-python: Not Installed
     packaging: 22.0
     pycparser: 2.21
      pycrypto: Not Installed
  pycryptodome: 3.19.1
        pygit2: 1.13.3
  python-gnupg: 0.4.8
        PyYAML: 6.0.1
         PyZMQ: 23.2.0
        relenv: 0.19.2
         smmap: Not Installed
       timelib: 0.2.4
       Tornado: 4.5.3
           ZMQ: 4.3.4
 
System Versions:
          dist: debian 12 bookworm
        locale: utf-8
       machine: aarch64
       release: 6.1.70-v8+
        system: Linux
       version: Debian GNU/Linux 12 bookworm

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the dig.A, dig.AAAA, and dig.CNAME execution-module entry points and compare their behavior with dnsutil.A and dnsutil.AAAA using the resolv.conf setup in the report. Reproduce the non-FQDN lookup before and after dig is installed, then verify that the affected lookups honor the search list and return the expected addresses.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
networking
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.