Python Forum
Python built on a RHEL, Fedora, or CentOS system gives bad getfqdn() Result
Thread Rating:
  • 1 Vote(s) - 4 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Python built on a RHEL, Fedora, or CentOS system gives bad getfqdn() Result
#1
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:
$ ./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
Reply


Messages In This Thread
Python built on a RHEL, Fedora, or CentOS system gives bad getfqdn() Result - by tolistim - May-16-2018, 06:30 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  How to open port 8080 in CentOS 7 nikos 0 4,291 Mar-02-2019, 03:02 PM
Last Post: nikos

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020