Class DnsQueryProtection
java.lang.Object
io.netty.resolver.dns.DnsQueryProtection
Defences that make it harder for an off-path attacker to spoof the response of a UDP DNS query on top of the
query id and the source port, as recommended by
RFC 5452:
- "0x20" randomization of the case of the name in the question (draft-vixie-dnsext-dns0x20)
- client cookies as defined in RFC 7873
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static enumThe result of checking the cookie in a response. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final Stringprivate final booleanprivate final Set<InetSocketAddress> private static final intUpper bound for the number of nameservers we remember to support cookies.private final SecureRandom -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static DnsQueryProtection.CookieStatuscheckCookie(ByteBuf rdata, byte[] clientCookie) (package private) static DnsQueryProtection.CookieStatuscheckCookie(DnsResponse response, byte[] clientCookie) Inspect the COOKIE option of the OPT record of the response.(package private) voidcookieReceived(InetSocketAddress nameServerAddr) (package private) boolean(package private) booleanisCookieExpected(InetSocketAddress nameServerAddr) Returnstrueif the given nameserver has returned a valid cookie before, and so is expected to do so for every response.(package private) boolean(package private) byte[](package private) DnsQuestionrandomizeCase(DnsQuestion question) Returns a copy of the givenDnsQuestionin which the case of every ASCII letter was picked at random.
-
Field Details
-
MAX_COOKIE_SERVERS
private static final int MAX_COOKIE_SERVERSUpper bound for the number of nameservers we remember to support cookies. Once reached we stop remembering new ones, which means that responses from those will not be rejected if they omit the cookie.- See Also:
-
ACE_PREFIX
- See Also:
-
random
-
caseRandomization
private final boolean caseRandomization -
cookieServers
-
-
Constructor Details
-
DnsQueryProtection
DnsQueryProtection(boolean caseRandomization, boolean cookies)
-
-
Method Details
-
isCaseRandomizationEnabled
boolean isCaseRandomizationEnabled() -
isCookiesEnabled
boolean isCookiesEnabled() -
randomizeCase
Returns a copy of the givenDnsQuestionin which the case of every ASCII letter was picked at random. -
newClientCookie
byte[] newClientCookie() -
isCookieExpected
Returnstrueif the given nameserver has returned a valid cookie before, and so is expected to do so for every response. -
cookieReceived
-
checkCookie
Inspect the COOKIE option of the OPT record of the response. -
checkCookie
-