fluent-plugin-filter-dgi-parse-audit-log 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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 64d2b4c7d26a6b3689253f3068572cce936a2d9d5400a316089eabddcf5d0514
4
+ data.tar.gz: 7fb38a870b79efdfd5f778b72754824514d403f16180066792714aeb8a7a1a13
5
+ SHA512:
6
+ metadata.gz: feb1b3f8c2824deddcb2761253900846beebddeb58f60b76f4add4c897a16fe9e4e15592db131b3710a828a84effdd7c67dc97addd017ab414b886927cb58068
7
+ data.tar.gz: b5de6b433f996f06bab0f7f1d774996c9962c7b60f89bb6e7090fdcef9a0e3d36fbe569fe3145306a5e29e032ae87f3d2bb93dc89e10ceb5524ba6b72d86d85a
@@ -0,0 +1,28 @@
1
+ name: Ruby
2
+
3
+ on:
4
+ push:
5
+ branches: [ "main" ]
6
+ pull_request:
7
+ branches: [ "main" ]
8
+
9
+ permissions:
10
+ contents: read
11
+
12
+ jobs:
13
+ test:
14
+
15
+ runs-on: ubuntu-latest
16
+ strategy:
17
+ matrix:
18
+ ruby-version: ['2.6', '2.7', '3.0']
19
+
20
+ steps:
21
+ - uses: actions/checkout@v3
22
+ - name: Set up Ruby
23
+ uses: ruby/setup-ruby@v1
24
+ with:
25
+ ruby-version: ${{ matrix.ruby-version }}
26
+ bundler-cache: true # runs 'bundle install' and caches installed gems automatically
27
+ - name: Run tests
28
+ run: bundle exec rake
data/.gitignore ADDED
@@ -0,0 +1,14 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+ Gemfile.lock
10
+ /test/
11
+ /gemfiles/*.lock
12
+
13
+ # rspec failure tracking
14
+ .rspec_status
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/.travis.yml ADDED
@@ -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
data/Appraisals ADDED
@@ -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
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,93 @@
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
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ ```ruby
12
+ gem 'fluent-plugin-filter-dgi-audit-log'
13
+ ```
14
+
15
+ And then execute:
16
+
17
+ $ bundle
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install fluent-plugin-filter-dgi-audit-log
22
+
23
+ ## Configuration
24
+
25
+ ```
26
+ @type parse_audit_log
27
+ #key message
28
+ #flatten false
29
+ ```
30
+
31
+ ## Output
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\""}' \
49
+ | fluent-cat -t audit.log
50
+ ```
51
+
52
+ ```json
53
+ {
54
+ "header": {
55
+ "type": "SYSCALL",
56
+ "msg": "audit(1364481363.243:24287)"
57
+ },
58
+ "body": {
59
+ "arch": "c000003e",
60
+ "syscall": "2",
61
+ "success": "no",
62
+ "exit": "-13",
63
+ "a0": "7fffd19c5592",
64
+ "a1": "0",
65
+ "a2": "7fffd19c4b50",
66
+ "a3": "a",
67
+ "items": "1",
68
+ "ppid": "2686",
69
+ "pid": "3538",
70
+ "auid": "500",
71
+ "uid": "500",
72
+ "gid": "500",
73
+ "euid": "500",
74
+ "suid": "500",
75
+ "fsuid": "500",
76
+ "egid": "500",
77
+ "sgid": "500",
78
+ "fsgid": "500",
79
+ "tty": "pts0",
80
+ "ses": "1",
81
+ "comm": "\"cat\"",
82
+ "exe": "\"/bin/cat\"",
83
+ "subj": "unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023",
84
+ "key": "\"sshd_config\""
85
+ }
86
+ }
87
+ ```
88
+
89
+ ## Related Links
90
+
91
+ * https://github.com/dg-i/audit_log_parser
92
+ * [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)
93
+ * [SPEC Writing Good Events · linux-audit/audit-documentation Wiki](https://github.com/linux-audit/audit-documentation/wiki/SPEC-Writing-Good-Events)
data/Rakefile ADDED
@@ -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
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,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-dgi-parse-audit-log'
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/dg-i/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 'dgi_audit_log_parser', '>= 1.0.0'
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,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,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,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
@@ -0,0 +1,3 @@
1
+ module FluentPluginFilterParseAuditLog
2
+ VERSION = '1.0.0'
3
+ end
metadata ADDED
@@ -0,0 +1,173 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: fluent-plugin-filter-dgi-parse-audit-log
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - winebarrel
8
+ - aeber
9
+ autorequire:
10
+ bindir: exe
11
+ cert_chain: []
12
+ date: 2023-10-17 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: dgi_audit_log_parser
30
+ requirement: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - ">="
33
+ - !ruby/object:Gem::Version
34
+ version: 1.0.0
35
+ type: :runtime
36
+ prerelease: false
37
+ version_requirements: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - ">="
40
+ - !ruby/object:Gem::Version
41
+ version: 1.0.0
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
+ - ".github/workflows/ruby.yml"
134
+ - ".gitignore"
135
+ - ".rspec"
136
+ - ".travis.yml"
137
+ - Appraisals
138
+ - Gemfile
139
+ - LICENSE.txt
140
+ - README.md
141
+ - Rakefile
142
+ - bin/console
143
+ - bin/setup
144
+ - fluent-plugin-filter-dgi-parse-audit-log.gemspec
145
+ - gemfiles/.bundle/config
146
+ - gemfiles/fluentd_0.12.gemfile
147
+ - gemfiles/fluentd_0.14.gemfile
148
+ - lib/fluent/plugin/filter_parse_audit_log.rb
149
+ - lib/fluent_plugin_filter_parse_audit_log/version.rb
150
+ homepage: https://github.com/dg-i/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
+ rubygems_version: 3.3.25
170
+ signing_key:
171
+ specification_version: 4
172
+ summary: Fluentd Filter Plugin to parse linux's audit log.
173
+ test_files: []