Bug 738788

Summary: ipa dnsrecord-add allows invalid kx records
Product: Red Hat Enterprise Linux 6 Reporter: Michael Gregg <mgregg>
Component: ipaAssignee: Martin Kosek <mkosek>
Status: CLOSED ERRATA QA Contact: Chandrasekar Kannan <ckannan>
Severity: low Docs Contact:
Priority: medium    
Version: 6.3CC: benl, dpal, grajaiya, mkosek
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: ipa-2.2.0-1.el6 Doc Type: Bug Fix
Doc Text:
No documentation needed.
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-06-20 13:14:11 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 756082    

Description Michael Gregg 2011-09-15 19:11:21 UTC
Description of problem:
I am able to add invalid kx dns records. 

The RFC for KX records is pretty bad, but it looks like a valid KX record will have two values, a priority and a server.

The priority should be a 16-bit value (0-65535)

I am able to add values less that 0, and greater that 65535

Version-Release number of selected component (if applicable):
ipa-server-2.1.1-1.el6.x86_64

How reproducible:
always

Steps to Reproduce:
1. ipa dnsrecord-add $zone @ --kx-rec "-1 1.2.3.4"
2. ipa dnsrecord-add $zone @ --kx-rec "333383838383 1.2.3.4"
  
Actual results:
ipa dnsrecord-add happily created the bad records

Expected results:
I expect dnsrecord-add to reject the bad values.

Comment 2 Martin Kosek 2011-09-16 06:36:40 UTC
Currently, the most DNS records are not validated in ipa-server on RHEL. I have, however, already submitted a patch implementing all these validators (including kx):

http://www.redhat.com/archives/freeipa-devel/2011-September/msg00042.html

It is targeted for FreeIPA 3.0. If this BZ gets 6.2 ACKs I can backport the patch for RHEL 6.2.

Comment 3 Martin Kosek 2011-09-16 09:29:57 UTC
Relevant upstream ticket:
https://fedorahosted.org/freeipa/ticket/1106

Comment 4 Martin Kosek 2011-11-16 12:46:48 UTC
Fixed upstream:

master: efc3e2c1f7a3dcf5e94736395d39e1fa2800a490

Comment 5 Michael Gregg 2011-12-22 20:37:44 UTC
This bug still appears present in :
ipa-server-2.1.3-9.el6.x86_64
bind-dyndb-ldap-0.2.0-7.el6.x86_64

Maybe I do not have a new enough version of these tools?

Also, regarding comment #3, the referenced upstream ticket doesn't seem to relate to this problem. That upstream ticket relates to the behaviour that adding bad records of some types breaks resolution all together. 

The behaviour in this bug is that when you add a bad kx record, name resolution continues working, but invalid values come out of bind when asked about a kx record.

Comment 6 Martin Kosek 2011-12-23 21:03:11 UTC
Improved DNS validation was pushed to master branch only, i.e. this is targeted for upcoming upstream release FreeIPA 3.0 planned for RHEL 6.3.

I think comment #3 is correct. The Trac ticket 1106 added improved validation for almost all DNS records, including KX. There will be more major improvements in this area in ticket 2082:

https://fedorahosted.org/freeipa/ticket/2082

Broken DNS resolution when a invalid DNS data are saved to a zone are dealt with in Bug 750947 (ticket 2072).

Comment 8 Gowrishankar Rajaiyan 2012-03-07 19:33:18 UTC
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: [   LOG    ] :: ipa-dns-158: Bug 738788 - ipa dnsrecord-add allows invalid kx records
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

:: [08:29:33] ::  verifies https://bugzilla.redhat.com/show_bug.cgi?id=738788
ipa: ERROR: invalid 'preference': must be at least 0
:: [   PASS   ] :: Running 'ipa dnsrecord-add newzone @ --kx-rec "-1 1.2.3.4" | grep "ipa: ERROR: invalid 'preference': must be at least 0"'
ipa: ERROR: invalid 'preference': can be at most 65535
:: [   PASS   ] :: Running 'ipa dnsrecord-add newzone @ --kx-rec "333383838383 1.2.3.4" | grep "ipa: ERROR: invalid 'preference': can be at most 65535"'
'fb3c69d4-aff0-43c2-96d5-32beffff0c6d'
ipa-dns-158 result: PASS

Verified: ipa-server-2.2.0-3.el6.x86_64

Comment 10 Martin Kosek 2012-04-18 20:07:21 UTC
    Technical note added. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    New Contents:
No documentation needed.

Comment 12 errata-xmlrpc 2012-06-20 13:14:11 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHBA-2012-0819.html