fluent-plugin-filter-parse-audit-log-aeber 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +14 -0
- data/.rspec +3 -0
- data/.travis.yml +13 -0
- data/Appraisals +7 -0
- data/Gemfile +6 -0
- data/LICENSE.txt +21 -0
- data/README.md +94 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/fluent-plugin-filter-parse-audit-log-aeber.gemspec +33 -0
- data/gemfiles/.bundle/config +2 -0
- data/gemfiles/fluentd_0.12.gemfile +7 -0
- data/gemfiles/fluentd_0.14.gemfile +7 -0
- data/lib/fluent/plugin/filter_parse_audit_log.rb +25 -0
- data/lib/fluent_plugin_filter_parse_audit_log/version.rb +3 -0
- metadata +172 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 1abf37812b979f099b854d2b90485aa28fd0b3227eecff957596dbc88831d7f0
|
4
|
+
data.tar.gz: 9484f96407abed76b4dff653e482c240c7895bdefacc53c5accecb71e45236c8
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: b0790ec9a1e4a3c99bd433b107da8a5cd4d9d6ea2f8a7099daae93fb00bef0705b68d407f006fefcc11a58b90dd00a35556a99413b23b3022df79803053e462f
|
7
|
+
data.tar.gz: a77628ac1545b96acced6a98b300b3e8166478612eadf6665815692d45d31dd15a40dd15dbb4a875d1e00bad1bf205491c4cde7c5f4e2306913bd891e6b1b803
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/Appraisals
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2018 winebarrel
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,94 @@
|
|
1
|
+
# fluent-plugin-filter-parse-audit-log
|
2
|
+
|
3
|
+
Fluentd Filter Plugin to parse [linux's audit log](https://github.com/linux-audit/audit-documentation/wiki).
|
4
|
+
|
5
|
+
[![Gem Version](https://badge.fury.io/rb/fluent-plugin-filter-parse-audit-log.svg)](http://badge.fury.io/rb/fluent-plugin-filter-parse-audit-log)
|
6
|
+
[![Build Status](https://travis-ci.org/winebarrel/fluent-plugin-filter-parse-audit-log.svg?branch=master)](https://travis-ci.org/winebarrel/fluent-plugin-filter-parse-audit-log)
|
7
|
+
|
8
|
+
## Installation
|
9
|
+
|
10
|
+
Add this line to your application's Gemfile:
|
11
|
+
|
12
|
+
```ruby
|
13
|
+
gem 'fluent-plugin-filter-audit-log'
|
14
|
+
```
|
15
|
+
|
16
|
+
And then execute:
|
17
|
+
|
18
|
+
$ bundle
|
19
|
+
|
20
|
+
Or install it yourself as:
|
21
|
+
|
22
|
+
$ gem install fluent-plugin-filter-audit-log
|
23
|
+
|
24
|
+
## Configuration
|
25
|
+
|
26
|
+
```
|
27
|
+
@type parse_audit_log
|
28
|
+
#key message
|
29
|
+
#flatten false
|
30
|
+
```
|
31
|
+
|
32
|
+
## Output
|
33
|
+
|
34
|
+
```
|
35
|
+
<source>
|
36
|
+
@type forward
|
37
|
+
</source>
|
38
|
+
|
39
|
+
<filter audit.log>
|
40
|
+
@type parse_audit_log
|
41
|
+
</filter>
|
42
|
+
|
43
|
+
<match audit.log>
|
44
|
+
@type stdout
|
45
|
+
</match>
|
46
|
+
```
|
47
|
+
|
48
|
+
```sh
|
49
|
+
echo '{"message":"type=SYSCALL msg=audit(1364481363.243:24287): arch=c000003e syscall=2 success=no exit=-13 a0=7fffd19c5592 a1=0 a2=7fffd19c4b50 a3=a items=1 ppid=2686 pid=3538 auid=500 uid=500 gid=500 euid=500 suid=500 fsuid=500 egid=500 sgid=500 fsgid=500 tty=pts0 ses=1 comm=\"cat\" exe=\"/bin/cat\" subj=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 key=\"sshd_config\""}' \
|
50
|
+
| fluent-cat -t audit.log
|
51
|
+
```
|
52
|
+
|
53
|
+
```json
|
54
|
+
{
|
55
|
+
"header": {
|
56
|
+
"type": "SYSCALL",
|
57
|
+
"msg": "audit(1364481363.243:24287)"
|
58
|
+
},
|
59
|
+
"body": {
|
60
|
+
"arch": "c000003e",
|
61
|
+
"syscall": "2",
|
62
|
+
"success": "no",
|
63
|
+
"exit": "-13",
|
64
|
+
"a0": "7fffd19c5592",
|
65
|
+
"a1": "0",
|
66
|
+
"a2": "7fffd19c4b50",
|
67
|
+
"a3": "a",
|
68
|
+
"items": "1",
|
69
|
+
"ppid": "2686",
|
70
|
+
"pid": "3538",
|
71
|
+
"auid": "500",
|
72
|
+
"uid": "500",
|
73
|
+
"gid": "500",
|
74
|
+
"euid": "500",
|
75
|
+
"suid": "500",
|
76
|
+
"fsuid": "500",
|
77
|
+
"egid": "500",
|
78
|
+
"sgid": "500",
|
79
|
+
"fsgid": "500",
|
80
|
+
"tty": "pts0",
|
81
|
+
"ses": "1",
|
82
|
+
"comm": "\"cat\"",
|
83
|
+
"exe": "\"/bin/cat\"",
|
84
|
+
"subj": "unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023",
|
85
|
+
"key": "\"sshd_config\""
|
86
|
+
}
|
87
|
+
}
|
88
|
+
```
|
89
|
+
|
90
|
+
## Related Links
|
91
|
+
|
92
|
+
* https://github.com/winebarrel/audit_log_parser
|
93
|
+
* [7.6. Understanding Audit Log Files - Red Hat Customer Portal](https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/6/html/security_guide/sec-understanding_audit_log_files)
|
94
|
+
* [SPEC Writing Good Events · linux-audit/audit-documentation Wiki](https://github.com/linux-audit/audit-documentation/wiki/SPEC-Writing-Good-Events)
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "fluent/plugin/filter/audit/log"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
lib = File.expand_path('../lib', __FILE__)
|
2
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
3
|
+
require 'fluent_plugin_filter_parse_audit_log/version'
|
4
|
+
|
5
|
+
Gem::Specification.new do |spec|
|
6
|
+
spec.name = 'fluent-plugin-filter-parse-audit-log-aeber'
|
7
|
+
spec.version = FluentPluginFilterParseAuditLog::VERSION
|
8
|
+
spec.authors = ['winebarrel', 'aeber']
|
9
|
+
spec.email = ['']
|
10
|
+
|
11
|
+
spec.summary = %q{Fluentd Filter Plugin to parse linux's audit log.}
|
12
|
+
spec.description = %q{Fluentd Filter Plugin to parse linux's audit log.}
|
13
|
+
spec.homepage = 'https://github.com/aeber/fluent-plugin-filter-parse-audit-log'
|
14
|
+
spec.license = 'MIT'
|
15
|
+
|
16
|
+
# Specify which files should be added to the gem when it is released.
|
17
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
18
|
+
spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
|
19
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
20
|
+
end
|
21
|
+
spec.bindir = 'exe'
|
22
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
23
|
+
spec.require_paths = ['lib']
|
24
|
+
|
25
|
+
spec.add_dependency 'fluentd'
|
26
|
+
spec.add_dependency 'audit_log_parser', '>= 0.1.3'
|
27
|
+
spec.add_development_dependency 'bundler'
|
28
|
+
spec.add_development_dependency "rake", ">= 12.3.3"
|
29
|
+
spec.add_development_dependency 'rspec', '~> 3.0'
|
30
|
+
spec.add_development_dependency 'timecop'
|
31
|
+
spec.add_development_dependency 'test-unit', '>= 3.1.0'
|
32
|
+
spec.add_development_dependency 'appraisal', '>= 2.2'
|
33
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require 'fluent_plugin_filter_parse_audit_log/version'
|
2
|
+
require 'audit_log_parser'
|
3
|
+
|
4
|
+
class FluentParseAuditLogFilter < Fluent::Filter
|
5
|
+
Fluent::Plugin.register_filter('parse_audit_log', self)
|
6
|
+
|
7
|
+
config_param :key, :string, default: 'message'
|
8
|
+
config_param :flatten, :bool, default: false
|
9
|
+
config_param :keep_keys, :array, default: nil
|
10
|
+
|
11
|
+
def filter(tag, time, record)
|
12
|
+
line = record[@key]
|
13
|
+
return record unless line
|
14
|
+
new_record = AuditLogParser.parse_line(line, flatten: @flatten)
|
15
|
+
@keep_keys.each do |k|
|
16
|
+
new_record[k] = record[k] if record.has_key?(k)
|
17
|
+
end if @keep_keys
|
18
|
+
|
19
|
+
new_record
|
20
|
+
rescue => e
|
21
|
+
log.warn "failed to parse a audit log: #{line}", error_class: e.class, error: e.message
|
22
|
+
log.warn_backtrace
|
23
|
+
record
|
24
|
+
end
|
25
|
+
end
|
metadata
ADDED
@@ -0,0 +1,172 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: fluent-plugin-filter-parse-audit-log-aeber
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- winebarrel
|
8
|
+
- aeber
|
9
|
+
autorequire:
|
10
|
+
bindir: exe
|
11
|
+
cert_chain: []
|
12
|
+
date: 2023-05-30 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: fluentd
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
requirements:
|
18
|
+
- - ">="
|
19
|
+
- !ruby/object:Gem::Version
|
20
|
+
version: '0'
|
21
|
+
type: :runtime
|
22
|
+
prerelease: false
|
23
|
+
version_requirements: !ruby/object:Gem::Requirement
|
24
|
+
requirements:
|
25
|
+
- - ">="
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
version: '0'
|
28
|
+
- !ruby/object:Gem::Dependency
|
29
|
+
name: audit_log_parser
|
30
|
+
requirement: !ruby/object:Gem::Requirement
|
31
|
+
requirements:
|
32
|
+
- - ">="
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: 0.1.3
|
35
|
+
type: :runtime
|
36
|
+
prerelease: false
|
37
|
+
version_requirements: !ruby/object:Gem::Requirement
|
38
|
+
requirements:
|
39
|
+
- - ">="
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
version: 0.1.3
|
42
|
+
- !ruby/object:Gem::Dependency
|
43
|
+
name: bundler
|
44
|
+
requirement: !ruby/object:Gem::Requirement
|
45
|
+
requirements:
|
46
|
+
- - ">="
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
version: '0'
|
49
|
+
type: :development
|
50
|
+
prerelease: false
|
51
|
+
version_requirements: !ruby/object:Gem::Requirement
|
52
|
+
requirements:
|
53
|
+
- - ">="
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: '0'
|
56
|
+
- !ruby/object:Gem::Dependency
|
57
|
+
name: rake
|
58
|
+
requirement: !ruby/object:Gem::Requirement
|
59
|
+
requirements:
|
60
|
+
- - ">="
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: 12.3.3
|
63
|
+
type: :development
|
64
|
+
prerelease: false
|
65
|
+
version_requirements: !ruby/object:Gem::Requirement
|
66
|
+
requirements:
|
67
|
+
- - ">="
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: 12.3.3
|
70
|
+
- !ruby/object:Gem::Dependency
|
71
|
+
name: rspec
|
72
|
+
requirement: !ruby/object:Gem::Requirement
|
73
|
+
requirements:
|
74
|
+
- - "~>"
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: '3.0'
|
77
|
+
type: :development
|
78
|
+
prerelease: false
|
79
|
+
version_requirements: !ruby/object:Gem::Requirement
|
80
|
+
requirements:
|
81
|
+
- - "~>"
|
82
|
+
- !ruby/object:Gem::Version
|
83
|
+
version: '3.0'
|
84
|
+
- !ruby/object:Gem::Dependency
|
85
|
+
name: timecop
|
86
|
+
requirement: !ruby/object:Gem::Requirement
|
87
|
+
requirements:
|
88
|
+
- - ">="
|
89
|
+
- !ruby/object:Gem::Version
|
90
|
+
version: '0'
|
91
|
+
type: :development
|
92
|
+
prerelease: false
|
93
|
+
version_requirements: !ruby/object:Gem::Requirement
|
94
|
+
requirements:
|
95
|
+
- - ">="
|
96
|
+
- !ruby/object:Gem::Version
|
97
|
+
version: '0'
|
98
|
+
- !ruby/object:Gem::Dependency
|
99
|
+
name: test-unit
|
100
|
+
requirement: !ruby/object:Gem::Requirement
|
101
|
+
requirements:
|
102
|
+
- - ">="
|
103
|
+
- !ruby/object:Gem::Version
|
104
|
+
version: 3.1.0
|
105
|
+
type: :development
|
106
|
+
prerelease: false
|
107
|
+
version_requirements: !ruby/object:Gem::Requirement
|
108
|
+
requirements:
|
109
|
+
- - ">="
|
110
|
+
- !ruby/object:Gem::Version
|
111
|
+
version: 3.1.0
|
112
|
+
- !ruby/object:Gem::Dependency
|
113
|
+
name: appraisal
|
114
|
+
requirement: !ruby/object:Gem::Requirement
|
115
|
+
requirements:
|
116
|
+
- - ">="
|
117
|
+
- !ruby/object:Gem::Version
|
118
|
+
version: '2.2'
|
119
|
+
type: :development
|
120
|
+
prerelease: false
|
121
|
+
version_requirements: !ruby/object:Gem::Requirement
|
122
|
+
requirements:
|
123
|
+
- - ">="
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
version: '2.2'
|
126
|
+
description: Fluentd Filter Plugin to parse linux's audit log.
|
127
|
+
email:
|
128
|
+
- ''
|
129
|
+
executables: []
|
130
|
+
extensions: []
|
131
|
+
extra_rdoc_files: []
|
132
|
+
files:
|
133
|
+
- ".gitignore"
|
134
|
+
- ".rspec"
|
135
|
+
- ".travis.yml"
|
136
|
+
- Appraisals
|
137
|
+
- Gemfile
|
138
|
+
- LICENSE.txt
|
139
|
+
- README.md
|
140
|
+
- Rakefile
|
141
|
+
- bin/console
|
142
|
+
- bin/setup
|
143
|
+
- fluent-plugin-filter-parse-audit-log-aeber.gemspec
|
144
|
+
- gemfiles/.bundle/config
|
145
|
+
- gemfiles/fluentd_0.12.gemfile
|
146
|
+
- gemfiles/fluentd_0.14.gemfile
|
147
|
+
- lib/fluent/plugin/filter_parse_audit_log.rb
|
148
|
+
- lib/fluent_plugin_filter_parse_audit_log/version.rb
|
149
|
+
homepage: https://github.com/aeber/fluent-plugin-filter-parse-audit-log
|
150
|
+
licenses:
|
151
|
+
- MIT
|
152
|
+
metadata: {}
|
153
|
+
post_install_message:
|
154
|
+
rdoc_options: []
|
155
|
+
require_paths:
|
156
|
+
- lib
|
157
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
158
|
+
requirements:
|
159
|
+
- - ">="
|
160
|
+
- !ruby/object:Gem::Version
|
161
|
+
version: '0'
|
162
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
163
|
+
requirements:
|
164
|
+
- - ">="
|
165
|
+
- !ruby/object:Gem::Version
|
166
|
+
version: '0'
|
167
|
+
requirements: []
|
168
|
+
rubygems_version: 3.1.4
|
169
|
+
signing_key:
|
170
|
+
specification_version: 4
|
171
|
+
summary: Fluentd Filter Plugin to parse linux's audit log.
|
172
|
+
test_files: []
|