Commit graph

3659 commits

Author SHA1 Message Date
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
Matthew L Daniel
cf49aab8b4 Ensure config-string matches the real defaults
Since the defaults are constant strings, ensure the `I18n` text uses the
same defaults as does the Ruby code

Also, update the comment about line length to match the "55" that is
both correct and used further down in the file.

Fixes #1456
2015-07-22 12:49:57 -07: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
Joao Duarte
e370ff5476 move reporter code to separate file and change report format
Fixes #3484
2015-07-13 22:45:51 +00:00
Joao Duarte
84be8d34a6 add a periodic report of inflight events
Fixes #3484
2015-07-13 22:45:51 +00: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
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
Colin Surprenant
535027dfd9 use Environment.jruby?
Fixes #3450
2015-06-19 21:39:50 +00:00
Andrew Cholakian
cad497655e Tighten up JavaVersion.version
Fixes #3452
2015-06-19 19:07:25 +00:00
Andrew Cholakian
3d57f5fd0a Log bad java version as well as printing it to stderr
Fixes #3452
2015-06-19 19:07:24 +00:00
Andrew Cholakian
b91f01e8fe Better comments on JavaVersion
Fixes #3452
2015-06-19 19:07:24 +00:00
Andrew Cholakian
64b66fd6a5 Use implicit rather than explicit return
Fixes #3452
2015-06-19 19:07:23 +00:00
Andrew Cholakian
259f3daeb2 Return explicit false on bad java version
Fixes #3452
2015-06-19 19:07:22 +00:00
Andrew Cholakian
f57cd98a91 Correctly support java 2.x.x in java version check should that ever happen
Fixes #3452
2015-06-19 19:07:21 +00:00
Andrew Cholakian
b0cc23ff37 Stronger warning on bad java version
Fixes #3452
2015-06-19 19:07:21 +00:00
Andrew Cholakian
5729fb9a0a Check java versioning
Fixes #3452
2015-06-19 19:07:20 +00:00
Pier-Hugues Pellerin
280db59a3a Remove old methods, use a module for the singleton
Fixes #3425
2015-06-18 17:59:50 +00:00
Pier-Hugues Pellerin
8a78be0c48 matches cannot be nil
Fixes #3425
2015-06-18 17:59:49 +00:00
Pier-Hugues Pellerin
050c6badad comments
Fixes #3425
2015-06-18 17:59:48 +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
Pier-Hugues Pellerin
fcf8d783fa Add a caching mechanism for the #sprintf calls
This PR allow the Event class to compile a `sprintf` the first time and
reuse the template for the other calls. This strategy speeds up considerably
calls that uses date formatting or use fieldref its a bit slower if you
dont do any string manipulation.

Fixes #3425
2015-06-18 17:59:47 +00:00
Pere Urbon-Bayes
4677f0a54b add a validation fase with a warning in case you're updating plugins to a new major version
Fixes #3423
2015-06-17 10:05:58 +00:00
Jason Woods
93882095e4 Show errors encountered when validating a plugin rather than saying it does not exist
Fixes #3407
2015-06-11 14:17:26 +00:00
Joao Duarte
fa4f72833c allow forced termination through a second sigint
Fixes #3379
2015-06-09 14:35:34 +00:00
Jordan Sissel
68b8693612 Deprecate the input plugin's base charset setting.
Refer uses to the codecs instead.

Fixes #3044

Fixes #3395
2015-06-09 02:07:48 +00:00
Pere Urbon-Bayes
0d82ae87c1 fix the issue caused by jruby-kafka that prevent to run the packaging
Fixes #3393
2015-06-08 17:25:41 +00:00
Pier-Hugues Pellerin
d2a82b6a77 Remove the synchronize on the flush_filters_to_ouputs!
We were synchronizing on the tick and the flush call,
in some situation it could set logstash in a deadlock when the queue was
blocked and the tick occurred. The flush call was already thread safe
since only one worker can start the flushing process.

Fixes #3378
2015-06-08 15:14:01 +00:00
Pere Urbon-Bayes
d44e6e15a3 fix the uninstall of plugins
Fixes #3362
2015-06-08 13:13:07 +00: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
Shaunak Kashyap
43b13e033c Replacing mailing list address with discussion forum address.
Fixes #3366
2015-06-04 19:20:04 +00:00
Joao Duarte
a4b112ae14 allow parameters in peeraddr monkey patch
Fixes #3365
2015-06-03 09:06:58 +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
0bb827c4fe Make sure we correctly patch the thin bootstrap layer of the distribution
Fixes #2701
2015-05-27 17:14:00 +00:00
Pier-Hugues Pellerin
dc88956362 Override bundler behavior to save config to the .bundle/config file
Fixes #2701
2015-05-27 17:13:59 +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
214f3b9e44 Allow to update all the plugins and skip locally defined gems fixes #3157
Review comments

Fixes #3179
2015-05-11 14:15:14 +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
7a1ec64c23 use :build dependencies
fix octokit dep

fixes #3171
2015-05-06 08:27:57 -04:00