wafris 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/wafris/version.rb +1 -1
- data/lib/wafris.rb +4 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 385a05bd3deaf1dc68fb7903efa873163c6c79deb6bd6e6411e4fa4985e94dc5
|
4
|
+
data.tar.gz: a27af04abc69ff0f06ba1145ae811b46fa9ea977b1d4811609f401e4777a3caa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0fcbf5d4efab9151175102f9872216e2ae6c7d210e666d2244d662fbe5cfd659cb74bf0357ccb3940c662d9d5659079eddf9b5438640ebb54b932841fdbec7a6
|
7
|
+
data.tar.gz: a299eb94aad34f481125c4aa33602d0196d0fcaca9acc682c181d59d144a982253d39207fb00c9bdf09879f30eebd0c5328026dc06bfde88d9da1fef7ff43463
|
data/lib/wafris/version.rb
CHANGED
data/lib/wafris.rb
CHANGED
@@ -32,6 +32,8 @@ module Wafris
|
|
32
32
|
def allow_request?(request)
|
33
33
|
configuration.connection_pool.with do |conn|
|
34
34
|
time = Time.now.to_f * 1000
|
35
|
+
puts "WAF LOG: headers with x-forwarded-for key #{request.get_header('x-forwarded-for')}"
|
36
|
+
puts "WAF LOG: headers with http-x-forwarded-for key #{request.get_header('HTTP_X_FORWARDED_FOR')}"
|
35
37
|
puts "WAF LOG: Client IP #{client_ip(request)}"
|
36
38
|
puts "WAF LOG: Proxy IP #{proxy_ip(request)}"
|
37
39
|
status = conn.evalsha(
|
@@ -58,13 +60,13 @@ module Wafris
|
|
58
60
|
private
|
59
61
|
|
60
62
|
def client_ip(request)
|
61
|
-
return request.ip if request.
|
63
|
+
return request.ip if request.get_header('x-forwarded-for').nil?
|
62
64
|
|
63
65
|
request.headers['x-forwarded-for'].split(',').first
|
64
66
|
end
|
65
67
|
|
66
68
|
def proxy_ip(request)
|
67
|
-
return nil if request.
|
69
|
+
return nil if request.get_header('x-forwarded-for').nil?
|
68
70
|
|
69
71
|
request.headers['x-forwarded-for'].split(',').last
|
70
72
|
end
|