Project

General

Profile

Bug #16952

Updated by Dominic Cleal over 7 years ago

When I try to remove the IPv6 address from a host, the smart proxy fails to update the DNS server. 
 There are three issues, two are on the proxy side, the other is on the foreman side: 

 # The foreman server doesn't set the resource type when sending the delete request for an fqdn to the proxy. It calls _<url>/dns/<fqdn>_ twice instead of _<url>/dns/<fqdn>/A_ and _<url>/dns/<fqdn>/AAAA_. This causes the proxy to default to A and deleting the A record twice (rather than the A and the AAAA record). I believe this can be fixed by changing the destroy method in ./lib/net/dns/forward_record.rb to <pre> 
 def destroy 
   super 
   proxy.delete("#{hostname}/#{type}") 
 </pre> 
 # The dns_nsupdate proxy can't delete the IPv6 PTR record. The _do_remove_ method in dns_nsupdate/dns_nsupdate_main.rb is calling _dns_find_ (dns_common/dns_common.rb) which can handle only IPv4 reverse addresses. It takes the first four segments of the IPv6 address and tries a reverse lookup on them which will most likely fail (but might not). There's already a _ptr_to_ip_ method in dns_common/dns_common.rb, using it to check whether _key_ is a PTR should solve the problem, e.g. <pre> 
 def dns_find key 
   begin 
     resolver.getname(ptr_to_ip(key)).to_s 
   rescue Proxy::Dns::Error 
     resolver.getaddress(key).to_s 
   end 
 rescue Resolv::ResolvError 
   false 
 end 
 </pre> 
 I think the _dns_find_ method should also take the record type into account. If there's an existing A, but no AAAA record and you try to delete the AAAA record it will still do it because the lookup finds the A record. 
 # Unlike the _do_create_ method, the _do_remove_ method does not have an ensure block which closes the forked nsupdate process. If the exception is triggered (which happened to me because of 2.) then you end up with a lot of nsupdate zombie processes.

Back