Issue #3898 has been updated by Michael Stahnke. Target version changed from 1.6.0 to 1.6.x
---------------------------------------- Bug #3898: fqdn fact requires reverse PTR matches the forward https://projects.puppetlabs.com/issues/3898 Author: micah - Status: Accepted Priority: Normal Assignee: Paul Nasrat Category: library Target version: 1.6.x Keywords: Branch: Affected Facter version: It seems like the patch applied in #2085 (commit:dca615c98b864d75e2ac5899d98d04a2bd979eba) changes the way the fqdn fact is determined. What it does now is: name = Socket.gethostbyname(Socket.gethostname).first and then it parses that output to pull out the hostname ($1) and then the fqdn $2. The gethostname call seems like the right way to get the hostname (its a much better improvement from parsing the output of the 'hostname' command, which essentially just does that). However, running gethostbyname over that hostname means that the fqdn is looked up by taking the hostname and then doing a DNS resolution of that hostname to get an IP, and then doing a reverse lookup of that IP to end up with the fqdn. That means that if your reverse does not match the forward, then your fqdn fact is going to end up with something different from your hostname fact. For example, if my gethostname() returns "nuthatch", and then gethostbyname does a lookup of that using my configured resolver setup, it will result in the IP 204.13.164.1, and then if you lookup the reverse on that IP, you end up with 'seattle.riseup.net'. So my hostname fact will be set to 'nuthatch', but my fqdn will be set to 'seattle.riseup.net'. This would be a surprise from how it previously worked (hostname --fqdn) which would produce "nuthatch.riseup.net" for the fqdn, and "nuthatch" for the hostname. Looking at hostname --fqdn it seems to use getaddrinfo() for that process. Looking at ruby, it seems like Socket.gethostbyname uses both gethostbyname and getaddrinfo. First it looks up your hostname with getaddrinfo(), then it runs gethostbyname() on the answer it gets from getaddrinfo(). It seems to me that this fact shouldn't be doing doing reverse lookups to get the fqdn, but rather do what hostname -f does, which is something like: <pre> require 'socket' addrinfo = Socket.getaddrinfo(Socket.gethostname, nil, nil, Socket::SOCK_DGRAM, nil, Socket::AI_CANONNAME) af, port, name, addr = addrinfo.first puts "fqdn: " + name </pre> NOTE: i am sure there are better ways to do this in ruby NOTE2: yes, it is better for me to have the reverse match the forward, but that isn't the point here :) -- You have received this notification because you have either subscribed to it, or are involved in it. To change your notification preferences, please click here: http://projects.puppetlabs.com/my/account -- You received this message because you are subscribed to the Google Groups "Puppet Bugs" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/puppet-bugs?hl=en.
