mirror of
https://github.com/NLnetLabs/unbound.git
synced 2026-09-12 21:07:43 +02:00
DoS protection.
git-svn-id: file:///svn/unbound/trunk@1221 be551aaa-1e26-0410-a405-d3ace91eadb9
This commit is contained in:
Vendored
+90
@@ -0,0 +1,90 @@
|
||||
; config options go here.
|
||||
server:
|
||||
num-queries-per-thread: 1
|
||||
forward-zone:
|
||||
name: "."
|
||||
forward-addr: 216.0.0.1
|
||||
CONFIG_END
|
||||
SCENARIO_BEGIN Test too many queries asked, last is dropped.
|
||||
|
||||
; query responses from authority servers.
|
||||
RANGE_BEGIN 0 100
|
||||
ENTRY_BEGIN
|
||||
MATCH opcode qtype qname
|
||||
ADJUST copy_id
|
||||
REPLY QR RD RA NOERROR
|
||||
SECTION QUESTION
|
||||
www.example.net. IN A
|
||||
SECTION ANSWER
|
||||
www.example.net. IN A 10.20.30.40
|
||||
SECTION AUTHORITY
|
||||
www.example.net. IN NS ns.example.net.
|
||||
SECTION ADDITIONAL
|
||||
ns.example.net. IN A 10.20.30.50
|
||||
ENTRY_END
|
||||
RANGE_END
|
||||
|
||||
STEP 1 QUERY
|
||||
ENTRY_BEGIN
|
||||
REPLY RD
|
||||
SECTION QUESTION
|
||||
www.example.com. IN A
|
||||
ENTRY_END
|
||||
|
||||
STEP 2 CHECK_OUT_QUERY
|
||||
ENTRY_BEGIN
|
||||
MATCH qname qtype opcode
|
||||
SECTION QUESTION
|
||||
www.example.com. IN A
|
||||
ENTRY_END
|
||||
|
||||
; NO REPLY (this step is not needed)
|
||||
STEP 3 NOTHING
|
||||
|
||||
; another query
|
||||
STEP 4 QUERY
|
||||
ENTRY_BEGIN
|
||||
REPLY RD
|
||||
SECTION QUESTION
|
||||
www.example.net. IN A
|
||||
ENTRY_END
|
||||
|
||||
; reply from first query returns
|
||||
STEP 5 REPLY
|
||||
ENTRY_BEGIN
|
||||
MATCH opcode qtype qname
|
||||
ADJUST copy_id
|
||||
REPLY QR RD RA NOERROR
|
||||
SECTION QUESTION
|
||||
www.example.com. IN A
|
||||
SECTION ANSWER
|
||||
www.example.com. IN A 10.20.30.40
|
||||
SECTION AUTHORITY
|
||||
www.example.com. IN NS ns.example.com.
|
||||
SECTION ADDITIONAL
|
||||
ns.example.com. IN A 10.20.30.50
|
||||
ENTRY_END
|
||||
|
||||
STEP 10 CHECK_ANSWER
|
||||
ENTRY_BEGIN
|
||||
MATCH opcode qname qtype
|
||||
SECTION QUESTION
|
||||
www.example.com. IN A
|
||||
SECTION ANSWER
|
||||
www.example.com. IN A 10.20.30.40
|
||||
ENTRY_END
|
||||
|
||||
; This answer does not arrive, the query was dropped
|
||||
;STEP 11 CHECK_ANSWER
|
||||
;ENTRY_BEGIN
|
||||
;MATCH opcode qname qtype
|
||||
;SECTION QUESTION
|
||||
;www.example.net. IN A
|
||||
;SECTION ANSWER
|
||||
;www.example.net. IN A 10.20.30.40
|
||||
;ENTRY_END
|
||||
SCENARIO_END
|
||||
|
||||
; testbound checks before exit:
|
||||
; * no more pending queries outstanding.
|
||||
; * and no answers that have not been checked.
|
||||
Vendored
+110
@@ -0,0 +1,110 @@
|
||||
; config options go here.
|
||||
; This is one forever, one jostle.
|
||||
server:
|
||||
num-queries-per-thread: 2
|
||||
forward-zone:
|
||||
name: "."
|
||||
forward-addr: 216.0.0.1
|
||||
CONFIG_END
|
||||
SCENARIO_BEGIN Test too many queries asked, last is too recent to be jostled
|
||||
|
||||
; fill the forever slot.
|
||||
STEP 1 QUERY
|
||||
ENTRY_BEGIN
|
||||
REPLY RD
|
||||
SECTION QUESTION
|
||||
www.example.com. IN A
|
||||
ENTRY_END
|
||||
|
||||
STEP 2 CHECK_OUT_QUERY
|
||||
ENTRY_BEGIN
|
||||
MATCH qname qtype opcode
|
||||
SECTION QUESTION
|
||||
www.example.com. IN A
|
||||
ENTRY_END
|
||||
|
||||
; NO REPLY (this step is not needed)
|
||||
STEP 3 NOTHING
|
||||
|
||||
;something enters the jostle slot.
|
||||
STEP 4 QUERY
|
||||
ENTRY_BEGIN
|
||||
REPLY RD
|
||||
SECTION QUESTION
|
||||
www.example.net. IN A
|
||||
ENTRY_END
|
||||
|
||||
STEP 5 CHECK_OUT_QUERY
|
||||
ENTRY_BEGIN
|
||||
MATCH qname qtype opcode
|
||||
SECTION QUESTION
|
||||
www.example.net. IN A
|
||||
ENTRY_END
|
||||
|
||||
; something else tries to replace the entry in the jostle slot.
|
||||
; but the entry in the jostle slot is too recent.
|
||||
STEP 6 QUERY
|
||||
ENTRY_BEGIN
|
||||
REPLY RD
|
||||
SECTION QUESTION
|
||||
www.example.org. IN A
|
||||
ENTRY_END
|
||||
|
||||
; reply from latest query returns
|
||||
STEP 7 REPLY
|
||||
ENTRY_BEGIN
|
||||
MATCH opcode qtype qname
|
||||
ADJUST copy_id
|
||||
REPLY QR RD RA NOERROR
|
||||
SECTION QUESTION
|
||||
www.example.net. IN A
|
||||
SECTION ANSWER
|
||||
www.example.net. IN A 10.20.30.42
|
||||
SECTION AUTHORITY
|
||||
www.example.net. IN NS ns.example.net.
|
||||
SECTION ADDITIONAL
|
||||
ns.example.net. IN A 10.20.30.50
|
||||
ENTRY_END
|
||||
|
||||
; answer to last query
|
||||
STEP 8 CHECK_ANSWER
|
||||
ENTRY_BEGIN
|
||||
MATCH opcode qname qtype
|
||||
SECTION QUESTION
|
||||
www.example.net. IN A
|
||||
SECTION ANSWER
|
||||
www.example.net. IN A 10.20.30.42
|
||||
ENTRY_END
|
||||
|
||||
|
||||
; reply from first query returns
|
||||
STEP 10 REPLY
|
||||
ENTRY_BEGIN
|
||||
MATCH opcode qtype qname
|
||||
ADJUST copy_id
|
||||
REPLY QR RD RA NOERROR
|
||||
SECTION QUESTION
|
||||
www.example.com. IN A
|
||||
SECTION ANSWER
|
||||
www.example.com. IN A 10.20.30.40
|
||||
SECTION AUTHORITY
|
||||
www.example.com. IN NS ns.example.com.
|
||||
SECTION ADDITIONAL
|
||||
ns.example.com. IN A 10.20.30.50
|
||||
ENTRY_END
|
||||
|
||||
; answer to first query
|
||||
STEP 11 CHECK_ANSWER
|
||||
ENTRY_BEGIN
|
||||
MATCH opcode qname qtype
|
||||
SECTION QUESTION
|
||||
www.example.com. IN A
|
||||
SECTION ANSWER
|
||||
www.example.com. IN A 10.20.30.40
|
||||
ENTRY_END
|
||||
|
||||
SCENARIO_END
|
||||
|
||||
; testbound checks before exit:
|
||||
; * no more pending queries outstanding.
|
||||
; * and no answers that have not been checked.
|
||||
Vendored
+113
@@ -0,0 +1,113 @@
|
||||
; config options go here.
|
||||
; This is one forever, one jostle.
|
||||
server:
|
||||
num-queries-per-thread: 2
|
||||
forward-zone:
|
||||
name: "."
|
||||
forward-addr: 216.0.0.1
|
||||
CONFIG_END
|
||||
SCENARIO_BEGIN Test too many queries asked, last one jostled out to make space
|
||||
|
||||
; fill the forever slot.
|
||||
STEP 1 QUERY
|
||||
ENTRY_BEGIN
|
||||
REPLY RD
|
||||
SECTION QUESTION
|
||||
www.example.com. IN A
|
||||
ENTRY_END
|
||||
|
||||
STEP 2 CHECK_OUT_QUERY
|
||||
ENTRY_BEGIN
|
||||
MATCH qname qtype opcode
|
||||
SECTION QUESTION
|
||||
www.example.com. IN A
|
||||
ENTRY_END
|
||||
|
||||
; NO REPLY (this step is not needed)
|
||||
STEP 3 NOTHING
|
||||
|
||||
;something enters the jostle slot.
|
||||
STEP 4 QUERY
|
||||
ENTRY_BEGIN
|
||||
REPLY RD
|
||||
SECTION QUESTION
|
||||
www.example.net. IN A
|
||||
ENTRY_END
|
||||
|
||||
STEP 5 CHECK_OUT_QUERY
|
||||
ENTRY_BEGIN
|
||||
MATCH qname qtype opcode
|
||||
SECTION QUESTION
|
||||
www.example.net. IN A
|
||||
ENTRY_END
|
||||
|
||||
; 300 msec passes
|
||||
STEP 6 TIME_PASSES ELAPSE 0.300
|
||||
|
||||
; something else tries to replace the entry in the jostle slot.
|
||||
; and it works because the entry is now too old.
|
||||
STEP 8 QUERY
|
||||
ENTRY_BEGIN
|
||||
REPLY RD
|
||||
SECTION QUESTION
|
||||
www.example.org. IN A
|
||||
ENTRY_END
|
||||
|
||||
; reply from latest query returns
|
||||
STEP 9 REPLY
|
||||
ENTRY_BEGIN
|
||||
MATCH opcode qtype qname
|
||||
ADJUST copy_id
|
||||
REPLY QR RD RA NOERROR
|
||||
SECTION QUESTION
|
||||
www.example.org. IN A
|
||||
SECTION ANSWER
|
||||
www.example.org. IN A 10.20.30.42
|
||||
SECTION AUTHORITY
|
||||
www.example.org. IN NS ns.example.org.
|
||||
SECTION ADDITIONAL
|
||||
ns.example.org. IN A 10.20.30.50
|
||||
ENTRY_END
|
||||
|
||||
; answer to last query
|
||||
STEP 10 CHECK_ANSWER
|
||||
ENTRY_BEGIN
|
||||
MATCH opcode qname qtype
|
||||
SECTION QUESTION
|
||||
www.example.org. IN A
|
||||
SECTION ANSWER
|
||||
www.example.org. IN A 10.20.30.42
|
||||
ENTRY_END
|
||||
|
||||
|
||||
; reply from first query returns
|
||||
STEP 11 REPLY
|
||||
ENTRY_BEGIN
|
||||
MATCH opcode qtype qname
|
||||
ADJUST copy_id
|
||||
REPLY QR RD RA NOERROR
|
||||
SECTION QUESTION
|
||||
www.example.com. IN A
|
||||
SECTION ANSWER
|
||||
www.example.com. IN A 10.20.30.40
|
||||
SECTION AUTHORITY
|
||||
www.example.com. IN NS ns.example.com.
|
||||
SECTION ADDITIONAL
|
||||
ns.example.com. IN A 10.20.30.50
|
||||
ENTRY_END
|
||||
|
||||
; answer to first query
|
||||
STEP 12 CHECK_ANSWER
|
||||
ENTRY_BEGIN
|
||||
MATCH opcode qname qtype
|
||||
SECTION QUESTION
|
||||
www.example.com. IN A
|
||||
SECTION ANSWER
|
||||
www.example.com. IN A 10.20.30.40
|
||||
ENTRY_END
|
||||
|
||||
SCENARIO_END
|
||||
|
||||
; testbound checks before exit:
|
||||
; * no more pending queries outstanding.
|
||||
; * and no answers that have not been checked.
|
||||
Vendored
+1
-1
@@ -1,6 +1,6 @@
|
||||
; config options go here.
|
||||
server:
|
||||
num-queries-per-thread: 1
|
||||
num-queries-per-thread: 2
|
||||
forward-zone:
|
||||
name: "."
|
||||
forward-addr: 216.0.0.1
|
||||
|
||||
Reference in New Issue
Block a user