stream_auditor 1.1.0 → 1.1.1
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/.yardopts +4 -0
- data/README.md +4 -71
- data/README.rdoc +87 -0
- data/lib/stream_auditor/version.rb +1 -1
- data/lib/stream_auditor.rb +4 -4
- metadata +3 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0f61f071ffd320c122353320cb483b2bc0c23695
|
4
|
+
data.tar.gz: fa51e31c0ef072ecbf5ee5ec3dbca177ab46928a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6efec8c5e0898d57d7b34fb190bd63a0b8ad4206db442e1de17e7a4651141f196cbc9bc9a99df1b5f819837fa0d68191c185aaca4629ea764d5b095a8df541f5
|
7
|
+
data.tar.gz: 076fd463f84ef9daa878f18f3a42098ae5cbbc64a5d8b8cf939dc19d49a9e4fd61202575e5a9a8c3143236b094ede0c1aa2c03e2c578cfc9fe24c6853e92f166
|
data/.yardopts
ADDED
data/README.md
CHANGED
@@ -5,6 +5,10 @@ This is an IO stream auditor for the [SOAR Auditing Provider](https://github.com
|
|
5
5
|
It supports auditing to the standard error and output streams, to a file path (in append mode) or to an already open IO object.
|
6
6
|
In all cases, the stream is flushed on every audit call.
|
7
7
|
|
8
|
+
## Documentation
|
9
|
+
|
10
|
+
For documentation of the released gem, see [rubydoc.info](http://www.rubydoc.info/gems/stream_auditor).
|
11
|
+
|
8
12
|
## Installation
|
9
13
|
|
10
14
|
Add this line to your application's Gemfile:
|
@@ -21,77 +25,6 @@ Or install it yourself as:
|
|
21
25
|
|
22
26
|
$ gem install stream_auditor
|
23
27
|
|
24
|
-
## Usage
|
25
|
-
|
26
|
-
Until the [SOAR Auditing Provider](https://github.com/hetznerZA/soar_auditing_provider) is extended to ask auditors if they
|
27
|
-
support direct calls (as opposed to enqueued calls via queue worker thread):
|
28
|
-
|
29
|
-
```ruby
|
30
|
-
# Log to stderr
|
31
|
-
config = {
|
32
|
-
"auditing" => {
|
33
|
-
"provider" => "SoarAuditingProvider::AuditingProvider",
|
34
|
-
"direct_auditor_call" => "true",
|
35
|
-
"auditors" => {
|
36
|
-
"local" => {
|
37
|
-
"adaptor" => "StreamAuditor"
|
38
|
-
}
|
39
|
-
}
|
40
|
-
}
|
41
|
-
}
|
42
|
-
auditor = SoarAuditingProvider::AuditingProvider.new(config["auditing"])
|
43
|
-
auditor.info("Something happened")
|
44
|
-
|
45
|
-
# Log to stdout
|
46
|
-
config = {
|
47
|
-
"auditing" => {
|
48
|
-
"provider" => "SoarAuditingProvider::AuditingProvider",
|
49
|
-
"direct_auditor_call" => "true",
|
50
|
-
"auditors" => {
|
51
|
-
"local" => {
|
52
|
-
"adaptor" => "StreamAuditor",
|
53
|
-
"stream" => "$stdout"
|
54
|
-
}
|
55
|
-
}
|
56
|
-
}
|
57
|
-
}
|
58
|
-
auditor = SoarAuditingProvider::AuditingProvider.new(config["auditing"])
|
59
|
-
auditor.info("Something happened")
|
60
|
-
|
61
|
-
# Log to file in append mode
|
62
|
-
config = {
|
63
|
-
"auditing" => {
|
64
|
-
"provider" => "SoarAuditingProvider::AuditingProvider",
|
65
|
-
"direct_auditor_call" => "true",
|
66
|
-
"auditors" => {
|
67
|
-
"local" => {
|
68
|
-
"adaptor" => "StreamAuditor",
|
69
|
-
"stream" => "/var/log/application.log"
|
70
|
-
}
|
71
|
-
}
|
72
|
-
}
|
73
|
-
}
|
74
|
-
auditor = SoarAuditingProvider::AuditingProvider.new(config["auditing"])
|
75
|
-
auditor.info("Something happened")
|
76
|
-
|
77
|
-
# Log to IO object
|
78
|
-
config = {
|
79
|
-
"auditing" => {
|
80
|
-
"provider" => "SoarAuditingProvider::AuditingProvider",
|
81
|
-
"level" => "debug",
|
82
|
-
"direct_auditor_call" => "true",
|
83
|
-
"auditors" => {
|
84
|
-
"local" => {
|
85
|
-
"adaptor" => "StreamAuditor",
|
86
|
-
"stream" => File.open("/var/log/application.log", "a")
|
87
|
-
}
|
88
|
-
}
|
89
|
-
}
|
90
|
-
}
|
91
|
-
auditor = SoarAuditingProvider::AuditingProvider.new(config["auditing"])
|
92
|
-
auditor.info("Something happened")
|
93
|
-
```
|
94
|
-
|
95
28
|
## Development
|
96
29
|
|
97
30
|
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
data/README.rdoc
ADDED
@@ -0,0 +1,87 @@
|
|
1
|
+
= StreamAuditor
|
2
|
+
|
3
|
+
This is an IO stream auditor for the {http://www.rubydoc.info/gems/soar_auditing_provider SOAR Auditing Provider}.
|
4
|
+
It implements the {http://www.rubydoc.info/gems/soar_auditor_api SOAR Auditor API}.
|
5
|
+
|
6
|
+
It supports auditing to the standard error and output streams, to a file path (in append mode) or to an already open IO object.
|
7
|
+
In all cases, the stream is flushed on every audit call.
|
8
|
+
|
9
|
+
The implementation is provided by the class {StreamAuditor}.
|
10
|
+
|
11
|
+
The implementation is covered by an rspec test suite in the {https://github.com/hetznerZA/stream_auditor StreamAuditor repo}.
|
12
|
+
The suite includes and integration test the verifies that the auditor works with the SOAR Auditing Provider.
|
13
|
+
|
14
|
+
== Usage
|
15
|
+
|
16
|
+
For users of {https://gitlab.host-h.net/hetznerZA/soar_sc soar_sc}, instantiation of the SOAR Auditing Provider is
|
17
|
+
purely a matter of configuration.
|
18
|
+
|
19
|
+
For others, the provider can be configured to use the StreamAuditor as follows:
|
20
|
+
|
21
|
+
require "soar_auditing_provider"
|
22
|
+
require "stream_auditor"
|
23
|
+
|
24
|
+
# Log to stderr
|
25
|
+
config = {
|
26
|
+
"auditing" => {
|
27
|
+
"provider" => "SoarAuditingProvider::AuditingProvider",
|
28
|
+
"direct_auditor_call" => "true",
|
29
|
+
"auditors" => {
|
30
|
+
"local" => {
|
31
|
+
"adaptor" => "StreamAuditor"
|
32
|
+
}
|
33
|
+
}
|
34
|
+
}
|
35
|
+
}
|
36
|
+
auditor = SoarAuditingProvider::AuditingProvider.new(config["auditing"])
|
37
|
+
auditor.info("Something happened")
|
38
|
+
|
39
|
+
# Log to stdout
|
40
|
+
config = {
|
41
|
+
"auditing" => {
|
42
|
+
"provider" => "SoarAuditingProvider::AuditingProvider",
|
43
|
+
"direct_auditor_call" => "true",
|
44
|
+
"auditors" => {
|
45
|
+
"local" => {
|
46
|
+
"adaptor" => "StreamAuditor",
|
47
|
+
"stream" => "$stdout"
|
48
|
+
}
|
49
|
+
}
|
50
|
+
}
|
51
|
+
}
|
52
|
+
auditor = SoarAuditingProvider::AuditingProvider.new(config["auditing"])
|
53
|
+
auditor.info("Something happened")
|
54
|
+
|
55
|
+
# Log to file in append mode
|
56
|
+
config = {
|
57
|
+
"auditing" => {
|
58
|
+
"provider" => "SoarAuditingProvider::AuditingProvider",
|
59
|
+
"direct_auditor_call" => "true",
|
60
|
+
"auditors" => {
|
61
|
+
"local" => {
|
62
|
+
"adaptor" => "StreamAuditor",
|
63
|
+
"stream" => "/var/log/application.log"
|
64
|
+
}
|
65
|
+
}
|
66
|
+
}
|
67
|
+
}
|
68
|
+
auditor = SoarAuditingProvider::AuditingProvider.new(config["auditing"])
|
69
|
+
auditor.info("Something happened")
|
70
|
+
|
71
|
+
# Log to IO object
|
72
|
+
config = {
|
73
|
+
"auditing" => {
|
74
|
+
"provider" => "SoarAuditingProvider::AuditingProvider",
|
75
|
+
"level" => "debug",
|
76
|
+
"direct_auditor_call" => "true",
|
77
|
+
"auditors" => {
|
78
|
+
"local" => {
|
79
|
+
"adaptor" => "StreamAuditor",
|
80
|
+
"stream" => File.open("/var/log/application.log", "a")
|
81
|
+
}
|
82
|
+
}
|
83
|
+
}
|
84
|
+
}
|
85
|
+
auditor = SoarAuditingProvider::AuditingProvider.new(config["auditing"])
|
86
|
+
auditor.info("Something happened")
|
87
|
+
|
data/lib/stream_auditor.rb
CHANGED
@@ -7,7 +7,7 @@ require "fileutils"
|
|
7
7
|
#
|
8
8
|
# This implementation supports auditing to:
|
9
9
|
#
|
10
|
-
# * an already open
|
10
|
+
# * an already open +IO+ object (or anything that implements +IO#<<+ and +IO#flush+),
|
11
11
|
# * the standard error stream ($stderr),
|
12
12
|
# * the standard output stream ($stdout), or
|
13
13
|
# * a file.
|
@@ -57,15 +57,15 @@ class StreamAuditor < SoarAuditorApi::AuditorAPI
|
|
57
57
|
# Apply the configuration supplied to {http://www.rubydoc.info/gems/soar_auditor_api/SoarAuditorApi/AuditorAPI#initialize-instance_method initialize}
|
58
58
|
#
|
59
59
|
# @param [Hash] configuration
|
60
|
-
# This method accepts +nil+ or a
|
60
|
+
# This method accepts +nil+ or a +Hash+, but the auditor API only calls
|
61
61
|
# this method when the configuration is not +nil+.
|
62
62
|
#
|
63
|
-
# The configuration may contain the following
|
63
|
+
# The configuration may contain the following +String+ keys:
|
64
64
|
#
|
65
65
|
# * +adaptor+ - ignored (for compatibility with the SOAR auditing provider
|
66
66
|
# * +stream+ - the stream to audit to, one of:
|
67
67
|
#
|
68
|
-
# * an
|
68
|
+
# * an +IO+ object (or anything that implements +IO#<<+ and +IO#flush+)
|
69
69
|
# * the string +$stderr+ for the standard error stream
|
70
70
|
# * the string +$stdout+ for the standard output stream
|
71
71
|
# * the string path to a file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: stream_auditor
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sheldon Hearn
|
@@ -91,8 +91,10 @@ files:
|
|
91
91
|
- ".gitignore"
|
92
92
|
- ".rspec"
|
93
93
|
- ".travis.yml"
|
94
|
+
- ".yardopts"
|
94
95
|
- Gemfile
|
95
96
|
- README.md
|
97
|
+
- README.rdoc
|
96
98
|
- Rakefile
|
97
99
|
- bin/console
|
98
100
|
- bin/setup
|