logstash-filter-fingerprint 1.0.0 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 38ed616132d0098276a3941009824b04bc432e42
4
- data.tar.gz: e013a9dffa6e267d83844c93ca09b0711f085aef
3
+ metadata.gz: dc40fc66f3f1976a3baf27d20e3db08578c7a5e3
4
+ data.tar.gz: bf4faddddbf41669d8842a10c6541e0f06ad0512
5
5
  SHA512:
6
- metadata.gz: fff58d54827e28a7f9b6da68c4ea4e93c3f85031997c3eac09cdee46b5ab1de29caf8d7d807bc41bf665ed9669fd4bf9b402d54553b1ed596e21d25da6e82cb4
7
- data.tar.gz: 5292a2a0d48ad25bbced5c19dfcb288878784b8bea899cdda2474d1b2eafa11f2225b3b7870fd1d9e130ae6e2c38481d4ef1945634b4e852dad40deca637943c
6
+ metadata.gz: ddb217f30a7a1749a67795559ff8e4625bd1c3875dae0e79c06ee20e5983285929c17a94819e548a03100fb7c1a8534ad94e468704f1bd42b7aea4b54aff7d3a
7
+ data.tar.gz: c367355c7f8b8d69ebe1fe04c5fea92bfe84eb2d8c5c0908a638def8009aceacab22da9e9b0c4d4e0095778c82ad1d56628de997eef910c0b9a1bb8563aadea3
data/README.md CHANGED
@@ -1,15 +1,15 @@
1
1
  # Logstash Plugin
2
2
 
3
- This is a plugin for [Logstash](https://github.com/elasticsearch/logstash).
3
+ This is a plugin for [Logstash](https://github.com/elastic/logstash).
4
4
 
5
5
  It is fully free and fully open source. The license is Apache 2.0, meaning you are pretty much free to use it however you want in whatever way.
6
6
 
7
7
  ## Documentation
8
8
 
9
- Logstash provides infrastructure to automatically generate documentation for this plugin. We use the asciidoc format to write documentation so any comments in the source code will be first converted into asciidoc and then into html. All plugin documentation are placed under one [central location](http://www.elasticsearch.org/guide/en/logstash/current/).
9
+ Logstash provides infrastructure to automatically generate documentation for this plugin. We use the asciidoc format to write documentation so any comments in the source code will be first converted into asciidoc and then into html. All plugin documentation are placed under one [central location](http://www.elastic.co/guide/en/logstash/current/).
10
10
 
11
11
  - For formatting code or config example, you can use the asciidoc `[source,ruby]` directive
12
- - For more asciidoc formatting tips, see the excellent reference here https://github.com/elasticsearch/docs#asciidoc-guide
12
+ - For more asciidoc formatting tips, see the excellent reference here https://github.com/elastic/docs#asciidoc-guide
13
13
 
14
14
  ## Need Help?
15
15
 
@@ -83,4 +83,4 @@ Programming is not a required skill. Whatever you've seen about open source and
83
83
 
84
84
  It is more important to the community that you are able to contribute.
85
85
 
86
- For more information about contributing, see the [CONTRIBUTING](https://github.com/elasticsearch/logstash/blob/master/CONTRIBUTING.md) file.
86
+ For more information about contributing, see the [CONTRIBUTING](https://github.com/elastic/logstash/blob/master/CONTRIBUTING.md) file.
@@ -1,6 +1,7 @@
1
1
  # encoding: utf-8
2
2
  require "logstash/filters/base"
3
3
  require "logstash/namespace"
4
+ require "base64"
4
5
 
5
6
  # Fingerprint fields using by replacing values with a consistent hash.
6
7
  class LogStash::Filters::Fingerprint < LogStash::Filters::Base
@@ -18,6 +19,10 @@ class LogStash::Filters::Fingerprint < LogStash::Filters::Base
18
19
  # With other methods fill in the `HMAC` key
19
20
  config :key, :validate => :string
20
21
 
22
+ # When set to 'true', SHA1', 'SHA256', 'SHA384', 'SHA512' and 'MD5' fingerprint methods will be returned
23
+ # base64 encoded rather than hex encoded.
24
+ config :base64encode, :validate => :boolean, :default => false
25
+
21
26
  # Fingerprint method
22
27
  config :method, :validate => ['SHA1', 'SHA256', 'SHA384', 'SHA512', 'MD5', "MURMUR3", "IPV4_NETWORK", "UUID", "PUNCTUATION"], :required => true, :default => 'SHA1'
23
28
 
@@ -100,7 +105,12 @@ class LogStash::Filters::Fingerprint < LogStash::Filters::Base
100
105
  def anonymize_openssl(data)
101
106
  digest = encryption_algorithm()
102
107
  # in JRuby 1.7.11 outputs as ASCII-8BIT
103
- OpenSSL::HMAC.hexdigest(digest, @key, data.to_s).force_encoding(Encoding::UTF_8)
108
+ if @base64encode
109
+ hash = OpenSSL::HMAC.digest(digest, @key, data.to_s)
110
+ Base64.strict_encode64(hash).force_encoding(Encoding::UTF_8)
111
+ else
112
+ OpenSSL::HMAC.hexdigest(digest, @key, data.to_s).force_encoding(Encoding::UTF_8)
113
+ end
104
114
  end
105
115
 
106
116
  def anonymize_murmur3(value)
@@ -1,7 +1,7 @@
1
1
  Gem::Specification.new do |s|
2
2
 
3
3
  s.name = 'logstash-filter-fingerprint'
4
- s.version = '1.0.0'
4
+ s.version = '2.0.0'
5
5
  s.licenses = ['Apache License (2.0)']
6
6
  s.summary = "Fingerprint fields using by replacing values with a consistent hash."
7
7
  s.description = "This gem is a logstash plugin required to be installed on top of the Logstash core pipeline using $LS_HOME/bin/plugin install gemname. This gem is not a stand-alone program"
@@ -11,7 +11,7 @@ Gem::Specification.new do |s|
11
11
  s.require_paths = ["lib"]
12
12
 
13
13
  # Files
14
- s.files = `git ls-files`.split($\)+::Dir.glob('vendor/*')
14
+ s.files = Dir['lib/**/*','spec/**/*','vendor/**/*','*.gemspec','*.md','CONTRIBUTORS','Gemfile','LICENSE','NOTICE.TXT']
15
15
 
16
16
  # Tests
17
17
  s.test_files = s.files.grep(%r{^(test|spec|features)/})
@@ -20,7 +20,7 @@ Gem::Specification.new do |s|
20
20
  s.metadata = { "logstash_plugin" => "true", "logstash_group" => "filter" }
21
21
 
22
22
  # Gem dependencies
23
- s.add_runtime_dependency "logstash-core", '>= 1.4.0', '< 2.0.0'
23
+ s.add_runtime_dependency "logstash-core", "~> 2.0.0.snapshot"
24
24
  s.add_runtime_dependency "murmurhash3" #(MIT license)
25
25
  s.add_development_dependency 'logstash-devutils'
26
26
  end
@@ -35,7 +35,7 @@ describe LogStash::Filters::Fingerprint do
35
35
  end
36
36
  end
37
37
 
38
- describe "fingerprint string with SHA1 alogrithm" do
38
+ describe "fingerprint string with SHA1 alogrithm" do
39
39
  config <<-CONFIG
40
40
  filter {
41
41
  fingerprint {
@@ -51,6 +51,23 @@ describe LogStash::Filters::Fingerprint do
51
51
  end
52
52
  end
53
53
 
54
+ describe "fingerprint string with SHA1 alogrithm and base64 encoding" do
55
+ config <<-CONFIG
56
+ filter {
57
+ fingerprint {
58
+ source => ["clientip"]
59
+ key => "longencryptionkey"
60
+ method => 'SHA1'
61
+ base64encode => true
62
+ }
63
+ }
64
+ CONFIG
65
+
66
+ sample("clientip" => "123.123.123.123") do
67
+ insist { subject["fingerprint"] } == "/cYKzEdz3FrFaf+3j8uTyWMHl/Q="
68
+ end
69
+ end
70
+
54
71
  describe "fingerprint string with SHA256 alogrithm" do
55
72
  config <<-CONFIG
56
73
  filter {
@@ -67,6 +84,23 @@ describe LogStash::Filters::Fingerprint do
67
84
  end
68
85
  end
69
86
 
87
+ describe "fingerprint string with SHA256 alogrithm and base64 encoding" do
88
+ config <<-CONFIG
89
+ filter {
90
+ fingerprint {
91
+ source => ["clientip"]
92
+ key => "longencryptionkey"
93
+ method => 'SHA256'
94
+ base64encode => true
95
+ }
96
+ }
97
+ CONFIG
98
+
99
+ sample("clientip" => "123.123.123.123") do
100
+ insist { subject["fingerprint"] } == "NFvsPv8kLVO1aJFsJhCz45PYhda5bWQ/OElP10v0qco="
101
+ end
102
+ end
103
+
70
104
  describe "fingerprint string with SHA384 alogrithm" do
71
105
  config <<-CONFIG
72
106
  filter {
@@ -83,6 +117,23 @@ describe LogStash::Filters::Fingerprint do
83
117
  end
84
118
  end
85
119
 
120
+ describe "fingerprint string with SHA384 alogrithm and base64 encoding" do
121
+ config <<-CONFIG
122
+ filter {
123
+ fingerprint {
124
+ source => ["clientip"]
125
+ key => "longencryptionkey"
126
+ method => 'SHA384'
127
+ base64encode => true
128
+ }
129
+ }
130
+ CONFIG
131
+
132
+ sample("clientip" => "123.123.123.123") do
133
+ insist { subject["fingerprint"] } == "ItTA6MT7zcSIfSA4/KdlDw4uDiRX/0HAbrKpgN3tZ0lWHIFP4YKv+T4lONGFk5R6"
134
+ end
135
+ end
136
+
86
137
  describe "fingerprint string with SHA512 alogrithm" do
87
138
  config <<-CONFIG
88
139
  filter {
@@ -99,6 +150,23 @@ describe LogStash::Filters::Fingerprint do
99
150
  end
100
151
  end
101
152
 
153
+ describe "fingerprint string with SHA512 alogrithm and base64 encoding" do
154
+ config <<-CONFIG
155
+ filter {
156
+ fingerprint {
157
+ source => ["clientip"]
158
+ key => "longencryptionkey"
159
+ method => 'SHA512'
160
+ base64encode => true
161
+ }
162
+ }
163
+ CONFIG
164
+
165
+ sample("clientip" => "123.123.123.123") do
166
+ insist { subject["fingerprint"] } == "EcGbMmk2wI1sUKPIR9iD5aE2Lmpk3VUgGiXywawbZz99i/FbjxEqSXgnbVcydeOxQWbhckb2cMKlOUAcW/2s6A=="
167
+ end
168
+ end
169
+
102
170
  describe "fingerprint string with MD5 alogrithm" do
103
171
  config <<-CONFIG
104
172
  filter {
@@ -115,6 +183,23 @@ describe LogStash::Filters::Fingerprint do
115
183
  end
116
184
  end
117
185
 
186
+ describe "fingerprint string with MD5 alogrithm and base64 encoding" do
187
+ config <<-CONFIG
188
+ filter {
189
+ fingerprint {
190
+ source => ["clientip"]
191
+ key => "longencryptionkey"
192
+ method => 'MD5'
193
+ base64encode => true
194
+ }
195
+ }
196
+ CONFIG
197
+
198
+ sample("clientip" => "123.123.123.123") do
199
+ insist { subject["fingerprint"] } == "kzbIeeMFyWBKOEP8PnWUjw=="
200
+ end
201
+ end
202
+
118
203
  describe "Test field with multiple values" do
119
204
  config <<-CONFIG
120
205
  filter {
metadata CHANGED
@@ -1,77 +1,69 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logstash-filter-fingerprint
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Elastic
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-06-24 00:00:00.000000000 Z
11
+ date: 2015-09-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: logstash-core
15
- version_requirements: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - '>='
18
- - !ruby/object:Gem::Version
19
- version: 1.4.0
20
- - - <
21
- - !ruby/object:Gem::Version
22
- version: 2.0.0
23
14
  requirement: !ruby/object:Gem::Requirement
24
15
  requirements:
25
- - - '>='
26
- - !ruby/object:Gem::Version
27
- version: 1.4.0
28
- - - <
16
+ - - ~>
29
17
  - !ruby/object:Gem::Version
30
- version: 2.0.0
18
+ version: 2.0.0.snapshot
19
+ name: logstash-core
31
20
  prerelease: false
32
21
  type: :runtime
33
- - !ruby/object:Gem::Dependency
34
- name: murmurhash3
35
22
  version_requirements: !ruby/object:Gem::Requirement
36
23
  requirements:
37
- - - '>='
24
+ - - ~>
38
25
  - !ruby/object:Gem::Version
39
- version: '0'
26
+ version: 2.0.0.snapshot
27
+ - !ruby/object:Gem::Dependency
40
28
  requirement: !ruby/object:Gem::Requirement
41
29
  requirements:
42
30
  - - '>='
43
31
  - !ruby/object:Gem::Version
44
32
  version: '0'
33
+ name: murmurhash3
45
34
  prerelease: false
46
35
  type: :runtime
47
- - !ruby/object:Gem::Dependency
48
- name: logstash-devutils
49
36
  version_requirements: !ruby/object:Gem::Requirement
50
37
  requirements:
51
38
  - - '>='
52
39
  - !ruby/object:Gem::Version
53
40
  version: '0'
41
+ - !ruby/object:Gem::Dependency
54
42
  requirement: !ruby/object:Gem::Requirement
55
43
  requirements:
56
44
  - - '>='
57
45
  - !ruby/object:Gem::Version
58
46
  version: '0'
47
+ name: logstash-devutils
59
48
  prerelease: false
60
49
  type: :development
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
61
55
  description: This gem is a logstash plugin required to be installed on top of the Logstash core pipeline using $LS_HOME/bin/plugin install gemname. This gem is not a stand-alone program
62
56
  email: info@elastic.co
63
57
  executables: []
64
58
  extensions: []
65
59
  extra_rdoc_files: []
66
60
  files:
67
- - .gitignore
68
61
  - CHANGELOG.md
69
62
  - CONTRIBUTORS
70
63
  - Gemfile
71
64
  - LICENSE
72
65
  - NOTICE.TXT
73
66
  - README.md
74
- - Rakefile
75
67
  - lib/logstash/filters/fingerprint.rb
76
68
  - logstash-filter-fingerprint.gemspec
77
69
  - spec/filters/fingerprint_spec.rb
@@ -97,7 +89,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
97
89
  version: '0'
98
90
  requirements: []
99
91
  rubyforge_project:
100
- rubygems_version: 2.2.2
92
+ rubygems_version: 2.4.8
101
93
  signing_key:
102
94
  specification_version: 4
103
95
  summary: Fingerprint fields using by replacing values with a consistent hash.
data/.gitignore DELETED
@@ -1,4 +0,0 @@
1
- *.gem
2
- Gemfile.lock
3
- .bundle
4
- vendor
data/Rakefile DELETED
@@ -1,7 +0,0 @@
1
- @files=[]
2
-
3
- task :default do
4
- system("rake -T")
5
- end
6
-
7
- require "logstash/devutils/rake"