wafris 1.1.2 → 1.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/wafris/configuration.rb +6 -11
- data/lib/wafris/log_suppressor.rb +4 -0
- data/lib/wafris/middleware.rb +3 -1
- data/lib/wafris/version.rb +1 -1
- data/lib/wafris.rb +13 -12
- metadata +17 -42
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6600b4667202df4429e13018d9eb1bdc0473029ad20dd5052e993f8390f06330
|
4
|
+
data.tar.gz: a4cf7a7781a19b03aa2c6389e24093b69f8b448c49beff1ddf798de9e9c97ef0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8eef758330be30b532d5b069df5db72d7bbbf8e98d277fe3cacc6842e8d01c997fcb1532810467497a2c87864f809b9fd83a0f13bfeef91a0503bfceace2f893
|
7
|
+
data.tar.gz: 0da7423796d0eb18d0d21d6ccda75555fe7042e1d5d999b539bfb13bde301d17b581b2b399faa122afc4e3acb32c567d5426cb04326dff34a81271319e341fd2
|
data/lib/wafris/configuration.rb
CHANGED
@@ -6,18 +6,11 @@ module Wafris
|
|
6
6
|
class Configuration
|
7
7
|
attr_accessor :redis
|
8
8
|
attr_accessor :redis_pool_size
|
9
|
+
attr_accessor :maxmemory
|
9
10
|
|
10
11
|
def initialize
|
11
|
-
@redis = Redis.new(
|
12
|
-
url: ENV['REDIS_URL'],
|
13
|
-
ssl_params: { verify_mode: OpenSSL::SSL::VERIFY_NONE }
|
14
|
-
)
|
15
12
|
@redis_pool_size = 20
|
16
|
-
|
17
|
-
puts "[Wafris] attempting firewall connection via REDIS_URL." unless LogSuppressor.suppress_logs?
|
18
|
-
create_settings
|
19
|
-
rescue Redis::CannotConnectError
|
20
|
-
puts "[Wafris] firewall disabled. Cannot connect to REDIS_URL. Will attempt Wafris.configure if it exists." unless LogSuppressor.suppress_logs?
|
13
|
+
@maxmemory = 25
|
21
14
|
end
|
22
15
|
|
23
16
|
def connection_pool
|
@@ -29,8 +22,10 @@ module Wafris
|
|
29
22
|
redis.hset('waf-settings',
|
30
23
|
'version', Wafris::VERSION,
|
31
24
|
'client', 'ruby',
|
32
|
-
'
|
33
|
-
|
25
|
+
'maxmemory', @maxmemory)
|
26
|
+
LogSuppressor.puts_log(
|
27
|
+
"[Wafris] firewall enabled. Connected to Redis. Ready to process requests. Set rules at: https://wafris.org/hub"
|
28
|
+
)
|
34
29
|
end
|
35
30
|
|
36
31
|
def core_sha
|
data/lib/wafris/middleware.rb
CHANGED
@@ -33,7 +33,9 @@ module Wafris
|
|
33
33
|
[403, {}, ['Blocked']]
|
34
34
|
end
|
35
35
|
rescue StandardError => e
|
36
|
-
|
36
|
+
LogSuppressor.puts_log(
|
37
|
+
"[Wafris] Redis connection error: #{e.message}. Request passed without rules check."
|
38
|
+
)
|
37
39
|
@app.call(env)
|
38
40
|
end
|
39
41
|
end
|
data/lib/wafris/version.rb
CHANGED
data/lib/wafris.rb
CHANGED
@@ -12,20 +12,21 @@ require 'wafris/railtie' if defined?(Rails::Railtie)
|
|
12
12
|
|
13
13
|
module Wafris
|
14
14
|
class << self
|
15
|
-
|
16
|
-
yield configuration
|
17
|
-
puts "[Wafris] attempting firewall connection via Wafris.configure initializer." unless LogSuppressor.suppress_logs?
|
18
|
-
configuration.create_settings
|
19
|
-
rescue Redis::CannotConnectError
|
20
|
-
puts "[Wafris] firewall disabled. Cannot connect via Wafris.configure. Please check your configuration settings." unless LogSuppressor.suppress_logs?
|
21
|
-
end
|
15
|
+
attr_accessor :configuration
|
22
16
|
|
23
|
-
def
|
24
|
-
|
25
|
-
end
|
17
|
+
def configure
|
18
|
+
raise ArgumentError, "[Wafris] block is required to configure Wafris" unless block_given?
|
26
19
|
|
27
|
-
|
28
|
-
|
20
|
+
self.configuration ||= Wafris::Configuration.new
|
21
|
+
yield(configuration)
|
22
|
+
LogSuppressor.puts_log(
|
23
|
+
"[Wafris] attempting firewall connection via Wafris.configure initializer."
|
24
|
+
)
|
25
|
+
configuration.create_settings
|
26
|
+
rescue Redis::CannotConnectError, ArgumentError
|
27
|
+
LogSuppressor.puts_log(
|
28
|
+
"[Wafris] firewall disabled. Cannot connect via Wafris.configure. Please check your configuration settings."
|
29
|
+
)
|
29
30
|
end
|
30
31
|
|
31
32
|
def allow_request?(request)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wafris
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Micahel Buckbee
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2023-09-
|
12
|
+
date: 2023-09-22 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: connection_pool
|
@@ -49,9 +49,6 @@ dependencies:
|
|
49
49
|
name: redis
|
50
50
|
requirement: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - "~>"
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: '4.8'
|
55
52
|
- - ">="
|
56
53
|
- !ruby/object:Gem::Version
|
57
54
|
version: 4.8.0
|
@@ -59,9 +56,6 @@ dependencies:
|
|
59
56
|
prerelease: false
|
60
57
|
version_requirements: !ruby/object:Gem::Requirement
|
61
58
|
requirements:
|
62
|
-
- - "~>"
|
63
|
-
- !ruby/object:Gem::Version
|
64
|
-
version: '4.8'
|
65
59
|
- - ">="
|
66
60
|
- !ruby/object:Gem::Version
|
67
61
|
version: 4.8.0
|
@@ -103,82 +97,58 @@ dependencies:
|
|
103
97
|
name: rack-test
|
104
98
|
requirement: !ruby/object:Gem::Requirement
|
105
99
|
requirements:
|
106
|
-
- - "~>"
|
107
|
-
- !ruby/object:Gem::Version
|
108
|
-
version: '2.0'
|
109
100
|
- - ">="
|
110
101
|
- !ruby/object:Gem::Version
|
111
|
-
version:
|
102
|
+
version: '0.6'
|
112
103
|
type: :development
|
113
104
|
prerelease: false
|
114
105
|
version_requirements: !ruby/object:Gem::Requirement
|
115
106
|
requirements:
|
116
|
-
- - "~>"
|
117
|
-
- !ruby/object:Gem::Version
|
118
|
-
version: '2.0'
|
119
107
|
- - ">="
|
120
108
|
- !ruby/object:Gem::Version
|
121
|
-
version:
|
109
|
+
version: '0.6'
|
122
110
|
- !ruby/object:Gem::Dependency
|
123
111
|
name: rails
|
124
112
|
requirement: !ruby/object:Gem::Requirement
|
125
113
|
requirements:
|
126
|
-
- - "~>"
|
127
|
-
- !ruby/object:Gem::Version
|
128
|
-
version: '7.0'
|
129
114
|
- - ">="
|
130
115
|
- !ruby/object:Gem::Version
|
131
|
-
version:
|
116
|
+
version: '5.0'
|
132
117
|
type: :development
|
133
118
|
prerelease: false
|
134
119
|
version_requirements: !ruby/object:Gem::Requirement
|
135
120
|
requirements:
|
136
|
-
- - "~>"
|
137
|
-
- !ruby/object:Gem::Version
|
138
|
-
version: '7.0'
|
139
121
|
- - ">="
|
140
122
|
- !ruby/object:Gem::Version
|
141
|
-
version:
|
123
|
+
version: '5.0'
|
142
124
|
- !ruby/object:Gem::Dependency
|
143
125
|
name: railties
|
144
126
|
requirement: !ruby/object:Gem::Requirement
|
145
127
|
requirements:
|
146
|
-
- - "~>"
|
147
|
-
- !ruby/object:Gem::Version
|
148
|
-
version: '7.0'
|
149
128
|
- - ">="
|
150
129
|
- !ruby/object:Gem::Version
|
151
|
-
version:
|
130
|
+
version: '5.0'
|
152
131
|
type: :development
|
153
132
|
prerelease: false
|
154
133
|
version_requirements: !ruby/object:Gem::Requirement
|
155
134
|
requirements:
|
156
|
-
- - "~>"
|
157
|
-
- !ruby/object:Gem::Version
|
158
|
-
version: '7.0'
|
159
135
|
- - ">="
|
160
136
|
- !ruby/object:Gem::Version
|
161
|
-
version:
|
137
|
+
version: '5.0'
|
162
138
|
- !ruby/object:Gem::Dependency
|
163
139
|
name: rake
|
164
140
|
requirement: !ruby/object:Gem::Requirement
|
165
141
|
requirements:
|
166
|
-
- - "~>"
|
167
|
-
- !ruby/object:Gem::Version
|
168
|
-
version: '13.0'
|
169
142
|
- - ">="
|
170
143
|
- !ruby/object:Gem::Version
|
171
|
-
version:
|
144
|
+
version: '12.0'
|
172
145
|
type: :development
|
173
146
|
prerelease: false
|
174
147
|
version_requirements: !ruby/object:Gem::Requirement
|
175
148
|
requirements:
|
176
|
-
- - "~>"
|
177
|
-
- !ruby/object:Gem::Version
|
178
|
-
version: '13.0'
|
179
149
|
- - ">="
|
180
150
|
- !ruby/object:Gem::Version
|
181
|
-
version:
|
151
|
+
version: '12.0'
|
182
152
|
description:
|
183
153
|
email:
|
184
154
|
executables: []
|
@@ -196,8 +166,13 @@ homepage:
|
|
196
166
|
licenses:
|
197
167
|
- Elastic-2.0
|
198
168
|
metadata: {}
|
199
|
-
post_install_message:
|
200
|
-
|
169
|
+
post_install_message: |2+
|
170
|
+
Thank you for installing the wafris gem.
|
171
|
+
|
172
|
+
If you haven't already, please sign up for Wafris Hub at:
|
173
|
+
|
174
|
+
https://wafris.org
|
175
|
+
|
201
176
|
rdoc_options: []
|
202
177
|
require_paths:
|
203
178
|
- lib
|