Commit graph

767 commits

Author SHA1 Message Date
Pere Urbon-Bayes
ae4c49be3b Exclude pre releases when checking if the update is targetting a major release in the plugin manager, as bundler is not going to update anyway to this version without an explicit install command.
Fixes #3826
2015-09-02 21:17:02 +00:00
Andrew Cholakian
f2fcc41aee Non Oracle Javas are all detected as 'good'
Fixes #3824
2015-08-31 14:16:13 +00:00
Pere Urbon-Bayes
028d76497c add the missing magic header # encoding: utf-8 so all internal strings are UTF-8 in Ruby < 2.0
Fixes #3723
2015-08-17 13:30:07 +00:00
Pere Urbon-Bayes
45e768e833 makes sure that all property interpolation throught event.sprintf are returned in UTF-8
Fixes #3718
2015-08-17 13:21:24 +00:00
Andrew Cholakian
9e88c90b28 Handle non-hotspot javas in version check
Fixes #3685
2015-08-03 21:25:58 +00:00
Pier-Hugues Pellerin
cbfd1eebf5 Do not force a verify_mode with a our stronger ssl settings
We have discovered that in some cases and some plaftorms
configuring a default `verify_mode` when creating a SSL/TCPServer
could make the certificate verification fail. Ruby default behavior is
to use `NIL` when creating a new ssl context, this revert that change.

keep in mind that all TCP clients using SSL **must** use `VERIFY_PEER`
as their verify mode to prevent man in the middle attack.

Fix: https://github.com/elastic/logstash/issues/3657
2015-07-31 20:56:11 -04:00
Colin Surprenant
52aec3b244 add back --pluginpath option
support adding plugin paths

support --pluginpath option

missing doc

refactor using @purbon suggestions

Agent#configure_plugin_paths spec

solves #3580
2015-07-15 16:43:13 -04:00
Jordan Sissel
fbf8e1e320 Improve default security for SSLContext with a monkeypatch.
New defaults:
* Cipher suite based on Mozilla's Intermediate set from
  https://wiki.mozilla.org/Security/Server_Side_TLS (at time of writing)
* Disable SSLv2 explicitly
* Disable SSLv3 explicitly
* Disable compression if possible

The SSL option setting came from the ruby-ftw library's FTW::Connection
(apache 2 licensed, I am author), and transitively through work
published by jmhodges to improve Ruby's SSL strength.

I include specs to ensure we never include export or weak ciphers by
default.

Using this patch to test the security improvements according to
`www.howsmyssl.com` shows much improved results:

---

Testing this:

```
ruby -r ./lib/logstash/patches/stronger_openssl_defaults.rb  -ropenssl -rsocket -rjson -rawesome_print -e 'c = OpenSSL::SSL::SSLContext.new; t = TCPSocket.new("www.howsmyssl.com", 443); o = OpenSSL::SSL::SSLSocket.new(t, c); o.connect; o.puts "GET /a/check HTTP/1.1\r\nHost: www.howsmyssl.com\r\n\r\n"; headers,body = o.read.split("\r\n\r\n", 2); puts body'
```

(I processed the JSON output w/ jq for easier reading)

The purpose of the above is to test the default behavior of SSLContext.

* JRuby 1.7.19 w/ this patch reports no cipher problems.
* JRuby 1.7.19 without this patch has several weak ciphers used:

```
  "TLS_DHE_DSS_EXPORT_WITH_DES40_CBC_SHA: [\"uses keys smaller than 128 bits in its encryption\"]",
  "TLS_DHE_RSA_EXPORT_WITH_DES40_CBC_SHA: [\"uses keys smaller than 128 bits in its encryption\"]",
  "TLS_DHE_RSA_WITH_DES_CBC_SHA: [\"uses keys smaller than 128 bits in its encryption\"]",
  "TLS_RSA_EXPORT_WITH_DES40_CBC_SHA: [\"uses keys smaller than 128 bits in its encryption\"]",
  "TLS_RSA_EXPORT_WITH_RC4_40_MD5: [\"uses keys smaller than 128 bits in its encryption\",\"use RC4 which has insecure biases in its output\"]",
  "TLS_RSA_WITH_DES_CBC_SHA: [\"uses keys smaller than 128 bits in its encryption\"]",
  "TLS_RSA_WITH_RC4_128_MD5: [\"use RC4 which has insecure biases in its output\"]",
  "TLS_RSA_WITH_RC4_128_SHA: [\"use RC4 which has insecure biases in its output\"]"
```

Under MRI, similar cipher selection problems are observed without this patch (weak export
ciphers, other weak small-key ciphers, RC4 complaints). With this patch, no cipher complaints
are reported by www.howsmyssl.com

One other note: Because JRuby defaults to TLS 1.0 and only makes CBC ciphers
available under the Mozilla Intermediate cipher set, I believe (and
howsmyssl.com agrees) that these defaults still make the BEAST exploit a
problem. Switching to TLS 1.1 should fix this, but we need to do more research
to determine the what, if any, impact it will have if we force TLS 1.1 to be
the default..

Fixes #3579
2015-07-13 21:41:15 +00:00
Andrew Cholakian
f7b76fa2ae Fix namespacing for unicode trimmer
Fixes #3593
2015-07-10 21:34:52 +00:00
Joao Duarte
d7bfd25dab make plugin#inspect show number config parameters
Fixes #3564
2015-07-10 15:24:24 +00:00
Pere Urbon-Bayes
bd7516108f workarround the version check for pre released plugins as looks like rubygems is not activating them by default
Add a pre release gem test by using a mock to reproduce the behaviour
reaised by Gem::Specification.find_by_name when dealing with pre release
gems.

Fixes #3476
2015-07-02 16:06:48 +00:00
Pere Urbon-Bayes
a81f0249b1 locate plugin manager command dependencies to the specific commands as it should be
Fixes #3509
2015-07-02 14:17:50 +00:00
Pere Urbon-Bayes
40c57454a2 introduce direct loading for modules that need to be loaded in a given order becuase of missing dependencies, this fix the issue we had with early released of JDK7 and linux systems
Fixes #3509
2015-07-02 14:17:49 +00:00
Pier-Hugues Pellerin
3f38575758 Wrong namespace for json serialization
Fixes #3536
2015-06-30 20:53:14 +00:00
Andrew Cholakian
f0e5bcd597 Make inspecting collections a bit more friendly
Fixes #3474
2015-06-30 17:02:58 +00:00
Andrew Cholakian
13ed78790f Add unicode trimmer utility function
Fixes #3505
2015-06-26 20:13:59 +00:00
Pier-Hugues Pellerin
1380119ac8 Removing reference of fieldreference
Fixes #3467
2015-06-26 17:35:46 +00:00
Pere Urbon-Bayes
cf10890d63 fix the coverage analysis throw simplecov to take care of all files
make the eager loading patterns consistent in the spec_helper.rb file

make the setup-simplecov task not a dependency, but an explicit task only executed when ENV['COVERAGE'] is defined

refactor eager loading code plus add some documentation to the setup-simplecov task

Added more comments to the test:setup task

Fixes #3465
2015-06-25 15:36:57 +00:00
wiibaa
e715248b4a harmonize add_field and add_tag behavior in inputs and filters
Fixes #2390
2015-06-24 20:52:14 +00:00
Andrew Cholakian
193d6096e1 DRYed up java version tests
Fixes #3452
2015-06-19 19:07:23 +00:00
Andrew Cholakian
9c23cf7b09 Expand out some combined test cases
Fixes #3452
2015-06-19 19:07:23 +00:00
Andrew Cholakian
5fd8d54e97 Use subject instead of let
Fixes #3452
2015-06-19 19:07:22 +00:00
Andrew Cholakian
259f3daeb2 Return explicit false on bad java version
Fixes #3452
2015-06-19 19:07:22 +00:00
Andrew Cholakian
5729fb9a0a Check java versioning
Fixes #3452
2015-06-19 19:07:20 +00:00
Pere Urbon-Bayes
a00e26bacb add LGPL as valid licence for logstash runtime dependencies
Fixes #3466
2015-06-18 18:23:12 +00:00
Pier-Hugues Pellerin
896a91d872 Bad interpolation when issue mixed template like foo %{bar} %{+YYYY}
Fixes #3425
2015-06-18 17:59:48 +00:00
Pere Urbon-Bayes
1754d896a1 add small comment about the licenses
Fixes #3426
2015-06-18 08:34:58 +00:00
Pere Urbon-Bayes
954c983d1f applyed improvements comming out of the review
Fixes #3426
2015-06-18 08:34:58 +00:00
Pere Urbon-Bayes
eb64b35d39 add a runtime license test
Fixes #3426
2015-06-18 08:34:57 +00:00
Pere Urbon-Bayes
e2450f1f78 Make the necessary changes to use rspec3 as a default test runner for
logstash, including adapting the test suites that were still using 2.x
syntax.
2015-06-08 12:19:11 +02:00
Colin Surprenant
3d1847aecc fix accessors field references caching performance regression
correct use of @lut and cleanups

leftover

added docs and renamed a few identifiers for clarity

typos

remove strict_set stuff since its not used anymore

removed unused specs

PathCache thread safety
2015-06-05 15:18:19 -04:00
Pier-Hugues Pellerin
37d1033b88 Add support for multiline conditionals with the else if statements
This is a followup of the issues #2850 and #3281.

The following configuration:

    if [condition] {

    } else if [condition1]
      or [condition2] {
        ..
    }

Was compiled to ruby like this:
    elsif condition or condition2 # else if [condition1]
      or [condition2]

and making the intepreter fails.

Fixes #3386
2015-06-05 18:35:57 +00:00
Pier-Hugues Pellerin
6d02988142 Better implementation of the no .bundle/config that respect the bundler contract in a running process
The previous fix for disabling the `.bundle/config` wasn't not respecting the bundler contract.
The failling tests were not wrong, in fact they exposed the issue that the configuration was transient and the underlying hash of bundler was not correctly keeping the updated values.

This patch make sure the hash is updated with the new or deleted value without persisting the change to disk.

Fixes #3332
2015-05-28 00:52:53 +00:00
Pier-Hugues Pellerin
aa036b9b8d Settings doesnt persist the values to the bundle/config
Fixes #3330
2015-05-27 21:19:36 +00:00
Jordan Sissel
99741e57a2 Strip line terminators when writing the comment for a branch
Logstash's config compiler adds a comment to the compiled code, like

    if ..... # if [your] and [conditional]

The idea is to to help aid in reading the compiled logstash config.
However, if a conditional has newlines in it, the `#text_value` of
that conditional will have newlines, and we'll accidentally create
invalid ruby code which will fail with SyntaxError.

Prior to this change, the following Logstash config, under 1.5.0,
would cause a crash on startup:

    if [some]
      or [condition] {
      ...
    }

The cause was that Logstash would compile this to:

    if event("[some]"]) || event("[condition]") # if [some]
    or [condition]
      ...
    end

The 2nd line there `or [condition]` was intended to be on the line
above.

This change strips the line terminators \r and \n, just in case, and
provides a test case to cover.

I verified that this test case _fails_ without the config_ast.rb patch
and _succeeds_ with the patch.

Fixes #2850

Fixes #3281
2015-05-19 20:01:05 +00:00
Pere Urbon-Bayes
26f6be3aed Revert "fix string interpolation error when transforming characters to UTF8 in the configuration compiler"
This reverts commit 65c789a24c.

Fixes #3264
2015-05-18 16:14:12 +00:00
Pere Urbon-Bayes
65c789a24c fix string interpolation error when transforming characters to UTF8 in the configuration compiler
Fixes #3259
2015-05-18 13:09:13 +00:00
Pier-Hugues Pellerin
fe99f45499 Initialize the metadata_accessors when setting the @metadata with a hash
Fixes #3198
2015-05-08 13:52:58 +00:00
Colin Surprenant
48bcc5b74d cleanup dependencies and rely on logstash-core gem
remove unused load path

use either local core lib dir or logstash-core gem

include spec in logstash-core

do not include lib, spec and locales dirs in package root

environment bootstrapping in lib/bootstrap.rb

added comments

move pluginmanager out of logstash-core

kafla installation solved by pluginmanager refactor

refactor bootstrap code

refactor shell scripts to simplify and DRY, indirect rspec command to our ruby launcher

add bin/rspec

cut by half the bin/plugin and bin/rspec startup time

fix drip context

use printf instead of tr

updated Windows bin scripts

missing gemspec in gemspec

use gem instead of gemspec so our plugin manager can correctly install logstash-core

generate packages including locally built logstash-core gem

move jenkins developmnent dependencies into Gemfile, they do not belong in logstash-core

path leftover

clean help agent help usage message and remore rspec in available command

comments cosmetics

update Bundler dependency, all recent testing have been made with 1.9.4

updated .lock file with regard to updated Gemfile

cleanup gemspec, Gemfile and regen .lock file

added progress output

avoid dual require on version

closes #3096
2015-05-04 18:17:22 -04:00
Colin Surprenant
3dabba80fa revert multi_filter removal and add check for cancelled events
add filter and flush compiles functions specs

missing multiline filter for core specs

fixes #3100
2015-04-27 13:54:18 -04:00
Pier-Hugues Pellerin
cc3f9d6ac4 Do not return an empty metadata key hash when calling to_hash_with_metadata
Fixes #3034
2015-04-20 22:59:04 +00:00
Colin Surprenant
cbb225db35 fix for Java 8 Map merge method conflict
typo

DRYied code, comments, cleanup

added spec

specs DRYing

also test HashMap, refactor with shared_example

fixes logstash-plugins/logstash-filter-multiline#10
2015-04-17 14:40:50 +02:00
Colin Surprenant
ae17b4160d refactored all gem/bundler code into logstash/bundler.rb and moved patches into logstash/patches
require bundler/cli to expose expectations classes
2015-04-16 17:34:51 +02:00
Joao Duarte
3eb5ba6450 remove multi_filter 2015-04-15 23:18:32 +02:00
Colin Surprenant
573149b002 refactor conditionals generation
added specs
2015-04-15 23:16:06 +02:00
Tal Levy
2e1b879431 fix include to support nil and array types
Closes logstash-plugins/logstash-filter-mutate/#21.

Fixes #3023
2015-04-15 20:35:17 +00:00
Colin Surprenant
98a5f2348c fix java enumerable integration bug
Fixes #3022
2015-04-15 19:59:18 +00:00
Pier-Hugues Pellerin
b233a34ce9 do not use subject an an explicit call
Fixes #2731
2015-04-15 14:22:09 +00:00
Pier-Hugues Pellerin
26c5a5ff61 updated the tests, exceptions are raised from the invoke_bundler!
Fixes #2731
2015-04-15 14:22:09 +00:00
Pier-Hugues Pellerin
8b2a6b054b adding spec to guard the invoke bundler behavior
Fixes #2731
2015-04-15 14:22:09 +00:00