soar_auditing_provider 0.9.3 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +9 -1
- data/lib/soar_auditing_provider/auditing_provider.rb +15 -7
- data/lib/soar_auditing_provider/version.rb +1 -1
- data/sanity/Gemfile +1 -1
- data/sanity/sanity_benchmark.rb +83 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4390d2df4df9f1cd83f6ca1b4c89666a8d04f6f7
|
4
|
+
data.tar.gz: f56c79fc2d8abbfa76cb3191c6a51768a41fbcd2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4d69636507b2a922cd24068f58f42271f25353230c6549838b44a276d1038e804f576a3b931df470e49fe96a9aa421c615697be63343981c158e171115777a77
|
7
|
+
data.tar.gz: c16d6398b32618d03bb1b9c94412068164c16062177ff30cf3c6aeaf852096ad710c7a78151731cc73eeacf9e3ddabc47ebe99947e0a255387fee377d6629544
|
data/README.md
CHANGED
@@ -51,7 +51,7 @@ Initialize and configure the provider.
|
|
51
51
|
```ruby
|
52
52
|
AUDITING_CONFIGURATION = {
|
53
53
|
'auditing' => {
|
54
|
-
'level' => '
|
54
|
+
'level' => 'info',
|
55
55
|
'queue_worker' => {
|
56
56
|
'queue_size' => 1000,
|
57
57
|
'initial_back_off_in_seconds' => 1,
|
@@ -121,6 +121,8 @@ class Main
|
|
121
121
|
AUDITING_CONFIGURATION = {
|
122
122
|
'auditing' => {
|
123
123
|
'level' => 'debug',
|
124
|
+
'install_exit_handler' => 'true',
|
125
|
+
'add_caller_source_location' => 'false',
|
124
126
|
'queue_worker' => {
|
125
127
|
'queue_size' => 1000,
|
126
128
|
'initial_back_off_in_seconds' => 1,
|
@@ -196,6 +198,12 @@ At present only the buffer overflow count is avialable:
|
|
196
198
|
{ 'audit_buffer_overflows' => 123 }
|
197
199
|
```
|
198
200
|
|
201
|
+
## Testing
|
202
|
+
|
203
|
+
Behavioural driven testing can be performed by testing so:
|
204
|
+
|
205
|
+
$ bundle exec rspec -cfd spec/*
|
206
|
+
|
199
207
|
## Contributing
|
200
208
|
|
201
209
|
Bug reports and feature requests are welcome by email to ernst dot van dot graan at hetzner dot co dot za. This gem is sponsored by Hetzner (Pty) Ltd (http://hetzner.co.za)
|
@@ -44,27 +44,27 @@ module SoarAuditingProvider
|
|
44
44
|
end
|
45
45
|
|
46
46
|
def debug(data, flow_identifier = nil)
|
47
|
-
enqueue(:debug, format(:debug, data, flow_identifier))
|
47
|
+
enqueue(:debug, format(:debug, prepend_caller_information(data), flow_identifier))
|
48
48
|
end
|
49
49
|
|
50
50
|
def info(data, flow_identifier = nil)
|
51
|
-
enqueue(:info, format(:info, data, flow_identifier))
|
51
|
+
enqueue(:info, format(:info, prepend_caller_information(data), flow_identifier))
|
52
52
|
end
|
53
53
|
|
54
54
|
def warn(data, flow_identifier = nil)
|
55
|
-
enqueue(:warn, format(:warn, data, flow_identifier))
|
55
|
+
enqueue(:warn, format(:warn, prepend_caller_information(data), flow_identifier))
|
56
56
|
end
|
57
57
|
|
58
58
|
def error(data, flow_identifier = nil)
|
59
|
-
enqueue(:error, format(:error, data, flow_identifier))
|
59
|
+
enqueue(:error, format(:error, prepend_caller_information(data), flow_identifier))
|
60
60
|
end
|
61
61
|
|
62
62
|
def fatal(data, flow_identifier = nil)
|
63
|
-
enqueue(:fatal, format(:fatal, data, flow_identifier))
|
63
|
+
enqueue(:fatal, format(:fatal, prepend_caller_information(data), flow_identifier))
|
64
64
|
end
|
65
65
|
|
66
66
|
def <<(data, flow_identifier = nil)
|
67
|
-
enqueue(:info, format(:info, data, flow_identifier))
|
67
|
+
enqueue(:info, format(:info, prepend_caller_information(data), flow_identifier))
|
68
68
|
end
|
69
69
|
|
70
70
|
def get_status
|
@@ -77,8 +77,16 @@ module SoarAuditingProvider
|
|
77
77
|
|
78
78
|
private
|
79
79
|
|
80
|
+
def prepend_caller_information(data)
|
81
|
+
if 'true' == @configuration['add_caller_source_location']
|
82
|
+
caller_key_value_pair = SoarAuditingFormatter::Formatter.optional_field_format("caller_source_location","#{caller_locations(2,1)[0]}")
|
83
|
+
data = "#{caller_key_value_pair} #{data}"
|
84
|
+
end
|
85
|
+
data
|
86
|
+
end
|
87
|
+
|
80
88
|
def install_at_exit_handler
|
81
|
-
if @configuration['install_exit_handler']
|
89
|
+
if 'true' == @configuration['install_exit_handler']
|
82
90
|
Kernel.at_exit do
|
83
91
|
exit_cleanup
|
84
92
|
end
|
data/sanity/Gemfile
CHANGED
@@ -0,0 +1,83 @@
|
|
1
|
+
require 'soar_auditing_provider'
|
2
|
+
require 'log4r_auditor'
|
3
|
+
require 'soar_flow'
|
4
|
+
require 'benchmark'
|
5
|
+
require 'byebug'
|
6
|
+
|
7
|
+
class Main
|
8
|
+
|
9
|
+
AUDITING_CONFIGURATION = {
|
10
|
+
'auditing' => {
|
11
|
+
'level' => 'debug',
|
12
|
+
'install_exit_handler' => 'false',
|
13
|
+
'add_caller_source_location' => 'false',
|
14
|
+
'queue_worker' => {
|
15
|
+
'queue_size' => 1000000,
|
16
|
+
'initial_back_off_in_seconds' => 1,
|
17
|
+
'back_off_multiplier' => 2,
|
18
|
+
'back_off_attempts' => 5
|
19
|
+
},
|
20
|
+
'default_nfrs' => {
|
21
|
+
'accessibility' => 'local',
|
22
|
+
'privacy' => 'not encrypted',
|
23
|
+
'reliability' => 'instance',
|
24
|
+
'performance' => 'high'
|
25
|
+
},
|
26
|
+
'auditors' => {
|
27
|
+
'log4r' => {
|
28
|
+
'adaptor' => 'Log4rAuditor::Log4rAuditor',
|
29
|
+
'file_name' => 'soar_sc.log',
|
30
|
+
'standard_stream' => 'none',
|
31
|
+
'nfrs' => {
|
32
|
+
'accessibility' => 'local',
|
33
|
+
'privacy' => 'not encrypted',
|
34
|
+
'reliability' => 'instance',
|
35
|
+
'performance' => 'high'
|
36
|
+
}
|
37
|
+
}
|
38
|
+
}
|
39
|
+
}
|
40
|
+
}
|
41
|
+
|
42
|
+
def test_sanity
|
43
|
+
iterations = 1000000
|
44
|
+
|
45
|
+
#create and configure auditing instance
|
46
|
+
myauditing = SoarAuditingProvider::AuditingProvider.new( AUDITING_CONFIGURATION['auditing'] )
|
47
|
+
myauditing.instance_flow_identifier = SoarFlow::ID::generate_flow_id
|
48
|
+
myauditing.service_identifier = 'my-test-service.com'
|
49
|
+
|
50
|
+
#associate a set of auditing entries with a flow by generating a flow identifiers
|
51
|
+
flow_id = SoarFlow::ID::generate_flow_id
|
52
|
+
|
53
|
+
Benchmark.bm do |x|
|
54
|
+
myauditing = SoarAuditingProvider::AuditingProvider.new( AUDITING_CONFIGURATION['auditing'].dup.merge("level" => "warn") )
|
55
|
+
myauditing.instance_flow_identifier = SoarFlow::ID::generate_flow_id
|
56
|
+
myauditing.service_identifier = 'my-test-service.com'
|
57
|
+
x.report ("audit_call_below_audit_threshold:") {
|
58
|
+
iterations.times {
|
59
|
+
myauditing.info("Benchmarking test",flow_id)
|
60
|
+
}
|
61
|
+
}
|
62
|
+
myauditing = SoarAuditingProvider::AuditingProvider.new( AUDITING_CONFIGURATION['auditing'].dup.merge("add_caller_source_location" => "false") )
|
63
|
+
myauditing.instance_flow_identifier = SoarFlow::ID::generate_flow_id
|
64
|
+
myauditing.service_identifier = 'my-test-service.com'
|
65
|
+
x.report ("audit_call_without_caller_info :") {
|
66
|
+
iterations.times {
|
67
|
+
myauditing.info("Benchmarking test",flow_id)
|
68
|
+
}
|
69
|
+
}
|
70
|
+
myauditing = SoarAuditingProvider::AuditingProvider.new( AUDITING_CONFIGURATION['auditing'].dup.merge("add_caller_source_location" => "true") )
|
71
|
+
myauditing.instance_flow_identifier = SoarFlow::ID::generate_flow_id
|
72
|
+
myauditing.service_identifier = 'my-test-service.com'
|
73
|
+
x.report ("audit_call_with_caller_info :") {
|
74
|
+
iterations.times {
|
75
|
+
myauditing.info("Benchmarking test",flow_id)
|
76
|
+
}
|
77
|
+
}
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
main = Main.new
|
83
|
+
main.test_sanity
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: soar_auditing_provider
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ernst van Graan
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date: 2016-08-
|
12
|
+
date: 2016-08-31 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -196,6 +196,7 @@ files:
|
|
196
196
|
- sanity/.ruby-version
|
197
197
|
- sanity/Gemfile
|
198
198
|
- sanity/sanity.rb
|
199
|
+
- sanity/sanity_benchmark.rb
|
199
200
|
- soar_auditing_provider.gemspec
|
200
201
|
homepage:
|
201
202
|
licenses:
|