2

I am trying to validate txt records in the dns in order to verify if a domain is owned by an entity. To do this I will ask the domain owner to add a txt record I provide. After they make the change I need to instantly check whether the txt value is present. I believe I can do that in case I lookup the authoritative name server for the domain.

Is there a way in java to query txt records for a domain from the authoritative name server.

Example:

1.There is domain xyz.com with authoritative name server a1.abc.com

2.a txt record is added to xyz.com

3.I do not know the authoritative name server, so I query xyz.com to get authoritative response from the authoritative name server - is there a java library that can do that?

I believe dnsjava implements the dns protocol but I do not find a way to query the authoritative name server

  • That would be a two-step process - look up the NS records of the domainm, and then create a SimpleResolver that connects to the servers mentioned in the NS records ( in the correct order) – Erwin Bolwidt Dec 18 '18 at 07:06
  • https://github.com/jowlo/dns-extract-txt this could be of help. – mdeora Dec 18 '18 at 12:37
  • @ErwinBolwidt Yes. I can write the two lookups in java I believe, but was wondering if its already been written. It seems like a common problem to solve if you want to lookup dns data that is not cached on resolving DNS Servers. – Chetan Sood Dec 18 '18 at 14:50
  • It's a very rare use-case. Caching in local resolvers is there to remove load from the authoritative servers, and you shouldn't bypass it unless you have a very good reason. – Erwin Bolwidt Dec 18 '18 at 21:10

0 Answers0