soar_auditing_provider 0.7.0 → 0.9.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.codeclimate.yml +19 -0
- data/.gitignore +2 -0
- data/.rubocop.yml +1156 -0
- data/.ruby-version +1 -1
- data/LICENSE.txt +1 -1
- data/README.md +146 -59
- data/lib/soar_auditing_provider/auditing_overflow_error.rb +4 -0
- data/lib/soar_auditing_provider/auditing_provider.rb +150 -0
- data/lib/soar_auditing_provider/auditing_worker.rb +153 -0
- data/lib/soar_auditing_provider/version.rb +1 -1
- data/lib/soar_auditing_provider.rb +3 -2
- data/sanity/.ruby-version +1 -1
- data/sanity/Gemfile +2 -1
- data/sanity/sanity.rb +50 -13
- data/soar_auditing_provider.gemspec +20 -12
- metadata +116 -13
- data/.travis.yml +0 -4
- data/lib/soar_auditing_provider/auditing_provider_api.rb +0 -61
- data/lib/soar_auditing_provider/nfr_match_error.rb +0 -4
@@ -1,6 +1,7 @@
|
|
1
1
|
require "soar_auditing_provider/version"
|
2
|
-
require 'soar_auditing_provider/
|
3
|
-
require 'soar_auditing_provider/
|
2
|
+
require 'soar_auditing_provider/auditing_overflow_error'
|
3
|
+
require 'soar_auditing_provider/auditing_worker'
|
4
|
+
require 'soar_auditing_provider/auditing_provider'
|
4
5
|
|
5
6
|
module SoarAuditingProvider
|
6
7
|
end
|
data/sanity/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
ruby-2.
|
1
|
+
ruby-2.3.0
|
data/sanity/Gemfile
CHANGED
data/sanity/sanity.rb
CHANGED
@@ -1,22 +1,59 @@
|
|
1
|
-
require 'log4r'
|
2
1
|
require 'soar_auditing_provider'
|
2
|
+
require 'log4r_auditor'
|
3
|
+
require 'soar_flow'
|
3
4
|
|
4
5
|
class Main
|
5
|
-
|
6
|
-
|
6
|
+
|
7
|
+
AUDITING_CONFIGURATION = {
|
8
|
+
'auditing' => {
|
9
|
+
'level' => 'debug',
|
10
|
+
'install_exit_handler' => 'true',
|
11
|
+
'queue_worker' => {
|
12
|
+
'queue_size' => 1000,
|
13
|
+
'initial_back_off_in_seconds' => 1,
|
14
|
+
'back_off_multiplier' => 2,
|
15
|
+
'back_off_attempts' => 5
|
16
|
+
},
|
17
|
+
'default_nfrs' => {
|
18
|
+
'accessibility' => 'local',
|
19
|
+
'privacy' => 'not encrypted',
|
20
|
+
'reliability' => 'instance',
|
21
|
+
'performance' => 'high'
|
22
|
+
},
|
23
|
+
'auditors' => {
|
24
|
+
'log4r' => {
|
25
|
+
'adaptor' => 'Log4rAuditor::Log4rAuditor',
|
26
|
+
'file_name' => 'soar_sc.log',
|
27
|
+
'standard_stream' => 'stdout',
|
28
|
+
'nfrs' => {
|
29
|
+
'accessibility' => 'local',
|
30
|
+
'privacy' => 'not encrypted',
|
31
|
+
'reliability' => 'instance',
|
32
|
+
'performance' => 'high'
|
33
|
+
}
|
34
|
+
}
|
35
|
+
}
|
36
|
+
}
|
37
|
+
}
|
38
|
+
|
7
39
|
def test_sanity
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
40
|
+
#create and configure auditing instance
|
41
|
+
myauditing = SoarAuditingProvider::AuditingProvider.new( AUDITING_CONFIGURATION['auditing'] )
|
42
|
+
myauditing.instance_flow_identifier = SoarFlow::ID::generate_flow_id
|
43
|
+
myauditing.service_identifier = 'my-test-service.com'
|
44
|
+
|
45
|
+
#associate a set of auditing entries with a flow by generating a flow identifiers
|
46
|
+
flow_id = SoarFlow::ID::generate_flow_id
|
47
|
+
|
48
|
+
#generate audit events
|
12
49
|
some_debug_object = 123
|
13
|
-
|
14
|
-
|
50
|
+
myauditing.info("This is info",flow_id)
|
51
|
+
myauditing.debug(some_debug_object,flow_id)
|
15
52
|
dropped = 95
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
53
|
+
myauditing.warn("Statistics show that dropped packets have increased to #{dropped}%",flow_id)
|
54
|
+
myauditing.error("Could not resend some dropped packets. They have been lost. All is still OK, I could compensate",flow_id)
|
55
|
+
myauditing.fatal("Unable to perform action, too many dropped packets. Functional degradation.",flow_id)
|
56
|
+
myauditing << 'Rack::CommonLogger requires this'
|
20
57
|
end
|
21
58
|
end
|
22
59
|
|
@@ -4,22 +4,30 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
4
|
require 'soar_auditing_provider/version'
|
5
5
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
|
-
spec.name =
|
7
|
+
spec.name = 'soar_auditing_provider'
|
8
8
|
spec.version = SoarAuditingProvider::VERSION
|
9
|
-
spec.authors = [
|
10
|
-
spec.email = [
|
9
|
+
spec.authors = ['Ernst van Graan', 'Barney de Villiers']
|
10
|
+
spec.email = ['ernst.van.graan@hetzner.co.za', 'barney.de.villiers@hetzner.co.za']
|
11
11
|
|
12
|
-
spec.summary = %q{
|
13
|
-
spec.description = %q{
|
14
|
-
spec.license =
|
12
|
+
spec.summary = %q{SOAR architecture auditing provider}
|
13
|
+
spec.description = %q{SOAR architecture auditing provider extending from auditing provider API}
|
14
|
+
spec.license = 'MIT'
|
15
15
|
|
16
16
|
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
17
|
-
spec.bindir =
|
17
|
+
spec.bindir = 'exe'
|
18
18
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
19
|
-
spec.require_paths = [
|
19
|
+
spec.require_paths = ['lib']
|
20
20
|
|
21
|
-
spec.add_development_dependency
|
22
|
-
spec.add_development_dependency
|
23
|
-
spec.add_development_dependency
|
24
|
-
spec.add_development_dependency
|
21
|
+
spec.add_development_dependency 'bundler', '~> 1.11'
|
22
|
+
spec.add_development_dependency 'rake', '~> 10.0'
|
23
|
+
spec.add_development_dependency 'rspec', '~> 3.0'
|
24
|
+
spec.add_development_dependency 'byebug', '~> 9.0.5'
|
25
|
+
spec.add_development_dependency 'log4r_auditor', '~> 0.0.4'
|
26
|
+
spec.add_development_dependency 'soar_flow', '~> 0.1.1'
|
27
|
+
spec.add_development_dependency 'soar_xt', '~> 0.0.3'
|
28
|
+
|
29
|
+
spec.add_dependency 'soar_auditing_provider_api', '~> 0.9.0'
|
30
|
+
spec.add_dependency 'soar_auditing_format', '~> 0.0.5'
|
31
|
+
spec.add_dependency 'soar_thread_worker', '~> 0.1'
|
32
|
+
spec.add_dependency 'soar_configured_factory', '~> 0.1.0'
|
25
33
|
end
|
metadata
CHANGED
@@ -1,14 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: soar_auditing_provider
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.9.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
- Ernst
|
7
|
+
- Ernst van Graan
|
8
|
+
- Barney de Villiers
|
8
9
|
autorequire:
|
9
10
|
bindir: exe
|
10
11
|
cert_chain: []
|
11
|
-
date: 2016-
|
12
|
+
date: 2016-08-04 00:00:00.000000000 Z
|
12
13
|
dependencies:
|
13
14
|
- !ruby/object:Gem::Dependency
|
14
15
|
name: bundler
|
@@ -56,28 +57,129 @@ dependencies:
|
|
56
57
|
name: byebug
|
57
58
|
requirement: !ruby/object:Gem::Requirement
|
58
59
|
requirements:
|
59
|
-
- - "
|
60
|
+
- - "~>"
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: 9.0.5
|
63
|
+
type: :development
|
64
|
+
prerelease: false
|
65
|
+
version_requirements: !ruby/object:Gem::Requirement
|
66
|
+
requirements:
|
67
|
+
- - "~>"
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: 9.0.5
|
70
|
+
- !ruby/object:Gem::Dependency
|
71
|
+
name: log4r_auditor
|
72
|
+
requirement: !ruby/object:Gem::Requirement
|
73
|
+
requirements:
|
74
|
+
- - "~>"
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: 0.0.4
|
77
|
+
type: :development
|
78
|
+
prerelease: false
|
79
|
+
version_requirements: !ruby/object:Gem::Requirement
|
80
|
+
requirements:
|
81
|
+
- - "~>"
|
82
|
+
- !ruby/object:Gem::Version
|
83
|
+
version: 0.0.4
|
84
|
+
- !ruby/object:Gem::Dependency
|
85
|
+
name: soar_flow
|
86
|
+
requirement: !ruby/object:Gem::Requirement
|
87
|
+
requirements:
|
88
|
+
- - "~>"
|
60
89
|
- !ruby/object:Gem::Version
|
61
|
-
version:
|
90
|
+
version: 0.1.1
|
62
91
|
type: :development
|
63
92
|
prerelease: false
|
64
93
|
version_requirements: !ruby/object:Gem::Requirement
|
65
94
|
requirements:
|
66
|
-
- - "
|
95
|
+
- - "~>"
|
96
|
+
- !ruby/object:Gem::Version
|
97
|
+
version: 0.1.1
|
98
|
+
- !ruby/object:Gem::Dependency
|
99
|
+
name: soar_xt
|
100
|
+
requirement: !ruby/object:Gem::Requirement
|
101
|
+
requirements:
|
102
|
+
- - "~>"
|
103
|
+
- !ruby/object:Gem::Version
|
104
|
+
version: 0.0.3
|
105
|
+
type: :development
|
106
|
+
prerelease: false
|
107
|
+
version_requirements: !ruby/object:Gem::Requirement
|
108
|
+
requirements:
|
109
|
+
- - "~>"
|
110
|
+
- !ruby/object:Gem::Version
|
111
|
+
version: 0.0.3
|
112
|
+
- !ruby/object:Gem::Dependency
|
113
|
+
name: soar_auditing_provider_api
|
114
|
+
requirement: !ruby/object:Gem::Requirement
|
115
|
+
requirements:
|
116
|
+
- - "~>"
|
117
|
+
- !ruby/object:Gem::Version
|
118
|
+
version: 0.9.0
|
119
|
+
type: :runtime
|
120
|
+
prerelease: false
|
121
|
+
version_requirements: !ruby/object:Gem::Requirement
|
122
|
+
requirements:
|
123
|
+
- - "~>"
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
version: 0.9.0
|
126
|
+
- !ruby/object:Gem::Dependency
|
127
|
+
name: soar_auditing_format
|
128
|
+
requirement: !ruby/object:Gem::Requirement
|
129
|
+
requirements:
|
130
|
+
- - "~>"
|
131
|
+
- !ruby/object:Gem::Version
|
132
|
+
version: 0.0.5
|
133
|
+
type: :runtime
|
134
|
+
prerelease: false
|
135
|
+
version_requirements: !ruby/object:Gem::Requirement
|
136
|
+
requirements:
|
137
|
+
- - "~>"
|
138
|
+
- !ruby/object:Gem::Version
|
139
|
+
version: 0.0.5
|
140
|
+
- !ruby/object:Gem::Dependency
|
141
|
+
name: soar_thread_worker
|
142
|
+
requirement: !ruby/object:Gem::Requirement
|
143
|
+
requirements:
|
144
|
+
- - "~>"
|
145
|
+
- !ruby/object:Gem::Version
|
146
|
+
version: '0.1'
|
147
|
+
type: :runtime
|
148
|
+
prerelease: false
|
149
|
+
version_requirements: !ruby/object:Gem::Requirement
|
150
|
+
requirements:
|
151
|
+
- - "~>"
|
152
|
+
- !ruby/object:Gem::Version
|
153
|
+
version: '0.1'
|
154
|
+
- !ruby/object:Gem::Dependency
|
155
|
+
name: soar_configured_factory
|
156
|
+
requirement: !ruby/object:Gem::Requirement
|
157
|
+
requirements:
|
158
|
+
- - "~>"
|
159
|
+
- !ruby/object:Gem::Version
|
160
|
+
version: 0.1.0
|
161
|
+
type: :runtime
|
162
|
+
prerelease: false
|
163
|
+
version_requirements: !ruby/object:Gem::Requirement
|
164
|
+
requirements:
|
165
|
+
- - "~>"
|
67
166
|
- !ruby/object:Gem::Version
|
68
|
-
version:
|
69
|
-
description:
|
167
|
+
version: 0.1.0
|
168
|
+
description: SOAR architecture auditing provider extending from auditing provider
|
169
|
+
API
|
70
170
|
email:
|
71
171
|
- ernst.van.graan@hetzner.co.za
|
172
|
+
- barney.de.villiers@hetzner.co.za
|
72
173
|
executables: []
|
73
174
|
extensions: []
|
74
175
|
extra_rdoc_files: []
|
75
176
|
files:
|
177
|
+
- ".codeclimate.yml"
|
76
178
|
- ".gitignore"
|
77
179
|
- ".rspec"
|
180
|
+
- ".rubocop.yml"
|
78
181
|
- ".ruby-gemset"
|
79
182
|
- ".ruby-version"
|
80
|
-
- ".travis.yml"
|
81
183
|
- Gemfile
|
82
184
|
- LICENSE.txt
|
83
185
|
- README.md
|
@@ -85,8 +187,9 @@ files:
|
|
85
187
|
- bin/console
|
86
188
|
- bin/setup
|
87
189
|
- lib/soar_auditing_provider.rb
|
88
|
-
- lib/soar_auditing_provider/
|
89
|
-
- lib/soar_auditing_provider/
|
190
|
+
- lib/soar_auditing_provider/auditing_overflow_error.rb
|
191
|
+
- lib/soar_auditing_provider/auditing_provider.rb
|
192
|
+
- lib/soar_auditing_provider/auditing_worker.rb
|
90
193
|
- lib/soar_auditing_provider/version.rb
|
91
194
|
- sanity/.gitignore
|
92
195
|
- sanity/.ruby-gemset
|
@@ -114,8 +217,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
114
217
|
version: '0'
|
115
218
|
requirements: []
|
116
219
|
rubyforge_project:
|
117
|
-
rubygems_version: 2.
|
220
|
+
rubygems_version: 2.5.1
|
118
221
|
signing_key:
|
119
222
|
specification_version: 4
|
120
|
-
summary:
|
223
|
+
summary: SOAR architecture auditing provider
|
121
224
|
test_files: []
|
data/.travis.yml
DELETED
@@ -1,61 +0,0 @@
|
|
1
|
-
module SoarAuditingProvider
|
2
|
-
class AuditingProviderAPI
|
3
|
-
DEFAULT = {} unless defined? DEFAULT; DEFAULT.freeze
|
4
|
-
|
5
|
-
attr_accessor :auditors
|
6
|
-
attr_accessor :auditor
|
7
|
-
|
8
|
-
def initialize(auditors)
|
9
|
-
raise ArgumentError.new("Invalid auditors provided") if not auditors.is_a?(Hash)
|
10
|
-
raise ArgumentError.new("No auditors provided") if auditors.nil? or auditors.empty?
|
11
|
-
@auditors = auditors
|
12
|
-
end
|
13
|
-
|
14
|
-
def debug(data)
|
15
|
-
@auditor.debug(data)
|
16
|
-
end
|
17
|
-
|
18
|
-
def <<(data)
|
19
|
-
@auditor.info(data)
|
20
|
-
end
|
21
|
-
|
22
|
-
def info(data)
|
23
|
-
@auditor.info(data)
|
24
|
-
end
|
25
|
-
|
26
|
-
def error(data)
|
27
|
-
@auditor.error(data)
|
28
|
-
end
|
29
|
-
|
30
|
-
def warn(data)
|
31
|
-
@auditor.warn(data)
|
32
|
-
end
|
33
|
-
|
34
|
-
def fatal(data)
|
35
|
-
@auditor.fatal(data)
|
36
|
-
end
|
37
|
-
|
38
|
-
def select(nfrs = DEFAULT)
|
39
|
-
if nfrs.nil? or nfrs.empty?
|
40
|
-
auditor_selected = auditors.keys.first
|
41
|
-
else
|
42
|
-
auditor_selected = nil
|
43
|
-
auditors.each do |auditor, configuration|
|
44
|
-
auditor_nfrs = configuration['nfrs']
|
45
|
-
nfrs_matched = true
|
46
|
-
nfrs.each do |nfr, value|
|
47
|
-
nfrs_matched = false if not auditor_nfrs[nfr] or (auditor_nfrs[nfr] != value)
|
48
|
-
end
|
49
|
-
if nfrs_matched
|
50
|
-
auditor_selected = auditor
|
51
|
-
break
|
52
|
-
end
|
53
|
-
end
|
54
|
-
raise NFRMatchError.new("Could not match NFRs to an auditor") if auditor_selected.nil?
|
55
|
-
end
|
56
|
-
configuration = auditors[auditor_selected]
|
57
|
-
@auditor = auditor_selected
|
58
|
-
return @auditor, configuration
|
59
|
-
end
|
60
|
-
end
|
61
|
-
end
|