DNS Zone import misclassifies record type's as host names
short description
In case of the following snippet:
IN NS ns1.xxx.
IN NS ns2.xxx.
IN MX 10 mail.xxx.
IN MX 15 backup.xxx.
IN CAA 0 issue "letsencrypt.org"
IN CAA 0 issue "rapidssl.com"
IN CAA 0 iodef "mailto:admin@xxx"
IN CAA 0 issue "sectigo.com"
ISPConfig will import IN record type descriptors as names. So it will create records like:
in IN NS ns1.xxx.
in IN NS ns2.xxx.
in IN MX 10 mail.xxx.
in IN MX 15 backup.xxx.
in IN CAA 0 issue "letsencrypt.org"
in IN CAA 0 issue "rapidssl.com"
in IN CAA 0 iodef "mailto:admin@xxx"
in IN CAA 0 issue "sectigo.com"
correct behaviour
The line should be imported as original
environment
Server OS: doesn't matter Server OS version: doesn't matter ISPConfig version: 3.1.15p2
proposed fix
This part of interface/web/dns/dns_import.php needs to be fixed:
if(is_numeric($parts[1])){
if($parts[2] == 'in'){
$resource_type = $parts[3];
$pkey = 3;
} else {
$resource_type = $parts[2];
$pkey = 2;
}
} else {
if($parts[1] == 'in'){
$resource_type = $parts[2];
$pkey = 2;
} else {
$resource_type = $parts[1];
$pkey = 1;
}
}
The above code looks only for lowercase record type descriptors. However RFC1035 uses uppercase:
3.2.4. CLASS values
CLASS fields appear in resource records. The following CLASS mnemonics and values are defined:
IN 1 the Internet
CS 2 the CSNET class (Obsolete - used only for examples in some obsolete RFCs)
CH 3 the CHAOS class
HS 4 Hesiod [Dyer 87]
references
Domain name zone file format is described in RFC1035 https://tools.ietf.org/html/rfc1035