#5719 host plugin: detection of domain/zone may not work correctly for all cases
Opened 8 years ago by mbasti. Modified 7 years ago

Current code in the host plugin uses following block of code to detect zone/domain part of hostname

parts = keys[-1].split('.')
host = parts[0]
domain = unicode('.'.join(parts[1:]))

The returned domain may not be the zone where host belongs.

This also prevents us to use dot ('.') in hostname.


An example:

  • DNS zone = example.com.
  • Host name = myhost.osproject.example.com.
  • Labels used to identify that FQDN in the zone = myhost.osproject (no period)

This can be created using:

$ ipa dnszone-add example.com.
$ ipa dnsrecord-add example.com. myhost.osproject --a-rec=192.0.2.1

Resulting DNS record:

myhost.osproject.example.com. A 192.0.2.1

However, IPA host plugin will choke on this:

parts = keys[-1].split('.')
host = parts[0]
domain = unicode('.'.join(parts[1:]))

i.e.

keys[-1] = 'myhost.osproject.example.com.'
parts = ['myhost', 'osproject', 'example', 'com', '']
domain = u'osproject.example.com.'

Now the obvious problem is that variable domain != what was entered in
dnszone-add.

The result: The code using this logic will blow up because DNS
zone osproject.example.com. does not exist in LDAP. Correct zone name is
example.com.

happens also in ipa-replica-manage del while deleting DNS records, could be reproduced in lab where DNS zone is different then hostname suffix

Metadata Update from @mbasti:
- Issue assigned to someone
- Issue set to the milestone: Future Releases

7 years ago

Login to comment on this ticket.

Metadata