fluent-plugin-filter-parse-audit-log 0.1.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.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 1dab94129a17f2aeb9eda08c28c95de6c73e0e1fd1953069d9795dba32acbdf2
4
+ data.tar.gz: e4299fb0a3102f98c6efdd39eee9c0a7f37aa0e37d49f811a5097a3920c7aa5d
5
+ SHA512:
6
+ metadata.gz: 5d794eb895d4335d50aa32ce84d2f35b562f1f8d65890c44984f266bbc9b46bcb917e21a11a8a38df3680aa518201ef4ddc52f2e1638ed4e4181d33f94945576
7
+ data.tar.gz: e72d244dfc839cb54ee3d0e7ec12c4ba19b1f662af26d48558bc55a8b408fc7bd780e71fbabdda30d05dcf5881b7ce8115ae340818ff43e651b94dd99a8aa9a9
@@ -0,0 +1,13 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+ Gemfile.lock
10
+ /test/
11
+
12
+ # rspec failure tracking
13
+ .rspec_status
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
@@ -0,0 +1,13 @@
1
+ ---
2
+ sudo: false
3
+ language: ruby
4
+ cache: bundler
5
+ rvm:
6
+ - 2.3.8
7
+ - 2.4.5
8
+ - 2.5.3
9
+ - 2.6.0-preview2
10
+ before_install: gem install bundler -v 1.16.6
11
+ gemfile:
12
+ - gemfiles/fluentd_0.12.gemfile
13
+ - gemfiles/fluentd_0.14.gemfile
@@ -0,0 +1,7 @@
1
+ appraise 'fluentd-0.12' do
2
+ gem 'fluentd', '>= 0.12', '< 0.14'
3
+ end
4
+
5
+ appraise 'fluentd-0.14' do
6
+ gem 'fluentd', '>= 0.14'
7
+ end
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ source "https://rubygems.org"
2
+
3
+ git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
4
+
5
+ # Specify your gem's dependencies in fluent-plugin-filter-audit-log.gemspec
6
+ gemspec
@@ -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.
@@ -0,0 +1,59 @@
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
+ ```
30
+
31
+ ## Example
32
+
33
+ ```
34
+ <source>
35
+ @type forward
36
+ </source>
37
+
38
+ <filter audit.log>
39
+ @type parse_audit_log
40
+ </filter>
41
+
42
+ <match audit.log>
43
+ @type stdout
44
+ </match>
45
+ ```
46
+
47
+ ```sh
48
+ 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\""}' | fluent-cat -t audit.log
49
+ ```
50
+
51
+ ```json
52
+ 2018-11-04 11:48:05.000000000 +0900 audit.log: {"header":{"type":"SYSCALL","msg":"audit(1364481363.243:24287)"},"body":{"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\""}}
53
+ ```
54
+
55
+ ## Related Links
56
+
57
+ * https://github.com/winebarrel/audit_log_parser
58
+ * [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)
59
+ * [SPEC Writing Good Events · linux-audit/audit-documentation Wiki](https://github.com/linux-audit/audit-documentation/wiki/SPEC-Writing-Good-Events)
@@ -0,0 +1,6 @@
1
+ require 'bundler/gem_tasks'
2
+ require 'rspec/core/rake_task'
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
@@ -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__)
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -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'
7
+ spec.version = FluentPluginFilterParseAuditLog::VERSION
8
+ spec.authors = ['winebarrel']
9
+ spec.email = ['sugawara@winebarrel.jp']
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/winebarrel/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'
27
+ spec.add_development_dependency 'bundler'
28
+ spec.add_development_dependency 'rake'
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,2 @@
1
+ ---
2
+ BUNDLE_RETRY: "1"
@@ -0,0 +1,7 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "fluentd", ">= 0.12", "< 0.14"
6
+
7
+ gemspec path: "../"
@@ -0,0 +1,73 @@
1
+ PATH
2
+ remote: ..
3
+ specs:
4
+ fluent-plugin-filter-parse-audit-log (0.1.0)
5
+ audit_log_parser
6
+ fluentd
7
+
8
+ GEM
9
+ remote: https://rubygems.org/
10
+ specs:
11
+ appraisal (2.2.0)
12
+ bundler
13
+ rake
14
+ thor (>= 0.14.0)
15
+ audit_log_parser (0.1.1)
16
+ cool.io (1.5.3)
17
+ diff-lcs (1.3)
18
+ fluentd (0.12.43)
19
+ cool.io (>= 1.2.2, < 2.0.0)
20
+ http_parser.rb (>= 0.5.1, < 0.7.0)
21
+ json (>= 1.4.3)
22
+ msgpack (>= 0.5.11, < 2)
23
+ sigdump (~> 0.2.2)
24
+ string-scrub (>= 0.0.3, <= 0.0.5)
25
+ tzinfo (>= 1.0.0)
26
+ tzinfo-data (>= 1.0.0)
27
+ yajl-ruby (~> 1.0)
28
+ http_parser.rb (0.6.0)
29
+ json (2.1.0)
30
+ msgpack (1.2.4)
31
+ power_assert (1.1.3)
32
+ rake (12.3.1)
33
+ rspec (3.8.0)
34
+ rspec-core (~> 3.8.0)
35
+ rspec-expectations (~> 3.8.0)
36
+ rspec-mocks (~> 3.8.0)
37
+ rspec-core (3.8.0)
38
+ rspec-support (~> 3.8.0)
39
+ rspec-expectations (3.8.2)
40
+ diff-lcs (>= 1.2.0, < 2.0)
41
+ rspec-support (~> 3.8.0)
42
+ rspec-mocks (3.8.0)
43
+ diff-lcs (>= 1.2.0, < 2.0)
44
+ rspec-support (~> 3.8.0)
45
+ rspec-support (3.8.0)
46
+ sigdump (0.2.4)
47
+ string-scrub (0.0.5)
48
+ test-unit (3.2.8)
49
+ power_assert
50
+ thor (0.20.0)
51
+ thread_safe (0.3.6)
52
+ timecop (0.9.1)
53
+ tzinfo (1.2.5)
54
+ thread_safe (~> 0.1)
55
+ tzinfo-data (1.2018.7)
56
+ tzinfo (>= 1.0.0)
57
+ yajl-ruby (1.4.1)
58
+
59
+ PLATFORMS
60
+ ruby
61
+
62
+ DEPENDENCIES
63
+ appraisal (>= 2.2)
64
+ bundler
65
+ fluent-plugin-filter-parse-audit-log!
66
+ fluentd (>= 0.12, < 0.14)
67
+ rake
68
+ rspec (~> 3.0)
69
+ test-unit (>= 3.1.0)
70
+ timecop
71
+
72
+ BUNDLED WITH
73
+ 1.16.6
@@ -0,0 +1,7 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "fluentd", ">= 0.14"
6
+
7
+ gemspec path: "../"
@@ -0,0 +1,76 @@
1
+ PATH
2
+ remote: ..
3
+ specs:
4
+ fluent-plugin-filter-parse-audit-log (0.1.0)
5
+ audit_log_parser
6
+ fluentd
7
+
8
+ GEM
9
+ remote: https://rubygems.org/
10
+ specs:
11
+ appraisal (2.2.0)
12
+ bundler
13
+ rake
14
+ thor (>= 0.14.0)
15
+ audit_log_parser (0.1.1)
16
+ cool.io (1.5.3)
17
+ diff-lcs (1.3)
18
+ dig_rb (1.0.1)
19
+ fluentd (1.2.6)
20
+ cool.io (>= 1.4.5, < 2.0.0)
21
+ dig_rb (~> 1.0.0)
22
+ http_parser.rb (>= 0.5.1, < 0.7.0)
23
+ msgpack (>= 0.7.0, < 2.0.0)
24
+ serverengine (>= 2.0.4, < 3.0.0)
25
+ sigdump (~> 0.2.2)
26
+ strptime (>= 0.2.2, < 1.0.0)
27
+ tzinfo (~> 1.0)
28
+ tzinfo-data (~> 1.0)
29
+ yajl-ruby (~> 1.0)
30
+ http_parser.rb (0.6.0)
31
+ msgpack (1.2.4)
32
+ power_assert (1.1.3)
33
+ rake (12.3.1)
34
+ rspec (3.8.0)
35
+ rspec-core (~> 3.8.0)
36
+ rspec-expectations (~> 3.8.0)
37
+ rspec-mocks (~> 3.8.0)
38
+ rspec-core (3.8.0)
39
+ rspec-support (~> 3.8.0)
40
+ rspec-expectations (3.8.2)
41
+ diff-lcs (>= 1.2.0, < 2.0)
42
+ rspec-support (~> 3.8.0)
43
+ rspec-mocks (3.8.0)
44
+ diff-lcs (>= 1.2.0, < 2.0)
45
+ rspec-support (~> 3.8.0)
46
+ rspec-support (3.8.0)
47
+ serverengine (2.0.7)
48
+ sigdump (~> 0.2.2)
49
+ sigdump (0.2.4)
50
+ strptime (0.2.3)
51
+ test-unit (3.2.8)
52
+ power_assert
53
+ thor (0.20.0)
54
+ thread_safe (0.3.6)
55
+ timecop (0.9.1)
56
+ tzinfo (1.2.5)
57
+ thread_safe (~> 0.1)
58
+ tzinfo-data (1.2018.7)
59
+ tzinfo (>= 1.0.0)
60
+ yajl-ruby (1.4.1)
61
+
62
+ PLATFORMS
63
+ ruby
64
+
65
+ DEPENDENCIES
66
+ appraisal (>= 2.2)
67
+ bundler
68
+ fluent-plugin-filter-parse-audit-log!
69
+ fluentd (>= 0.14)
70
+ rake
71
+ rspec (~> 3.0)
72
+ test-unit (>= 3.1.0)
73
+ timecop
74
+
75
+ BUNDLED WITH
76
+ 1.16.6
@@ -0,0 +1,18 @@
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
+
9
+ def filter(tag, time, record)
10
+ line = record[@key]
11
+ return record unless line
12
+ AuditLogParser.parse_line(line)
13
+ rescue => e
14
+ log.warn "failed to parse a audit log: #{line}", error_class: e.class, error: e.message
15
+ log.warn_backtrace
16
+ record
17
+ end
18
+ end
@@ -0,0 +1,3 @@
1
+ module FluentPluginFilterParseAuditLog
2
+ VERSION = '0.1.0'
3
+ end
metadata ADDED
@@ -0,0 +1,174 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: fluent-plugin-filter-parse-audit-log
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - winebarrel
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2018-11-04 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: fluentd
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: audit_log_parser
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: bundler
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rake
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rspec
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '3.0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '3.0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: timecop
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: test-unit
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: 3.1.0
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: 3.1.0
111
+ - !ruby/object:Gem::Dependency
112
+ name: appraisal
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: '2.2'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: '2.2'
125
+ description: Fluentd Filter Plugin to parse linux's audit log.
126
+ email:
127
+ - sugawara@winebarrel.jp
128
+ executables: []
129
+ extensions: []
130
+ extra_rdoc_files: []
131
+ files:
132
+ - ".gitignore"
133
+ - ".rspec"
134
+ - ".travis.yml"
135
+ - Appraisals
136
+ - Gemfile
137
+ - LICENSE.txt
138
+ - README.md
139
+ - Rakefile
140
+ - bin/console
141
+ - bin/setup
142
+ - fluent-plugin-filter-parse-audit-log.gemspec
143
+ - gemfiles/.bundle/config
144
+ - gemfiles/fluentd_0.12.gemfile
145
+ - gemfiles/fluentd_0.12.gemfile.lock
146
+ - gemfiles/fluentd_0.14.gemfile
147
+ - gemfiles/fluentd_0.14.gemfile.lock
148
+ - lib/fluent/plugin/filter_parse_audit_log.rb
149
+ - lib/fluent_plugin_filter_parse_audit_log/version.rb
150
+ homepage: https://github.com/winebarrel/fluent-plugin-filter-parse-audit-log
151
+ licenses:
152
+ - MIT
153
+ metadata: {}
154
+ post_install_message:
155
+ rdoc_options: []
156
+ require_paths:
157
+ - lib
158
+ required_ruby_version: !ruby/object:Gem::Requirement
159
+ requirements:
160
+ - - ">="
161
+ - !ruby/object:Gem::Version
162
+ version: '0'
163
+ required_rubygems_version: !ruby/object:Gem::Requirement
164
+ requirements:
165
+ - - ">="
166
+ - !ruby/object:Gem::Version
167
+ version: '0'
168
+ requirements: []
169
+ rubyforge_project:
170
+ rubygems_version: 2.7.6
171
+ signing_key:
172
+ specification_version: 4
173
+ summary: Fluentd Filter Plugin to parse linux's audit log.
174
+ test_files: []