Init
This commit is contained in:
commit
21582cc86a
21 changed files with 677 additions and 0 deletions
22
ipscrub/test/dynmodule/nginx.conf
Normal file
22
ipscrub/test/dynmodule/nginx.conf
Normal file
|
@ -0,0 +1,22 @@
|
|||
|
||||
load_module ngx_ipscrub_module.so;
|
||||
|
||||
error_log logs/error.log;
|
||||
|
||||
events {}
|
||||
|
||||
http {
|
||||
log_format main '$remote_addr_ipscrub';
|
||||
|
||||
access_log logs/access.log main;
|
||||
|
||||
ipscrub_period_seconds 2;
|
||||
|
||||
server {
|
||||
# listen 8081;
|
||||
# listen [::]:8081 ipv6only=off;
|
||||
listen 8081;
|
||||
listen [::]:8081;
|
||||
server_name localhost;
|
||||
}
|
||||
}
|
7
ipscrub/test/dynmodule/test.sh
Normal file
7
ipscrub/test/dynmodule/test.sh
Normal file
|
@ -0,0 +1,7 @@
|
|||
red=$'\e[1;31m'
|
||||
grn=$'\e[1;32m'
|
||||
end=$'\e[0m'
|
||||
|
||||
curl "http://localhost:8081/" > /dev/null 2> /dev/null
|
||||
|
||||
[[ $? == 0 ]] && printf "%s\n" "${grn}PASS${end}" || printf "%s\n" "${red}FAIL${end}"
|
20
ipscrub/test/ipv46hash/nginx.conf
Normal file
20
ipscrub/test/ipv46hash/nginx.conf
Normal file
|
@ -0,0 +1,20 @@
|
|||
|
||||
error_log logs/error.log;
|
||||
|
||||
events {}
|
||||
|
||||
http {
|
||||
log_format main '$remote_addr_ipscrub';
|
||||
|
||||
access_log logs/access.log main;
|
||||
|
||||
ipscrub_period_seconds 2;
|
||||
|
||||
server {
|
||||
# listen 8081;
|
||||
# listen [::]:8081 ipv6only=off;
|
||||
listen 8081;
|
||||
listen [::]:8081;
|
||||
server_name localhost;
|
||||
}
|
||||
}
|
11
ipscrub/test/ipv46hash/test.sh
Normal file
11
ipscrub/test/ipv46hash/test.sh
Normal file
|
@ -0,0 +1,11 @@
|
|||
red=$'\e[1;31m'
|
||||
grn=$'\e[1;32m'
|
||||
end=$'\e[0m'
|
||||
|
||||
curl -6 "http://localhost:8081/" > /dev/null 2> /dev/null
|
||||
output6=$(tail -n 1 dest/logs/access.log)
|
||||
|
||||
curl -4 "http://localhost:8081/" > /dev/null 2> /dev/null
|
||||
output4=$(tail -n 1 dest/logs/access.log)
|
||||
|
||||
[[ "${#output6}" == 22 && "${#output4}" == 6 ]] && printf "%s\n" "${grn}PASS${end}" || printf "%s\n" "${red}FAIL${end}"
|
18
ipscrub/test/saltedsha/nginx.conf
Normal file
18
ipscrub/test/saltedsha/nginx.conf
Normal file
|
@ -0,0 +1,18 @@
|
|||
|
||||
error_log logs/error.log;
|
||||
|
||||
events {}
|
||||
|
||||
http {
|
||||
log_format main '$ipscrub_salted_hash_debug';
|
||||
|
||||
access_log logs/access.log main;
|
||||
|
||||
ipscrub_period_seconds 2;
|
||||
|
||||
server {
|
||||
listen 8081;
|
||||
# listen [::]:8081 ipv6only=off;
|
||||
server_name localhost;
|
||||
}
|
||||
}
|
17
ipscrub/test/saltedsha/test.sh
Normal file
17
ipscrub/test/saltedsha/test.sh
Normal file
|
@ -0,0 +1,17 @@
|
|||
red=$'\e[1;31m'
|
||||
grn=$'\e[1;32m'
|
||||
end=$'\e[0m'
|
||||
|
||||
salt="SALT"
|
||||
input="abcdef"
|
||||
|
||||
curl "http://localhost:8081/$salt$input" > /dev/null 2> /dev/null
|
||||
output=$(tail -n 1 dest/logs/access.log)
|
||||
|
||||
# -n excludes newline
|
||||
# cut -c-40 takes first 40 chars (shasum outputs 160 bits in hex)
|
||||
# xxd converts hex to binary
|
||||
# base64 converts binary to ascii
|
||||
clihash=$(echo -n "$input$salt" | shasum | cut -c-40 | xxd -r -p | base64)
|
||||
|
||||
[[ $clihash == $output ]] && printf "%s\n" "${grn}PASS${end}" || printf "%s\n" "${red}FAIL${end}"
|
18
ipscrub/test/sha1hash/nginx.conf
Normal file
18
ipscrub/test/sha1hash/nginx.conf
Normal file
|
@ -0,0 +1,18 @@
|
|||
|
||||
error_log logs/error.log;
|
||||
|
||||
events {}
|
||||
|
||||
http {
|
||||
log_format main '$ipscrub_hash_debug';
|
||||
|
||||
access_log logs/access.log main;
|
||||
|
||||
ipscrub_period_seconds 2;
|
||||
|
||||
server {
|
||||
listen 8081;
|
||||
# listen [::]:8081 ipv6only=off;
|
||||
server_name localhost;
|
||||
}
|
||||
}
|
16
ipscrub/test/sha1hash/test.sh
Normal file
16
ipscrub/test/sha1hash/test.sh
Normal file
|
@ -0,0 +1,16 @@
|
|||
red=$'\e[1;31m'
|
||||
grn=$'\e[1;32m'
|
||||
end=$'\e[0m'
|
||||
|
||||
input="asdf"
|
||||
|
||||
curl "http://localhost:8081/$input" > /dev/null 2> /dev/null
|
||||
output=$(tail -n 1 dest/logs/access.log)
|
||||
|
||||
# -n excludes newline
|
||||
# cut -c-40 takes first 40 chars (shasum outputs 160 bits in hex)
|
||||
# xxd converts hex to binary
|
||||
# base64 converts binary to ascii
|
||||
clihash=$(echo -n "/$input" | shasum | cut -c-40 | xxd -r -p | base64)
|
||||
|
||||
[[ $clihash == $output ]] && printf "%s\n" "${grn}PASS${end}" || printf "%s\n" "${red}FAIL${end}"
|
Loading…
Add table
Add a link
Reference in a new issue