-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
36 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package require -exact testcl 1.0.8 | ||
namespace import ::testcl::* | ||
|
||
before { | ||
event HTTP_REQUEST | ||
class configure blacklist { | ||
"blacklisted" "192.168.6.66" | ||
} | ||
} | ||
|
||
it "should drop blacklisted addresses" { | ||
on IP::remote_addr return "192.168.6.66" | ||
endstate drop | ||
run irules/classes_irule.tcl classes | ||
} | ||
|
||
it "should drop blacklisted addresses" { | ||
on IP::remote_addr return "192.168.0.1" | ||
endstate pool main-pool | ||
run irules/classes_irule.tcl classes | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
rule classes { | ||
|
||
when HTTP_REQUEST { | ||
if { [class match [IP::remote_addr] eq blacklist] } { | ||
drop | ||
} else { | ||
pool main-pool | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters