Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

backport patch to resolv for underqualified domain names #48

Merged

Conversation

@yaauie
Copy link
Contributor

commented Feb 7, 2019

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:

  • it moves it into the logstash/filter/dns directory to avoid it being loaded accidentally (and perhaps out-of-order) by another plugin
  • it uses local variables to avoid setting global top-level constants, which could interfere with other plugins
@yaauie

This comment has been minimized.

Copy link
Contributor Author

commented Feb 7, 2019

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.

@colinsurprenant

This comment has been minimized.

Copy link
Contributor

commented Feb 8, 2019

LGTM
For clarity; this path applies to JRuby < 9.0 which translate to logstash < 6.0.

@yaauie yaauie referenced this pull request Feb 8, 2019

@yaauie yaauie merged commit 98d77f2 into logstash-plugins:master Feb 8, 2019

1 of 2 checks passed

continuous-integration/travis-ci/pr The Travis CI build failed
Details
CLA Commit author has signed the CLA
Details
yaauie added a commit that referenced this pull request Feb 8, 2019
Merge branch 'backport-underqualified-domain-fix', remote-tracking br…
…anch 'robbavey/improve_error'

Closes: #48
Closes: #49

Resolves: #38
Resolves: #31

@yaauie yaauie deleted the yaauie:backport-underqualified-domain-fix branch Feb 11, 2019

@yaauie

This comment has been minimized.

Copy link
Contributor Author

commented Feb 11, 2019

This patch has been included in the 3.0.12 release of this plugin.

bin/logstash-plugin update logstash-filter-dns

-- Logstash: Working with Plugins

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.