logstash-mixin-http_client 2.0.0 → 2.0.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9e247306e83334a1697891f830e558a73b1e1b12
4
- data.tar.gz: 5580b16dbaf08d67bcd050b23e77160f022a4b5a
3
+ metadata.gz: c7eb2faa6caaf2aeb2a930c0f3f19863dad8245b
4
+ data.tar.gz: df9699cc474589379d399287bd9bb646143593f1
5
5
  SHA512:
6
- metadata.gz: 1f79c0d9d81e096e6941a4a570cf1b453b351a0b6987d22a61454c4eea9b358c5ba97a5c84af90b14b088a401cb77717842fd2c1cbbe65047a1fb1054e191bd4
7
- data.tar.gz: 538e5d633bbb42e6348bb28cbebbbdfb96a9080d7264be5257340666ffd0181799bf95f431ce5ef3aa6a14430bc54fdef6734727799bfe1a3b8ee16c751b02fc
6
+ metadata.gz: c60419907ae6c653d36f144d9643ba9f1a49b4734fb9b5d743d8d26424be71ff71b0882851ce5333f234fe9ce70b0b847a1e80f26a4dfa36c63221452c4ae0e6
7
+ data.tar.gz: eda4337386b678066d65a3201c103f279bd4d3a8838763caa486e970f6ee70af5147d13b762a1518dec13a939fa07af4053a7ee73b36b4f6c638eb6014354047
data/CHANGELOG.md CHANGED
@@ -1,3 +1,8 @@
1
+ ## 2.0.0
2
+ - Plugins were updated to follow the new shutdown semantic, this mainly allows Logstash to instruct input plugins to terminate gracefully,
3
+ instead of using Thread.raise on the plugins' threads. Ref: https://github.com/elastic/logstash/pull/3895
4
+ - Dependency on logstash-core update to 2.0
5
+
1
6
  # 1.0.2
2
7
  * Add 'verify_cert' config option
3
8
  # 1.0.1
@@ -46,14 +46,29 @@ module LogStash::PluginMixins::HttpClient
46
46
  # If you need to use a custom X.509 CA (.pem certs) specify the path to that here
47
47
  config :cacert, :validate => :path
48
48
 
49
- # If you need to use a custom keystore (`.jks`) specify that here
50
- config :truststore, :validate => :path
49
+ # If you'd like to use a client certificate (note, most people don't want this) set the path to the x509 cert here
50
+ config :client_cert, :validate => :path
51
+ # If you're using a client certificate specify the path to the encryption key here
52
+ config :client_key, :validate => :path
53
+
54
+ # If you need to use a custom keystore (`.jks`) specify that here. This does not work with .pem keys!
55
+ config :keystore, :validate => :path
51
56
 
52
57
  # Specify the keystore password here.
53
58
  # Note, most .jks files created with keytool require a password!
54
- config :truststore_password, :validate => :password
59
+ config :keystore_password, :validate => :password
55
60
 
56
61
  # Specify the keystore type here. One of `JKS` or `PKCS12`. Default is `JKS`
62
+ config :keystore_type, :validate => :string, :default => "JKS"
63
+
64
+ # If you need to use a custom truststore (`.jks`) specify that here. This does not work with .pem certs!
65
+ config :truststore, :validate => :path
66
+
67
+ # Specify the truststore password here.
68
+ # Note, most .jks files created with keytool require a password!
69
+ config :truststore_password, :validate => :password
70
+
71
+ # Specify the truststore type here. One of `JKS` or `PKCS12`. Default is `JKS`
57
72
  config :truststore_type, :validate => :string, :default => "JKS"
58
73
 
59
74
  # Enable cookie support. With this enabled the client will persist cookies
@@ -66,11 +81,6 @@ module LogStash::PluginMixins::HttpClient
66
81
  # 2. Proxy host in form: `{host => "proxy.org", port => 80, scheme => 'http', user => 'username@host', password => 'password'}`
67
82
  # 3. Proxy host in form: `{url => 'http://proxy.org:1234', user => 'username@host', password => 'password'}`
68
83
  config :proxy
69
-
70
- # If you'd like to use a client certificate (note, most people don't want this) set the path to the x509 cert here
71
- config :client_cert, :validate => :path
72
- # If you're using a client certificate specify the path to the encryption key here
73
- config :client_key, :validate => :path
74
84
  end
75
85
 
76
86
  public
@@ -99,7 +109,8 @@ module LogStash::PluginMixins::HttpClient
99
109
  if @cacert
100
110
  c[:ssl][:ca_file] = @cacert
101
111
  end
102
- if (@truststore)
112
+
113
+ if @truststore
103
114
  c[:ssl].merge!(
104
115
  :truststore => @truststore,
105
116
  :truststore_type => @truststore_type
@@ -110,6 +121,19 @@ module LogStash::PluginMixins::HttpClient
110
121
  c[:ssl].merge!(truststore_password: @truststore_password.value)
111
122
  end
112
123
  end
124
+
125
+ if @keystore
126
+ c[:ssl].merge!(
127
+ :keystore => @keystore,
128
+ :keystore_type => @keystore_type
129
+ )
130
+
131
+ # JKS files have optional passwords if programatically created
132
+ if keystore_password
133
+ c[:ssl].merge!(keystore_password: @keystore_password.value)
134
+ end
135
+ end
136
+
113
137
  if @client_cert && @client_key
114
138
  c[:ssl][:client_cert] = @client_cert
115
139
  c[:ssl][:client_key] = @client_key
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'logstash-mixin-http_client'
3
- s.version = '2.0.0'
3
+ s.version = '2.0.2'
4
4
  s.licenses = ['Apache License (2.0)']
5
5
  s.summary = "AWS mixins to provide a unified interface for Amazon Webservice"
6
6
  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"
@@ -16,7 +16,7 @@ Gem::Specification.new do |s|
16
16
  s.test_files = s.files.grep(%r{^(test|spec|features)/})
17
17
 
18
18
  # Gem dependencies
19
- s.add_runtime_dependency "logstash-core", "~> 2.0.0.snapshot"
19
+ s.add_runtime_dependency "logstash-core", ">= 2.0.0.snapshot", "< 3.0.0"
20
20
  s.add_runtime_dependency 'logstash-codec-plain'
21
21
  s.add_runtime_dependency 'manticore', '>= 0.4.1'
22
22
 
@@ -29,11 +29,24 @@ describe LogStash::PluginMixins::HttpClient do
29
29
  expect(impl.send(:client)).to eql(impl.client)
30
30
  end
31
31
 
32
- shared_examples "setting ca bundles" do |key|
32
+ shared_examples "setting ca bundles" do |key, type|
33
33
  subject { Dummy.new(conf).send(:client_config) }
34
34
 
35
35
  it "should correctly set the path" do
36
- expect(subject[:ssl][key]).to eql(path)
36
+ expect(subject[:ssl][key]).to eql(path), "Expected to find path for #{key}"
37
+ end
38
+
39
+ if type == :jks
40
+ let(:store_password) { conf["#{key}_password"].value}
41
+ let(:store_type) { conf["#{key}_type"]}
42
+
43
+ it "should set the bundle password" do
44
+ expect(subject[:ssl]["#{key}_password".to_sym]).to eql(store_password)
45
+ end
46
+
47
+ it "should set the bundle type" do
48
+ expect(subject[:ssl]["#{key}_type".to_sym]).to eql(store_type)
49
+ end
37
50
  end
38
51
  end
39
52
 
@@ -49,12 +62,35 @@ describe LogStash::PluginMixins::HttpClient do
49
62
  end
50
63
 
51
64
  context "with JKS" do
52
- let(:conf) { basic_config.merge("truststore" => path) }
53
-
54
- include_examples("setting ca bundles", :truststore)
65
+ let(:conf) {
66
+ basic_config.merge(
67
+ "truststore" => path,
68
+ "truststore_password" => "foobar",
69
+ "truststore_type" => "jks"
70
+ )
71
+ }
72
+
73
+ include_examples("setting ca bundles", :truststore, :jks)
55
74
  end
56
75
  end
57
76
 
77
+ describe "with a custom keystore" do
78
+ let(:file) { Stud::Temporary.file }
79
+ let(:path) { file.path }
80
+ let(:password) { "foo" }
81
+ after { File.unlink(path)}
82
+
83
+ let(:conf) {
84
+ basic_config.merge(
85
+ "keystore" => path,
86
+ "keystore_password" => "foo",
87
+ "keystore_type" => "jks"
88
+ )
89
+ }
90
+
91
+ include_examples("setting ca bundles", :keystore, :jks)
92
+ end
93
+
58
94
  describe "with a client cert" do
59
95
  let(:file) { Stud::Temporary.file }
60
96
  let(:path) { file.path }
metadata CHANGED
@@ -1,29 +1,35 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logstash-mixin-http_client
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Elastic
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-09-23 00:00:00.000000000 Z
11
+ date: 2015-10-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement
15
15
  requirements:
16
- - - ~>
16
+ - - '>='
17
17
  - !ruby/object:Gem::Version
18
18
  version: 2.0.0.snapshot
19
+ - - <
20
+ - !ruby/object:Gem::Version
21
+ version: 3.0.0
19
22
  name: logstash-core
20
23
  prerelease: false
21
24
  type: :runtime
22
25
  version_requirements: !ruby/object:Gem::Requirement
23
26
  requirements:
24
- - - ~>
27
+ - - '>='
25
28
  - !ruby/object:Gem::Version
26
29
  version: 2.0.0.snapshot
30
+ - - <
31
+ - !ruby/object:Gem::Version
32
+ version: 3.0.0
27
33
  - !ruby/object:Gem::Dependency
28
34
  requirement: !ruby/object:Gem::Requirement
29
35
  requirements: