There is a bug, that if the DNS records turn on in an array but it is because 255 characters, the logics says you need to split into 2 array
So the
if ($SPF -is [array]) {
$SpfAdvisory = "Domain has more than one SPF-record. One SPF record for one domain. This is explicitly defined in RFC4408"
}
might need to change it to
if ($spf -is [array] -and (($spf | ? {$_ -like "v=spf1*"}) | measure | select -expand count) -gt 1) {
$SpfAdvisory = "Domain has more than one SPF-record. One SPF record for one domain. This is explicitly defined in RFC4408"
}
We might also want to have have a check if the spf has longer than 255 Character to make sure it is not breaking anything.
if ($spf -is [array] -and (($spf | ? {$_ -like "v=spf1*"}) | measure | select -expand count) -eq 1) {
foreach ($s in $spf) { if ($s.length -gt 255) {
$SpfAdvisory = "Your SPF-record has more than 255 characters. This is explicitly defined in RFC4408"}
} else {
if ($spf.length -gt 255) {
$SpfAdvisory = "Your SPF-record has more than 255 characters. This is explicitly defined in RFC4408"
}
This will be fixed in the next release. The requested max SPF record length feature will also be implemented in the next release. Thanks for the code snippet, it helped me a lot.
There is a bug, that if the DNS records turn on in an array but it is because 255 characters, the logics says you need to split into 2 array
So the if ($SPF -is [array]) { $SpfAdvisory = "Domain has more than one SPF-record. One SPF record for one domain. This is explicitly defined in RFC4408" }
might need to change it to
if ($spf -is [array] -and (($spf | ? {$_ -like "v=spf1*"}) | measure | select -expand count) -gt 1) { $SpfAdvisory = "Domain has more than one SPF-record. One SPF record for one domain. This is explicitly defined in RFC4408" }
We might also want to have have a check if the spf has longer than 255 Character to make sure it is not breaking anything.
if ($spf -is [array] -and (($spf | ? {$_ -like "v=spf1*"}) | measure | select -expand count) -eq 1) { foreach ($s in $spf) { if ($s.length -gt 255) { $SpfAdvisory = "Your SPF-record has more than 255 characters. This is explicitly defined in RFC4408"} } else {
if ($spf.length -gt 255) { $SpfAdvisory = "Your SPF-record has more than 255 characters. This is explicitly defined in RFC4408" }
}