fluentd 1.9.0-x86-mingw32 → 1.9.1-x86-mingw32

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of fluentd might be problematic. Click here for more details.

Files changed (47) hide show
  1. checksums.yaml +4 -4
  2. data/.github/PULL_REQUEST_TEMPLATE.md +2 -1
  3. data/CHANGELOG.md +24 -0
  4. data/Gemfile +0 -2
  5. data/appveyor.yml +5 -14
  6. data/fluentd.gemspec +2 -1
  7. data/lib/fluent/config/section.rb +4 -0
  8. data/lib/fluent/plugin/in_monitor_agent.rb +1 -1
  9. data/lib/fluent/plugin/in_tail.rb +12 -139
  10. data/lib/fluent/plugin/in_tail/position_file.rb +171 -0
  11. data/lib/fluent/plugin/out_forward.rb +3 -2
  12. data/lib/fluent/plugin/out_http.rb +10 -4
  13. data/lib/fluent/plugin/output.rb +1 -1
  14. data/lib/fluent/plugin/parser_syslog.rb +5 -2
  15. data/lib/fluent/plugin_helper/cert_option.rb +5 -2
  16. data/lib/fluent/plugin_helper/http_server.rb +62 -2
  17. data/lib/fluent/plugin_helper/http_server/compat/server.rb +14 -3
  18. data/lib/fluent/plugin_helper/http_server/compat/ssl_context_extractor.rb +52 -0
  19. data/lib/fluent/plugin_helper/http_server/server.rb +14 -8
  20. data/lib/fluent/plugin_helper/http_server/ssl_context_builder.rb +41 -0
  21. data/lib/fluent/plugin_helper/server.rb +5 -10
  22. data/lib/fluent/plugin_helper/socket.rb +4 -8
  23. data/lib/fluent/tls.rb +81 -0
  24. data/lib/fluent/version.rb +1 -1
  25. data/test/config/test_section.rb +0 -2
  26. data/test/plugin/in_tail/test_position_file.rb +192 -0
  27. data/test/plugin/test_in_tail.rb +13 -0
  28. data/test/plugin/test_out_http.rb +15 -2
  29. data/test/plugin/test_output_as_buffered_backup.rb +2 -1
  30. data/test/plugin/test_parser_syslog.rb +36 -0
  31. data/test/plugin_helper/data/cert/generate_cert.rb +87 -0
  32. data/test/plugin_helper/data/cert/with_ca/ca-cert-key-pass.pem +30 -0
  33. data/test/plugin_helper/data/cert/with_ca/ca-cert-key.pem +27 -0
  34. data/test/plugin_helper/data/cert/with_ca/ca-cert-pass.pem +20 -0
  35. data/test/plugin_helper/data/cert/with_ca/ca-cert.pem +20 -0
  36. data/test/plugin_helper/data/cert/with_ca/cert-key-pass.pem +30 -0
  37. data/test/plugin_helper/data/cert/with_ca/cert-key.pem +27 -0
  38. data/test/plugin_helper/data/cert/with_ca/cert-pass.pem +21 -0
  39. data/test/plugin_helper/data/cert/with_ca/cert.pem +21 -0
  40. data/test/plugin_helper/data/cert/without_ca/cert-key-pass.pem +30 -0
  41. data/test/plugin_helper/data/cert/without_ca/cert-key.pem +27 -0
  42. data/test/plugin_helper/data/cert/without_ca/cert-pass.pem +20 -0
  43. data/test/plugin_helper/data/cert/without_ca/cert.pem +20 -0
  44. data/test/plugin_helper/test_http_server_helper.rb +168 -7
  45. data/test/plugin_helper/test_server.rb +40 -9
  46. data/test/test_tls.rb +65 -0
  47. metadata +52 -4
@@ -0,0 +1,30 @@
1
+ -----BEGIN RSA PRIVATE KEY-----
2
+ Proc-Type: 4,ENCRYPTED
3
+ DEK-Info: AES-256-CBC,8C5793DC2044D52EF3249993DB56034A
4
+
5
+ 00Ew3GVB6iOesF0uniabI127Yvwdr9auPDb3cFd8saZF29buGkn0L6ZxYJXYdBTn
6
+ Yz65W8CH99G7DS8KH5+QJ3SirrQeWIuXDdBZo36RqLoQkOuC8MnPmQVOFCnOOaSP
7
+ DrtjQuRX8I8WsEO6WumpAU/phjjQTnPSg3TbzeAFvPpKN116IiW0n8nLOGjo11fu
8
+ bNzHZ6Z5Da0BDXJm/P1Zgn8L39jxVLp2bCZnzSIKD+ipWUPs2HWYKLs1Z6V345ME
9
+ QBiG8fF2tL3+DARAqVqQ2pd8xkK1m4VMz3ajHdRMkXQj2cJsAkAu+cXsKxbbz9WN
10
+ 9GV45tlbVYH1VQJyeeVQyC+bDsgq0N6HG8iEoHD4fpx3fOU958J81OKJe05Qn1uF
11
+ 1HSfKBPRyaEm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/jEbugapHJ3f6JRdTJ
20
+ -----END CERTIFICATE-----
@@ -5,18 +5,24 @@ require 'fluent/plugin/output'
5
5
  require 'fluent/event'
6
6
  require 'net/http'
7
7
  require 'uri'
8
+ require 'openssl'
9
+ require 'async'
8
10
 
9
11
  class HtttpHelperTest < Test::Unit::TestCase
10
12
  PORT = unused_port
11
13
  NULL_LOGGER = Logger.new(nil)
14
+ CERT_DIR = File.expand_path(File.dirname(__FILE__) + '/data/cert/without_ca')
15
+ CERT_CA_DIR = File.expand_path(File.dirname(__FILE__) + '/data/cert/with_ca')
12
16
 
13
17
  class Dummy < Fluent::Plugin::TestBase
14
18
  helpers :http_server
15
19
  end
16
20
 
17
- def on_driver
21
+ def on_driver(config = nil)
22
+ config ||= Fluent::Config.parse(config || '', '(name)', '')
18
23
  Fluent::Test.setup
19
24
  driver = Dummy.new
25
+ driver.configure(config)
20
26
  driver.start
21
27
  driver.after_start
22
28
 
@@ -47,6 +53,12 @@ class HtttpHelperTest < Test::Unit::TestCase
47
53
  end
48
54
  end
49
55
 
56
+ def on_driver_transport(opts = {}, &block)
57
+ transport_conf = config_element('transport', 'tls', opts)
58
+ c = config_element('ROOT', '', {}, [transport_conf])
59
+ on_driver(c, &block)
60
+ end
61
+
50
62
  %w[get head].each do |n|
51
63
  define_method(n) do |uri, header = {}|
52
64
  url = URI.parse(uri)
@@ -56,6 +68,14 @@ class HtttpHelperTest < Test::Unit::TestCase
56
68
  http.request(req)
57
69
  end
58
70
  end
71
+
72
+ define_method("secure_#{n}") do |uri, header = {}, verify: true, cert_path: nil, selfsigned: true, hostname: false|
73
+ url = URI.parse(uri)
74
+ headers = { 'Content-Type' => 'application/x-www-form-urlencoded/' }.merge(header)
75
+ start_https_request(url.host, url.port, verify: verify, cert_path: cert_path, selfsigned: selfsigned) do |https|
76
+ https.send(n, url.path, headers.to_a)
77
+ end
78
+ end
59
79
  end
60
80
 
61
81
  %w[post put patch delete options trace].each do |n|
@@ -70,10 +90,62 @@ class HtttpHelperTest < Test::Unit::TestCase
70
90
  end
71
91
  end
72
92
 
93
+ # wrapper for net/http
94
+ Response = Struct.new(:code, :body, :headers)
95
+
96
+ # Use async-http as http client since net/http can't be set verify_hostname= now
97
+ # will be replaced when net/http supports verify_hostname=
98
+ def start_https_request(addr, port, verify: true, cert_path: nil, selfsigned: true, hostname: nil)
99
+ context = OpenSSL::SSL::SSLContext.new
100
+ context.set_params({})
101
+ if verify
102
+ cert_store = OpenSSL::X509::Store.new
103
+ cert_store.set_default_paths
104
+ if selfsigned && OpenSSL::X509.const_defined?('V_FLAG_CHECK_SS_SIGNATURE')
105
+ cert_store.flags = OpenSSL::X509::V_FLAG_CHECK_SS_SIGNATURE
106
+ end
107
+
108
+ if cert_path
109
+ cert_store.add_file(cert_path)
110
+ end
111
+
112
+ context.cert_store = cert_store
113
+ if !hostname && context.respond_to?(:verify_hostname=)
114
+ context.verify_hostname = false # In test code, using hostname to be connected is very difficult
115
+ end
116
+
117
+ context.verify_mode = OpenSSL::SSL::VERIFY_PEER
118
+ else
119
+ context.verify_mode = OpenSSL::SSL::VERIFY_NONE
120
+ end
121
+
122
+ client = Async::HTTP::Client.new(Async::HTTP::Endpoint.parse("https://#{addr}:#{port}", ssl_context: context))
123
+ reactor = Async::Reactor.new(nil, logger: NULL_LOGGER)
124
+
125
+ resp = nil
126
+ error = nil
127
+
128
+ reactor.run do
129
+ begin
130
+ response = yield(client)
131
+ rescue => e # Async::Reactor rescue all error. handle it by myself
132
+ error = e
133
+ end
134
+
135
+ resp = Response.new(response.status.to_s, response.body.read, response.headers)
136
+ end
137
+
138
+ if error
139
+ raise error
140
+ else
141
+ resp
142
+ end
143
+ end
144
+
73
145
  sub_test_case 'Create a HTTP server' do
74
146
  test 'monunt given path' do
75
147
  on_driver do |driver|
76
- driver.create_http_server(:http_server_helper_test, addr: '127.0.0.1', port: PORT, logger: NULL_LOGGER) do |s|
148
+ driver.http_server_create_http_server(:http_server_helper_test, addr: '127.0.0.1', port: PORT, logger: NULL_LOGGER) do |s|
77
149
  s.get('/example/hello') { [200, { 'Content-Type' => 'text/plain' }, 'hello get'] }
78
150
  s.post('/example/hello') { [200, { 'Content-Type' => 'text/plain' }, 'hello post'] }
79
151
  s.head('/example/hello') { [200, { 'Content-Type' => 'text/plain' }, 'hello head'] }
@@ -108,7 +180,7 @@ class HtttpHelperTest < Test::Unit::TestCase
108
180
 
109
181
  test 'when path does not start with `/` or ends with `/`' do
110
182
  on_driver do |driver|
111
- driver.create_http_server(:http_server_helper_test, addr: '127.0.0.1', port: PORT, logger: NULL_LOGGER) do |s|
183
+ driver.http_server_create_http_server(:http_server_helper_test, addr: '127.0.0.1', port: PORT, logger: NULL_LOGGER) do |s|
112
184
  s.get('example/hello') { [200, { 'Content-Type' => 'text/plain' }, 'hello get'] }
113
185
  s.get('/example/hello2/') { [200, { 'Content-Type' => 'text/plain' }, 'hello get'] }
114
186
  end
@@ -123,7 +195,7 @@ class HtttpHelperTest < Test::Unit::TestCase
123
195
 
124
196
  test 'when error raised' do
125
197
  on_driver do |driver|
126
- driver.create_http_server(:http_server_helper_test, addr: '127.0.0.1', port: PORT, logger: NULL_LOGGER) do |s|
198
+ driver.http_server_create_http_server(:http_server_helper_test, addr: '127.0.0.1', port: PORT, logger: NULL_LOGGER) do |s|
127
199
  s.get('/example/hello') { raise 'error!' }
128
200
  end
129
201
 
@@ -134,7 +206,7 @@ class HtttpHelperTest < Test::Unit::TestCase
134
206
 
135
207
  test 'when path is not found' do
136
208
  on_driver do |driver|
137
- driver.create_http_server(:http_server_helper_test, addr: '127.0.0.1', port: PORT, logger: NULL_LOGGER) do |s|
209
+ driver.http_server_create_http_server(:http_server_helper_test, addr: '127.0.0.1', port: PORT, logger: NULL_LOGGER) do |s|
138
210
  s.get('/example/hello') { [200, { 'Content-Type' => 'text/plain' }, 'hello get'] }
139
211
  end
140
212
 
@@ -145,7 +217,7 @@ class HtttpHelperTest < Test::Unit::TestCase
145
217
 
146
218
  test 'params and body' do
147
219
  on_driver do |driver|
148
- driver.create_http_server(:http_server_helper_test, addr: '127.0.0.1', port: PORT, logger: NULL_LOGGER) do |s|
220
+ driver.http_server_create_http_server(:http_server_helper_test, addr: '127.0.0.1', port: PORT, logger: NULL_LOGGER) do |s|
149
221
  s.get('/example/hello') do |req|
150
222
  assert_equal(req.query_string, nil)
151
223
  assert_equal(req.body, nil)
@@ -185,6 +257,95 @@ class HtttpHelperTest < Test::Unit::TestCase
185
257
  end
186
258
  end
187
259
 
260
+ sub_test_case 'create a HTTPS server' do
261
+ test '#configure' do
262
+ driver = Dummy.new
263
+
264
+ transport_conf = config_element('transport', 'tls', { 'version' => 'TLSv1_1' })
265
+ driver.configure(config_element('ROOT', '', {}, [transport_conf]))
266
+ assert_equal :tls, driver.transport_config.protocol
267
+ assert_equal :TLSv1_1, driver.transport_config.version
268
+ end
269
+
270
+ sub_test_case '#http_server_create_https_server' do
271
+ test 'can overwrite settings by using tls_context' do
272
+ on_driver_transport({ 'insecure' => 'false' }) do |driver|
273
+ tls = { 'insecure' => 'true' } # overwrite
274
+ driver.http_server_create_https_server(:http_server_helper_test_tls, addr: '127.0.0.1', port: PORT, logger: NULL_LOGGER, tls_opts: tls) do |s|
275
+ s.get('/example/hello') { [200, { 'Content-Type' => 'text/plain' }, 'hello get'] }
276
+ end
277
+
278
+ resp = secure_get("https://127.0.0.1:#{PORT}/example/hello", verify: false)
279
+ assert_equal('200', resp.code)
280
+ assert_equal('hello get', resp.body)
281
+ end
282
+ end
283
+
284
+ test 'with insecure in transport section' do
285
+ on_driver_transport({ 'insecure' => 'true' }) do |driver|
286
+ driver.http_server_create_https_server(:http_server_helper_test_tls, addr: '127.0.0.1', port: PORT, logger: NULL_LOGGER) do |s|
287
+ s.get('/example/hello') { [200, { 'Content-Type' => 'text/plain' }, 'hello get'] }
288
+ end
289
+
290
+ resp = secure_get("https://127.0.0.1:#{PORT}/example/hello", verify: false)
291
+ assert_equal('200', resp.code)
292
+ assert_equal('hello get', resp.body)
293
+
294
+ assert_raise OpenSSL::SSL::SSLError do
295
+ secure_get("https://127.0.0.1:#{PORT}/example/hello")
296
+ end
297
+ end
298
+ end
299
+
300
+ data(
301
+ 'with passphrase' => ['apple', 'cert-pass.pem', 'cert-key-pass.pem'],
302
+ 'without passphrase' => [nil, 'cert.pem', 'cert-key.pem'])
303
+ test 'load self-signed cert/key pair, verified from clients using cert files' do |(passphrase, cert, private_key)|
304
+ cert_path = File.join(CERT_DIR, cert)
305
+ private_key_path = File.join(CERT_DIR, private_key)
306
+ opt = { 'insecure' => 'false', 'private_key_path' => private_key_path, 'cert_path' => cert_path }
307
+ if passphrase
308
+ opt['private_key_passphrase'] = passphrase
309
+ end
310
+
311
+ on_driver_transport(opt) do |driver|
312
+ driver.http_server_create_https_server(:http_server_helper_test_tls, addr: '127.0.0.1', port: PORT, logger: NULL_LOGGER) do |s|
313
+ s.get('/example/hello') { [200, { 'Content-Type' => 'text/plain' }, 'hello get'] }
314
+ end
315
+
316
+ resp = secure_get("https://127.0.0.1:#{PORT}/example/hello", cert_path: cert_path)
317
+ assert_equal('200', resp.code)
318
+ assert_equal('hello get', resp.body)
319
+ end
320
+ end
321
+
322
+ data(
323
+ 'with passphrase' => ['apple', 'cert-pass.pem', 'cert-key-pass.pem', 'ca-cert-pass.pem'],
324
+ 'without passphrase' => [nil, 'cert.pem', 'cert-key.pem', 'ca-cert.pem'])
325
+ test 'load cert by private CA cert file, verified from clients using CA cert file' do |(passphrase, cert, cert_key, ca_cert)|
326
+ cert_path = File.join(CERT_CA_DIR, cert)
327
+ private_key_path = File.join(CERT_CA_DIR, cert_key)
328
+
329
+ ca_cert_path = File.join(CERT_CA_DIR, ca_cert)
330
+
331
+ opt = { 'insecure' => 'false', 'cert_path' => cert_path, 'private_key_path' => private_key_path }
332
+ if passphrase
333
+ opt['private_key_passphrase'] = passphrase
334
+ end
335
+
336
+ on_driver_transport(opt) do |driver|
337
+ driver.http_server_create_https_server(:http_server_helper_test_tls, addr: '127.0.0.1', port: PORT, logger: NULL_LOGGER) do |s|
338
+ s.get('/example/hello') { [200, { 'Content-Type' => 'text/plain' }, 'hello get'] }
339
+ end
340
+
341
+ resp = secure_get("https://127.0.0.1:#{PORT}/example/hello", cert_path: ca_cert_path)
342
+ assert_equal('200', resp.code)
343
+ assert_equal('hello get', resp.body)
344
+ end
345
+ end
346
+ end
347
+ end
348
+
188
349
  test 'must be called #start and #stop' do
189
350
  on_driver do |driver|
190
351
  server = flexmock('Server') do |watcher|
@@ -195,7 +356,7 @@ class HtttpHelperTest < Test::Unit::TestCase
195
356
  end
196
357
 
197
358
  stub(Fluent::PluginHelper::HttpServer::Server).new(anything) { server }
198
- driver.create_http_server(:http_server_helper_test, addr: '127.0.0.1', port: PORT, logger: NULL_LOGGER) do
359
+ driver.http_server_create_http_server(:http_server_helper_test, addr: '127.0.0.1', port: PORT, logger: NULL_LOGGER) do
199
360
  # nothing
200
361
  end
201
362
  driver.stop