Bug 1410324 - nagios-plugins 2.1.4: check_dns lost MX priority on output
Summary: nagios-plugins 2.1.4: check_dns lost MX priority on output
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora EPEL
Classification: Fedora
Component: nagios-plugins
Version: epel7
Hardware: All
OS: Linux
unspecified
low
Target Milestone: ---
Assignee: Stephen John Smoogen
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2017-01-05 06:44 UTC by Peter Bieringer
Modified: 2017-06-30 03:17 UTC (History)
8 users (show)

Fixed In Version: nagios-plugins-2.2.1-1.el7
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2017-06-30 03:17:19 UTC


Attachments (Terms of Use)

Description Peter Bieringer 2017-01-05 06:44:47 UTC
Description of problem:
MX priority got lost after updating check_dns

Version-Release number of selected component (if applicable):
nagios-plugins-dns-2.1.4-2.el7.x86_64

How reproducible:
always


Steps to Reproduce:

# ./check_dns -V
check_dns v2.0.3 (nagios-plugins 2.0.3)

# ./check_dns -q MX -H google.com
DNS OK: 0,008 seconds response time. GOogle.com returns 10 aspmx.l.GOogle.com.,20 alt1.aspmx.l.GOogle.com.,30 alt2.aspmx.l.GOogle.com.,40 alt3.aspmx.l.GOogle.com.,50 alt4.aspmx.l.GOogle.com.|time=0,007671s;;;0,000000


# /usr/lib64/nagios/plugins/check_dns -V
check_dns v2.1.4 (nagios-plugins 2.1.4)

# /usr/lib64/nagios/plugins/check_dns -q MX -H google.com
DNS OK: 0,007 seconds response time. google.com returns alt1.aspmx.l.google.com.,alt2.aspmx.l.google.com.,alt3.aspmx.l.google.com.,alt4.aspmx.l.google.com.,aspmx.l.google.com.|time=0,007134s;;;0,000000


Actual results:
No MX priority anymore shown


Expected results:
MX priority shown as in 2.0.3

Comment 1 John C. Frickson 2017-01-06 15:14:24 UTC
I opened a bug report upstream at https://github.com/nagios-plugins/nagios-plugins/issues/220

Comment 2 Fedora Update System 2017-02-15 14:42:14 UTC
nagios-plugins-2.1.4-5.el7 has been submitted as an update to Fedora EPEL 7. https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2017-0430ba2927

Comment 3 Fedora Update System 2017-02-16 17:18:48 UTC
nagios-plugins-2.1.4-5.el7 has been pushed to the Fedora EPEL 7 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2017-0430ba2927

Comment 4 Fedora Update System 2017-02-16 20:59:26 UTC
nagios-plugins-2.1.4-6.el7 has been submitted as an update to Fedora EPEL 7. https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2017-4bf2c82fc6

Comment 5 Fedora Update System 2017-02-16 23:30:53 UTC
nagios-plugins-2.1.4-7.el7 has been submitted as an update to Fedora EPEL 7. https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2017-d35ac726be

Comment 6 Fedora Update System 2017-02-17 21:19:07 UTC
nagios-plugins-2.1.4-7.el7 has been pushed to the Fedora EPEL 7 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2017-d35ac726be

Comment 7 Peter Bieringer 2017-02-18 17:25:45 UTC
Still not fixed:

$ /usr/lib64/nagios/plugins/check_dns -V
check_dns v2.1.4 (nagios-plugins 2.1.4)

$ /usr/lib64/nagios/plugins/check_dns -q MX -H google.com
DNS OK: 0,006 seconds response time. google.com returns alt1.aspmx.l.google.com.,alt2.aspmx.l.google.com.,alt3.aspmx.l.google.com.,alt4.aspmx.l.google.com.,aspmx.l.google.com.|time=0,006436s;;;0,000000

-> no MX priority shown

Besides that there are some major issues with check_http, reported e.g. 
https://github.com/nagios-plugins/nagios-plugins/issues/236

imho, this update should NOT be pushed to stable, because it would makes a lot of admins unhappy...

Comment 8 Stephen John Smoogen 2017-02-18 21:31:25 UTC
OK thanks. I will open a bug upstream on the check_dns. If you haven't already, please put a -1 in bodhi to keep it from getting pushed. 

https://bodhi.fedoraproject.org/updates/?packages=nagios-plugins

Comment 9 Stephen John Smoogen 2017-02-24 21:48:30 UTC
Alright, I have updated the code to 2.2.0 which doesn't fix this, but I have fixed this bug in check_dns.c so it gives output similar to what was there before. 

Could you check to see if the build in https://koji.fedoraproject.org/koji/taskinfo?taskID=18038883 works for you?

If so I will replace the current 2.1.4 with 2.2.0 in epel-testing

Comment 10 Peter Bieringer 2017-02-25 06:12:31 UTC
MX priority return in 2.2.0:

# /usr/lib64/nagios/plugins/check_dns -V
check_dns v2.2.0 (nagios-plugins 2.2.0)

# /usr/lib64/nagios/plugins/check_dns -q MX -H google.com
DNS OK: 0,007 seconds response time. google.com returns 10 aspmx.l.google.com.,20 alt1.aspmx.l.google.com.,30 alt2.aspmx.l.google.com.,40 alt3.aspmx.l.google.com.,50 alt4.aspmx.l.google.com.|time=0,006620s;;;0,000000


BUT now the TXT query is *completly* broken which kills my SPF record checks

# /usr/lib64/nagios/plugins/check_dns -V
check_dns v2.2.0 (nagios-plugins 2.2.0)

# /usr/lib64/nagios/plugins/check_dns -t 20 -q TXT -H lists.bieringer.de
DNS CRITICAL - '/usr/bin/nslookup -sil' returned empty host name string

	
# /root/nagios-plugins/2.1.4/check_dns -V -t 20 -q TXT -H lists.bieringer.de
check_dns v2.1.4 (nagios-plugins 2.1.4)

# /root/nagios-plugins/2.1.4/check_dns -t 20 -q TXT -H lists.bieringer.de
DNS OK: 0,007 seconds response time. lists.bieringer.de returns -all"|time=0,006967s;;;0,000000


Not detected that even 2.1.4 was already totally broken...original output of DNS TXT record is btw:

# dig +short txt lists.bieringer.de
"v=spf1 ip4:85.214.250.30 ip4:85.214.252.130 ip6:2001:a60:9002::/48 ip6:2001:4dd0:ff00:834::2 ip6:2a01:238:423d:8800:85b3:9e6b:3019:8909 ip4:85.214.150.73 ip4:85.214.153.25 ip6:2a01:238:4281:8600:812a:5915:8d24:58f3 mx -all"

Comment 11 Stephen John Smoogen 2017-02-25 15:03:14 UTC
They completely changed how they are doing this code so I need to see a version that worked to see if I can mangle it back to how it was. 
The problem seems to be that the old way of parsing TXT worked for spf but broke other records. So I can probably fix your case but it will break others so there is going to be a "why DNS is crap to store data :)" kind of ticket.

Comment 12 Peter Bieringer 2017-02-25 15:17:56 UTC
"old way" aka 2.1.4 was not really working well (as detected today), but at least it returned an "OK" if a TXT entry was found...now it's totally broken.

One can generally discuss whether "check_dns" need some major review/improvements, because being a simple "nslookup" stdout wrapper+parser can turn in to next ugly issues, once nslookup output changes.

2.1.4 and 2.2.0 is using:

/usr/bin/nslookup -sil -querytype=TXT lists.bieringer.de
Server:		127.0.0.1
Address:	127.0.0.1#53

Non-authoritative answer:
lists.bieringer.de	text = "v=spf1 ip4:85.214.250.30 ip4:85.214.252.130 ip6:2001:a60:9002::/48 ip6:2001:4dd0:ff00:834::2 ip6:2a01:238:423d:8800:85b3:9e6b:3019:8909 ip4:85.214.150.73 ip4:85.214.153.25 ip6:2a01:238:4281:8600:812a:5915:8d24:58f3 mx -all"

Authoritative answers can be found from:
bieringer.de	nameserver = robotns3.second-ns.com.
bieringer.de	nameserver = robotns2.second-ns.de.
bieringer.de	nameserver = ns1.first-ns.de.
robotns3.second-ns.com	internet address = 193.47.99.3
robotns2.second-ns.de	internet address = 213.133.105.6
ns1.first-ns.de	internet address = 213.239.242.238
ns1.first-ns.de	has AAAA address 2a01:4f8:0:a101::a:1


imho, output from "dig" would be perhaps more reliable and machine readable and best would be to use library calls and not stdout of any other Linux command here, e.g.

# dig +short TXT lists.bieringer.de
"v=spf1 ip4:85.214.250.30 ip4:85.214.252.130 ip6:2001:a60:9002::/48 ip6:2001:4dd0:ff00:834::2 ip6:2a01:238:423d:8800:85b3:9e6b:3019:8909 ip4:85.214.150.73 ip4:85.214.153.25 ip6:2a01:238:4281:8600:812a:5915:8d24:58f3 mx -all"

Comment 13 Stephen John Smoogen 2017-02-25 15:33:30 UTC
OK this is me being an idiot and not doing a string comparison correctly. I will revert that bit and the old 2.1.4 version will come back. Was it working in 2.0.3?

Comment 14 Stephen John Smoogen 2017-02-25 15:47:58 UTC
OK so here is the fixed output:

2.0.3 version:

[smooge@localhost plugins]$ pwd
/home/smooge/rpmbuild/BUILD/nagios-plugins-2.0.3/plugins
[smooge@localhost plugins]$ ./check_dns -q TXT -H lists.bieringer.de
DNS OK: 0.095 seconds response time. Lists.bieringer.de returns "v=spf1 ip4:85.214.250.30 ip4:85.214.252.130 ip6:2001:a60:9002::/48 ip6:2001:4dd0:ff00:834::2 ip6:2a01:238:423d:8800:85b3:9e6b:3019:8909 ip4:85.214.150.73 ip4:85.214.153.25 ip6:2a01:238:4281:8600:812a:5915:8d24:58f3 mx -all"|time=0.094737s;;;0.000000


2.2.0 version:

[smooge@localhost plugins]$ ./check_dns -q TXT -H lists.bieringer.de
DNS OK: 0.100 seconds response time. lists.bieringer.de returns "v=spf1 ip4:85.214.250.30 ip4:85.214.252.130 ip6:2001:a60:9002::/48 ip6:2001:4dd0:ff00:834::2 ip6:2a01:238:423d:8800:85b3:9e6b:3019:8909 ip4:85.214.150.73 ip4:85.214.153.25 ip6:2a01:238:4281:8600:812a:5915:8d24:58f3 mx -all"|time=0.099618s;;;0.000000

The request for using dig versus nslookup should be taken up upstream because I am not sure I can better advocate it than you did.

Comment 15 Stephen John Smoogen 2017-02-25 16:14:36 UTC
Updated builds are in https://koji.fedoraproject.org/koji/taskinfo?taskID=18055261

Please let me know if it fixes things. I am also working on trying to track down an HTTP fix

Comment 16 Peter Bieringer 2017-02-25 17:00:18 UTC
TXT record check is now working again - thank you for the quick fix!

Comment 17 Stephen John Smoogen 2017-02-25 17:35:00 UTC
OK I have a 'fix' for the HTTP as listed in the bug which I will put into the build and then put into EPEL-testing. Please check and if it works give it the thumbs up in bodhi.

Comment 18 Fedora Update System 2017-02-25 21:46:35 UTC
nagios-plugins-2.2.0-3.el7 has been submitted as an update to Fedora EPEL 7. https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2017-cbb077cc9b

Comment 19 Fedora Update System 2017-02-25 22:35:50 UTC
nagios-plugins-2.2.0-4.el7 has been submitted as an update to Fedora EPEL 7. https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2017-579895db6a

Comment 20 Fedora Update System 2017-02-26 22:49:18 UTC
nagios-plugins-2.2.0-4.el7 has been pushed to the Fedora EPEL 7 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2017-579895db6a

Comment 21 Fedora Update System 2017-03-11 01:02:46 UTC
nagios-plugins-2.2.0-6.el7 has been submitted as an update to Fedora EPEL 7. https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2017-212f3ef76e

Comment 22 Peter Bieringer 2017-03-11 06:21:32 UTC
nagios-plugins-2.2.0-6.el7 lost the fixes of 2.2.0-4 :-(

# ./2.2.0-4/check_dns -t 20 -q MX -H lists.bieringer.de
DNS OK: 0,007 seconds response time. lists.bieringer.de returns 10 st2.bieringer.net.|time=0,006539s;;;0,000000

# ./2.2.0-6/check_dns -t 20 -q MX -H lists.bieringer.de
DNS OK: 0,007 seconds response time. lists.bieringer.de returns st2.bieringer.net.|time=0,006675s;;;0,000000

Comment 23 Fedora Update System 2017-03-11 12:50:12 UTC
nagios-plugins-2.2.0-6.el7 has been pushed to the Fedora EPEL 7 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2017-212f3ef76e

Comment 24 Fedora Update System 2017-03-13 00:37:53 UTC
nagios-plugins-2.2.0-7.el7 has been submitted as an update to Fedora EPEL 7. https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2017-756fbbf351

Comment 25 Fedora Update System 2017-03-14 00:18:59 UTC
nagios-plugins-2.2.0-7.el7 has been pushed to the Fedora EPEL 7 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2017-756fbbf351

Comment 26 John C. Frickson 2017-04-10 17:08:45 UTC
Just an FYI from upstream:

smooge's patches have been applied to Nagios Plugins version 2.2.1-rc1, which is due to be released on April 19.

Comment 27 Fedora Update System 2017-04-21 00:08:21 UTC
nagios-plugins-2.2.1-1.el7 has been submitted as an update to Fedora EPEL 7. https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2017-e452ab1676

Comment 28 Fedora Update System 2017-04-22 21:48:05 UTC
nagios-plugins-2.2.1-1.el7 has been pushed to the Fedora EPEL 7 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2017-e452ab1676

Comment 29 Fedora Update System 2017-06-30 03:17:19 UTC
nagios-plugins-2.2.1-1.el7 has been pushed to the Fedora EPEL 7 stable repository. If problems still persist, please make note of it in this bug report.


Note You need to log in before you can comment on or make changes to this bug.