I've run into a situation on any Red Hat-based Linux system where the socket class' getfqdn() function is returning a result related to the DNS thieves "barefruit.co.uk" if the system is connected to the network:
If I disconnect the system from the net, i get the proper result of - for example - "centos764.build.tolisgroup.com".
Using "hostname --fqdn" provides the proper result in both scenarios.
I have validated my /etc/hosts and /etc/resolv.conf files and they are correct.
Any other non-Red Hat Linux does not exhibit this curiosity (Mint, Ubuntu, Debian, Slack, Arch, OpenSuSE all tested).
Has anyone else run into this or have an idea of the cause and a potential fix?
Tim
$ ./python Python 2.3 (#1, Apr 28 2018, 17:28:50) [GCC 4.8.5 20150623 (Red Hat 4.8.5-16)] on linux3 Type "help", "copyright", "credits" or "license" for more information. >>> import socket >>> socket.getfqdn() 'unallocated.barefruit.co.uk' >>>That is from a 2.3 build, but I receive the same result with 2.7 and 3.4 - both with the Python supplied with the OS or with a version that I build myself (such as 2.3).
If I disconnect the system from the net, i get the proper result of - for example - "centos764.build.tolisgroup.com".
Using "hostname --fqdn" provides the proper result in both scenarios.
I have validated my /etc/hosts and /etc/resolv.conf files and they are correct.
Any other non-Red Hat Linux does not exhibit this curiosity (Mint, Ubuntu, Debian, Slack, Arch, OpenSuSE all tested).
Has anyone else run into this or have an idea of the cause and a potential fix?
Tim