Adds support for libMaxMind

This commit is contained in:
Felipe Zimmerle
2018-03-21 19:48:52 -03:00
parent 7bff76d794
commit df169ea108
20 changed files with 845 additions and 115 deletions

View File

@@ -3,7 +3,7 @@
"enabled":1,
"version_min":300000,
"resource":"geoip",
"title":"Testing Variables :: GEO:LONGITUDE",
"title":"Testing Variables :: GEO:LONGITUDE [GeoIP]",
"client":{
"ip":"64.17.254.216",
"port":123
@@ -44,8 +44,8 @@
{
"enabled":1,
"version_min":300000,
"resource":"geoip",
"title":"Testing Variables :: GEO:COUNTRY_NAME",
"resource":"maxmind",
"title":"Testing Variables :: GEO:COUNTRY_NAME [maxmind]",
"client":{
"ip":"64.17.254.216",
"port":123
@@ -78,7 +78,7 @@
},
"rules":[
"SecRuleEngine On",
"SecGeoLookupDb test-cases\/data\/geo\/GeoIPCity.dat",
"SecGeoLookupDb test-cases\/data\/geo\/GeoLite2-City.mmdb",
"SecRule REMOTE_ADDR \"@geoLookup\" \"id:1,pass,t:trim\"",
"SecRule GEO \"@contains test \" \"id:2,pass,t:trim\""
]
@@ -87,7 +87,7 @@
"enabled":1,
"version_min":300000,
"resource":"geoip",
"title":"Testing Variables :: GEO:LATITUDE",
"title":"Testing Variables :: GEO:LATITUDE [GeoIP]",
"client":{
"ip":"64.17.254.216",
"port":123
@@ -129,7 +129,7 @@
"enabled":1,
"version_min":300000,
"resource":"geoip",
"title":"Testing Variables :: GEO:COUNTRY_CODE3",
"title":"Testing Variables :: GEO:COUNTRY_CODE3 [GeoIP]",
"client":{
"ip":"64.17.254.216",
"port":123
@@ -171,7 +171,7 @@
"enabled":1,
"version_min":300000,
"resource":"geoip",
"title":"Testing Variables :: GEO:COUNTRY_CODE",
"title":"Testing Variables :: GEO:COUNTRY_CODE [GeoIP]",
"client":{
"ip":"64.17.254.216",
"port":123
@@ -213,7 +213,7 @@
"enabled":1,
"version_min":300000,
"resource":"geoip",
"title":"Testing Variables :: GEO:COUNTRY_CONTINENT",
"title":"Testing Variables :: GEO:COUNTRY_CONTINENT [GeoIP]",
"client":{
"ip":"64.17.254.216",
"port":123
@@ -255,7 +255,7 @@
"enabled":1,
"version_min":300000,
"resource":"geoip",
"title":"Testing Variables :: GEO:AREA_CODE",
"title":"Testing Variables :: GEO:AREA_CODE [GeoIP]",
"client":{
"ip":"64.17.254.216",
"port":123
@@ -297,7 +297,7 @@
"enabled":1,
"version_min":300000,
"resource":"geoip",
"title":"Testing Variables :: GEO:DMA_CODE",
"title":"Testing Variables :: GEO:DMA_CODE [GeoIP]",
"client":{
"ip":"64.17.254.216",
"port":123
@@ -339,7 +339,7 @@
"enabled":1,
"version_min":300000,
"resource":"geoip",
"title":"Testing Variables :: GEO:POSTAL_CODE",
"title":"Testing Variables :: GEO:POSTAL_CODE [GeoIP]",
"client":{
"ip":"64.17.254.216",
"port":123
@@ -381,7 +381,7 @@
"enabled":1,
"version_min":300000,
"resource":"geoip",
"title":"Testing Variables :: GEO:REGION",
"title":"Testing Variables :: GEO:REGION [GeoIP]",
"client":{
"ip":"64.17.254.216",
"port":123
@@ -423,7 +423,7 @@
"enabled":1,
"version_min":300000,
"resource":"geoip",
"title":"Testing Variables :: GEO:CITY",
"title":"Testing Variables :: GEO:CITY [GeoIP]",
"client":{
"ip":"64.17.254.216",
"port":123
@@ -460,6 +460,301 @@
"SecRule REMOTE_ADDR \"@geoLookup\" \"id:1,pass,t:trim\"",
"SecRule GEO \"@contains test \" \"id:2,pass,t:trim\""
]
},
{
"enabled":1,
"version_min":300000,
"resource":"geoip",
"title":"Testing Variables :: GEO:LONGITUDE [GeoIP]",
"client":{
"ip":"64.17.254.216",
"port":123
},
"server":{
"ip":"200.249.12.31",
"port":80
},
"request":{
"headers":{
"Host":"localhost",
"User-Agent":"curl/7.38.0",
"Accept":"*/*"
},
"uri":"/?key=value&key=other_value",
"method":"GET"
},
"response":{
"headers":{
"Date":"Mon, 13 Jul 2015 20:02:41 GMT",
"Last-Modified":"Sun, 26 Oct 2014 22:33:37 GMT",
"Content-Type":"text/html"
},
"body":[
"no need."
]
},
"expected":{
"debug_log":"Target value: \"-118.403999\" \\(Variable: GEO:LONGITUDE\\)"
},
"rules":[
"SecRuleEngine On",
"SecGeoLookupDb test-cases\/data\/geo\/GeoIPCity.dat",
"SecRule REMOTE_ADDR \"@geoLookup\" \"id:1,pass,t:trim\"",
"SecRule GEO \"@contains test \" \"id:2,pass,t:trim\""
]
},
{
"enabled":1,
"version_min":300000,
"resource":"maxmind",
"title":"Testing Variables :: GEO:COUNTRY_NAME [maxmind]",
"client":{
"ip":"64.17.254.216",
"port":123
},
"server":{
"ip":"200.249.12.31",
"port":80
},
"request":{
"headers":{
"Host":"localhost",
"User-Agent":"curl/7.38.0",
"Accept":"*/*"
},
"uri":"/?key=value&key=other_value",
"method":"GET"
},
"response":{
"headers":{
"Date":"Mon, 13 Jul 2015 20:02:41 GMT",
"Last-Modified":"Sun, 26 Oct 2014 22:33:37 GMT",
"Content-Type":"text/html"
},
"body":[
"no need."
]
},
"expected":{
"debug_log":"Target value: \"United States\" \\(Variable: GEO:COUNTRY_NAME\\)"
},
"rules":[
"SecRuleEngine On",
"SecGeoLookupDb test-cases\/data\/geo\/GeoLite2-City.mmdb",
"SecRule REMOTE_ADDR \"@geoLookup\" \"id:1,pass,t:trim\"",
"SecRule GEO \"@contains test \" \"id:2,pass,t:trim\""
]
},
{
"enabled":1,
"version_min":300000,
"resource":"maxmind",
"title":"Testing Variables :: GEO:LATITUDE [maxmind]",
"client":{
"ip":"64.17.254.216",
"port":123
},
"server":{
"ip":"200.249.12.31",
"port":80
},
"request":{
"headers":{
"Host":"localhost",
"User-Agent":"curl/7.38.0",
"Accept":"*/*"
},
"uri":"/?key=value&key=other_value",
"method":"GET"
},
"response":{
"headers":{
"Date":"Mon, 13 Jul 2015 20:02:41 GMT",
"Last-Modified":"Sun, 26 Oct 2014 22:33:37 GMT",
"Content-Type":"text/html"
},
"body":[
"no need."
]
},
"expected":{
"debug_log":"Target value: \"41.517100\" \\(Variable: GEO:LATITUDE\\)"
},
"rules":[
"SecRuleEngine On",
"SecGeoLookupDb test-cases\/data\/geo\/GeoLite2-City.mmdb",
"SecRule REMOTE_ADDR \"@geoLookup\" \"id:1,pass,t:trim\"",
"SecRule GEO \"@contains test \" \"id:2,pass,t:trim\""
]
},
{
"enabled":1,
"version_min":300000,
"resource":"maxmind",
"title":"Testing Variables :: GEO:COUNTRY_CODE [maxmind]",
"client":{
"ip":"64.17.254.216",
"port":123
},
"server":{
"ip":"200.249.12.31",
"port":80
},
"request":{
"headers":{
"Host":"localhost",
"User-Agent":"curl/7.38.0",
"Accept":"*/*"
},
"uri":"/?key=value&key=other_value",
"method":"GET"
},
"response":{
"headers":{
"Date":"Mon, 13 Jul 2015 20:02:41 GMT",
"Last-Modified":"Sun, 26 Oct 2014 22:33:37 GMT",
"Content-Type":"text/html"
},
"body":[
"no need."
]
},
"expected":{
"debug_log":"Target value: \"US\" \\(Variable: GEO:COUNTRY_CODE\\)"
},
"rules":[
"SecRuleEngine On",
"SecGeoLookupDb test-cases\/data\/geo\/GeoLite2-City.mmdb",
"SecRule REMOTE_ADDR \"@geoLookup\" \"id:1,pass,t:trim\"",
"SecRule GEO \"@contains test \" \"id:2,pass,t:trim\""
]
},
{
"enabled":1,
"version_min":300000,
"resource":"maxmind",
"title":"Testing Variables :: GEO:COUNTRY_CONTINENT [maxmind]",
"client":{
"ip":"64.17.254.216",
"port":123
},
"server":{
"ip":"200.249.12.31",
"port":80
},
"request":{
"headers":{
"Host":"localhost",
"User-Agent":"curl/7.38.0",
"Accept":"*/*"
},
"uri":"/?key=value&key=other_value",
"method":"GET"
},
"response":{
"headers":{
"Date":"Mon, 13 Jul 2015 20:02:41 GMT",
"Last-Modified":"Sun, 26 Oct 2014 22:33:37 GMT",
"Content-Type":"text/html"
},
"body":[
"no need."
]
},
"expected":{
"debug_log":"Target value: \"North America\" \\(Variable: GEO:COUNTRY_CONTINENT\\)"
},
"rules":[
"SecRuleEngine On",
"SecGeoLookupDb test-cases\/data\/geo\/GeoLite2-City.mmdb",
"SecRule REMOTE_ADDR \"@geoLookup\" \"id:1,pass,t:trim\"",
"SecRule GEO \"@contains test \" \"id:2,pass,t:trim\""
]
},
{
"enabled":1,
"version_min":300000,
"resource":"maxmind",
"title":"Testing Variables :: GEO:POSTAL_CODE [maxmind]",
"client":{
"ip":"64.17.254.216",
"port":123
},
"server":{
"ip":"200.249.12.31",
"port":80
},
"request":{
"headers":{
"Host":"localhost",
"User-Agent":"curl/7.38.0",
"Accept":"*/*"
},
"uri":"/?key=value&key=other_value",
"method":"GET"
},
"response":{
"headers":{
"Date":"Mon, 13 Jul 2015 20:02:41 GMT",
"Last-Modified":"Sun, 26 Oct 2014 22:33:37 GMT",
"Content-Type":"text/html"
},
"body":[
"no need."
]
},
"expected":{
"debug_log":"Target value: \"02842\" \\(Variable: GEO:POSTAL_CODE\\)"
},
"rules":[
"SecRuleEngine On",
"SecGeoLookupDb test-cases\/data\/geo\/GeoLite2-City.mmdb",
"SecRule REMOTE_ADDR \"@geoLookup\" \"id:1,pass,t:trim\"",
"SecRule GEO \"@contains test \" \"id:2,pass,t:trim\""
]
},
{
"enabled":1,
"version_min":300000,
"resource":"maxmind",
"title":"Testing Variables :: GEO:CITY [maxmind]",
"client":{
"ip":"64.17.254.216",
"port":123
},
"server":{
"ip":"200.249.12.31",
"port":80
},
"request":{
"headers":{
"Host":"localhost",
"User-Agent":"curl/7.38.0",
"Accept":"*/*"
},
"uri":"/?key=value&key=other_value",
"method":"GET"
},
"response":{
"headers":{
"Date":"Mon, 13 Jul 2015 20:02:41 GMT",
"Last-Modified":"Sun, 26 Oct 2014 22:33:37 GMT",
"Content-Type":"text/html"
},
"body":[
"no need."
]
},
"expected":{
"debug_log":"Target value: \"Middletown\" \\(Variable: GEO:CITY\\)"
},
"rules":[
"SecRuleEngine On",
"SecGeoLookupDb test-cases\/data\/geo\/GeoLite2-City.mmdb",
"SecRule REMOTE_ADDR \"@geoLookup\" \"id:1,pass,t:trim\"",
"SecRule GEO \"@contains test \" \"id:2,pass,t:trim\""
]
}
]