Bug#947688: systemd-networkd: Python socket.getfqdn() not working properly when resolv.conf lacks "domain" key
Michael Biebl
biebl at debian.org
Sat Feb 1 07:09:03 GMT 2020
Is this happening for arbitrary hosts or only the hostname?
Taking my simple setup as an example, where my DNS server is a FRITZ.Box
pluto is my hostname
michael at pluto:~$ cat /etc/resolv.conf
# This file is managed by man:systemd-resolved(8). Do not edit.
#
# This is a dynamic resolv.conf file for connecting local clients to the
# internal DNS stub resolver of systemd-resolved. This file lists all
# configured search domains.
#
# Run "resolvectl status" to see details about the uplink DNS servers
# currently in use.
#
# Third party programs must not access this file directly, but only
through the
# symlink at /etc/resolv.conf. To manage man:resolv.conf(5) in a
different way,
# replace this symlink by a static file or a different symlink.
#
# See man:systemd-resolved.service(8) for details about the supported
modes of
# operation for /etc/resolv.conf.
nameserver 127.0.0.53
options edns0
search fritz.box
michael at pluto:~$ host pluto
pluto.fritz.box has address 192.168.179.70
michael at pluto:~$ host brix
brix.fritz.box has address 192.168.179.37
michael at pluto:~$ python test.py
brix.fritz.box
pluto
michael at pluto:~$ cat test.py
#!/usr/bin/python
import socket
name=socket.getfqdn("brix")
print(name)
name=socket.getfqdn("pluto")
print(name)
Running resolved in debug mode:
> Feb 01 08:03:19 pluto systemd-resolved[69478]: Cache miss for pluto.fritz.box IN AAAA
> Feb 01 08:03:19 pluto systemd-resolved[69478]: Transaction 36445 for <pluto.fritz.box IN AAAA> scope dns on wlan0/*.
> Feb 01 08:03:19 pluto systemd-resolved[69478]: Using feature level UDP for transaction 36445.
> Feb 01 08:03:19 pluto systemd-resolved[69478]: Using DNS server 192.168.179.11 for transaction 36445.
> Feb 01 08:03:19 pluto systemd-resolved[69478]: Sending query packet with id 36445.
> Feb 01 08:03:19 pluto systemd-resolved[69478]: Processing query...
> Feb 01 08:03:19 pluto systemd-resolved[69478]: Processing incoming packet on transaction 24988 (rcode=SUCCESS).
> Feb 01 08:03:19 pluto systemd-resolved[69478]: Not validating response for 24988, used server feature level does not support DNSSEC.
> Feb 01 08:03:19 pluto systemd-resolved[69478]: Added positive unauthenticated cache entry for pluto.fritz.box IN A 9s on wlan0/INET/192.168.179.11
> Feb 01 08:03:19 pluto systemd-resolved[69478]: Transaction 24988 for <pluto.fritz.box IN A> on scope dns on wlan0/* now complete with <success> from network (unsigned).
> Feb 01 08:03:19 pluto systemd-resolved[69478]: Sending response packet with id 65190 on interface 1/AF_INET.
> Feb 01 08:03:19 pluto systemd-resolved[69478]: Freeing transaction 24988.
> Feb 01 08:03:19 pluto systemd-resolved[69478]: Processing incoming packet on transaction 36445 (rcode=SUCCESS).
> Feb 01 08:03:19 pluto systemd-resolved[69478]: Not validating response for 36445, used server feature level does not support DNSSEC.
> Feb 01 08:03:19 pluto systemd-resolved[69478]: Added positive unauthenticated cache entry for pluto.fritz.box IN AAAA 9s on wlan0/INET/192.168.179.11
> Feb 01 08:03:19 pluto systemd-resolved[69478]: Transaction 36445 for <pluto.fritz.box IN AAAA> on scope dns on wlan0/* now complete with <success> from network (unsigned).
> Feb 01 08:03:19 pluto systemd-resolved[69478]: Sending response packet with id 5758 on interface 1/AF_INET.
> Feb 01 08:03:19 pluto systemd-resolved[69478]: Freeing transaction 36445.
So resolved does properly resolve pluto, but somehow this doesn't reach
python. Odd.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <http://alioth-lists.debian.net/pipermail/pkg-systemd-maintainers/attachments/20200201/5dec8f32/attachment.sig>
More information about the Pkg-systemd-maintainers
mailing list