Closed yaauie closed 5 years ago
I have been able to validate this locally, by pointing nameserver
at a dnsmasq
server on 127.0.0.1
that emits a reply for fubar
:
╭─{ yaauie@castrovel:~/src/elastic/logstash-plugins/logstash-filter-dns (✘ backport-underqualified-domain-fix) }
╰─● dig @127.0.0.1 fubar +nocomments
; <<>> DiG 9.8.3-P1 <<>> @127.0.0.1 fubar +nocomments
; (1 server found)
;; global options: +cmd
;fubar. IN A
fubar. 0 IN A 123.45.67.89
;; Query time: 0 msec
;; SERVER: 127.0.0.1#53(127.0.0.1)
;; WHEN: Thu Feb 7 22:28:37 2019
;; MSG SIZE rcvd: 38
[success]
And then running a config that includes nameserver => '127.0.0.1'
; without the patch applied, the name fails to resolve, but with it applied, it resolves as expected.
Note: this issue does not occur when the hostname resolves in a provided hostfile, as the bug is in DNS canonicalisation.
LGTM For clarity; this path applies to JRuby < 9.0 which translate to logstash < 6.0.
This patch has been included in the 3.0.12 release of this plugin.
bin/logstash-plugin update logstash-filter-dns
In the Ruby stdlib that ships with JRubies < 9.0, there was a bug that prevented underqualified domain names from resolving (that is, domain names with fewer dots in them than the configured minimum, which defaults to 1).
Effectively this prevented unqualified domain names (e.g., dot-less domain names registered with a dns server like dnsmasq, or even
localhost
) from resolving.If applicable to the runtime, this patch backports a patch from https://bugs.ruby-lang.org/issues/10412
It also clean up the
resolv_patch.rb
file in two ways:logstash/filter/dns
directory to avoid it being loaded accidentally (and perhaps out-of-order) by another plugin