8000 Getting DnssecValidationFailedException for non existing domain · Issue #121 · MiniDNS/minidns · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Getting DnssecValidationFailedException for non existing domain #121
Open
@rekire

Description

@rekire

I'm playing with this lib and got an unexpected error 6BCE in my test code. I get an DnssecValidationFailedException for non existing domain "github.xxx".

Here is my test code:

class DnsTest {
    enum class AddressStatus {
        valid,
        notRegistered,
        noMxRecord,
        unknown
    }

    @Test
    fun evaluating() {
        val cases = mapOf(
            "github.com" to AddressStatus.valid,
            "github.io" to AddressStatus.noMxRecord,
            "github.xxx" to AddressStatus.notRegistered,
        )
        cases.forEach { (domain, expected) ->
            val result = checkDomain(domain)
            assertEquals("Unexpected result for $domain", expected, result)
        }
    }

    private fun checkDomain(domain: String) : AddressStatus {
        return try {
            val result = DnssecResolverApi.INSTANCE.resolve<MX>(Question(domain, Record.TYPE.MX))
            when {
                result.wasSuccessful() && result.answersOrEmptySet.isEmpty() -> AddressStatus.noMxRecord
                result.wasSuccessful() && result.answersOrEmptySet.isNotEmpty() -> AddressStatus.valid
                result.responseCode == RESPONSE_CODE.NX_DOMAIN -> AddressStatus.notRegistered
                else -> AddressStatus.unknown
            }
        } catch (err: DnssecValidationFailedException) {
            println("Error: ${err.message}")
            AddressStatus.unknown
        } catch (t: IOException) {
            AddressStatus.unknown
        }
    }
}

I get the exception: Unexpected result for github.xxx expected:<notRegistered> but was:<unknown>

When I run dig github.xxx +dnssec I get the expected NXDOMAIN status:

; <<>> DiG 9.10.6 <<>> github.xxx +dnssec
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NXDOMAIN, id: 51158
;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 8, ADDITIONAL: 1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0