Commit graph

3669 commits

Author SHA1 Message Date
Ry Biesemeyer
d08c1574fd opening x-pack: make plugin install/remove error helpfully
Fixes #9239
2018-03-20 17:40:26 +00:00
Tudor Golubenco
32055b9eea Detect invalid proxy and raise error
As reported in #9132, if one sets `http_proxy=myproxy:8080` the URL
gets parsed to scheme=myproxy and host=nil. This results in a
NullPointerException.

To solve it, we check that the URL is valid as HTTP/HTTPs and raise a
slightly better error message.

Fixes #9132.

Fixes #9230
2018-03-15 18:17:08 +00:00
Jake Landis
233b805a82 Secret Store: Ability to set and use secret data from an encrypted data store.
Fixes #8657

Part 1: API and JavaKeyStore implementation (#8657)

Introduces the API to read/write/delete sensitive data from a secure store and includes a Java KeyStore implementation. Note - this commit does NOT integrate with the Logstash configuration or settings.

Part 2: Secret Store: SecretStoreFactory, SecureConfig, Obfuscation and X-JVM support (#8659)

*  Secret Store: SecretStoreFactory, SecureConfig, Obfuscation and X-JVM support

* Introduce a SecretStoreFactory to allow runtime definition of SecretStore implementation.
* Introduce a SecureConfig to allow simple configuration of different SecretStore implementaiton.
* Introduce random default password plus obfuscation. Best attempt at security through obscurity.
* Corrections / better support for x-JVM modification.

Part 3: Secret Store: SecretStore, SecretStoreFactory, JavaKeystore - refacactor (#8745)

* Adds more CRUD like operations for SecretStore API
* SecretStoreFactory Mirror API's CRUD operations
* Adds 'exists' to API to allow command line warning 'Overwrite ?'
* Minor readabiliy

Part 4: Integrate secret store with Logstash core (#8905)

This change introduces the command line tooling and hooks needed to allow Logstash to use the secret store. This change hooks into the same logic that the does the environment variable substitution. The commnad line mirrors the Elasticsearch command line, and is implemented primarily in Java.

Part 5: Hardening and test fixes (this PR)

Fixes #8935
2018-01-13 01:24:33 +00:00
Armin
835826085b BUILD: Execute RSPEC from JUnit
Fixes #8517
2017-10-26 19:57:54 +00:00
Armin
cd3b91dc5c #8216 Use standard name for Gemfile.lock
Fixes #8525
2017-10-26 08:33:03 +00:00
Armin
87f634fbb4 MINOR: Remove outdated Rubygems hack
Fixes #8534
2017-10-26 08:32:35 +00:00
Armin
f27f949e06 MINOR: Remove dead code supporting non-java platforms
Fixes #8513
2017-10-23 18:02:03 +00:00
Joao Duarte
bef5994dd1 fix a few issues with proxy handling when installing plugins
* allow installing a plugin using proxy without having to use the `--no-verify` flag
* allow the use of proxies that have basic authentication
* add tests for proxy handling in plugin manager

Fixes #8435
2017-10-05 11:50:34 +00:00
Pier-Hugues Pellerin
b94b24a7a1 Remove unecessary dependency file-dependencies
To understand why we can now remove this gem we have to go back at the
history of LS 1.5 and the choice we made back them. In the begining
plugins depending on external files like the `user-agent` or the `filter-geoip`
were not bundling theses files in the gem.

The `file-dependencies` was providing a new hook when plugins were
installed to trigger the file download.

In the context of making the plugins work in an offline environment we
need to make sure that every plugins external resources are present in
the gem.

We have currently a few plugins that require external files and they all
bundle it. So I think its safe to remove that feature, also the hook was
not triggered correctly. So it was a NOOP.

Fixes #8298
2017-09-18 18:56:58 +00:00
Colin Surprenant
d382248caf fixes for Windows platform tests/specs
use rm_rf to delete dir and shutdown pipeline after run

avoid the use of rescue nil, bad practice

do not mock close as it prevents closing the file an prevents removing it on Windows

cleanup temporary files and relax file name check for Windows

fix paths handling for Windows

flag the read file string as UTF-8 which is what we expect

fix Windows issues

ignore load_average on windows

windows safe URI

cleanup and fix file handling for windows

wait for pipeline shutdown to complete

revert to original puts

cleanups

use environment for windows platform check

fix hash path

wait for pipeline thread to complete after shutdown
2017-08-31 20:35:52 -04:00
Colin Surprenant
de6f8f8044 force UTF-8 encoding for gem file reading 2017-08-25 12:50:46 -04:00
Jake Landis
03767096ef Revert "always use JARS_SKIP when installing or updating plugins"
This reverts commit 628207e96c.

Fixes #8070
2017-08-24 23:46:59 +00:00
Joao Duarte
8e72b55659 always use JARS_SKIP when installing or updating plugins
Fixes #8058
2017-08-24 08:23:54 +00:00
Benjamin Dahon
2105b498ec Update default license (#7502)
* Update default license

The current value issues a warning when building: 

WARNING:  license value 'Apache License (2.0)' is invalid.  Use a license identifier from
http://spdx.org/licenses or 'Nonstandard' for a nonstandard license.
Did you mean 'Apache-2.0'?

* Update license

* Update license

* Update license
2017-06-22 10:05:57 -07:00
Christoph Wurm
385dda00b3 Properly catch connection refused error when installing plugin.
Fixes #7447
2017-06-14 12:52:06 +00:00
Pier-Hugues Pellerin
76286b4f0e use jruby 9.1.9.0
Work done by @guyboertje and @ph

Since JRuby 1.7.25 is now EOL we are migrating Logstash to use JRuby 9k and JDK8 only,
Not much needed updating to make this work, its was mostly a drop in replacement from the previous version.

The major point was the change in the implementation of Time in JRuby, JRuby now use `java.time`
instead of joda time, this allow JRuby to have nanoseconds precision on time object.
2017-06-12 12:35:10 -04:00
Pier-Hugues Pellerin
1113f0cffc refactor extract into 2 methods
Fixes #7065
2017-05-11 12:54:44 +00:00
Pier-Hugues Pellerin
276c6e9602 Check for empty string when configuring proxies
On some Linux system like debian, the `HTTP_PROXY` are set to an empty
string and was causing the plugin manager to raise an exception. We now
strip the string and check if it is empty before trying to configure the
proxies.

Fixes: #7045

Fixes #7065
2017-05-11 12:54:44 +00:00
Armin Braun
e6ea222c33 bundler.rb fixes for @pr review
Fixes #6985
2017-05-02 13:23:34 +00:00
Armin Braun
2f47cfd076 Allow copying a release template for Gemfile.jruby-1.9.lock.release
Fixes #6985
2017-05-02 13:23:34 +00:00
Armin Braun
8e9840f298 ignore .Gemfile.jruby-1.9.lock, .lock and Gemfile
Fixes #6985
2017-05-02 13:23:34 +00:00
Pier-Hugues Pellerin
4344e4b613 Allow Logstash to accept a PROXY configuration
Logstash's plugin manager will now follow proxy configuration from the environment.
If you configure `http_proxy` and `https_proxy`, the manager will now use theses information for all the ruby http
connection and will also pass that information down to maven.

Fixes: #6619, #6528

Fixes #6825
2017-03-31 14:20:38 -04:00
Pier-Hugues Pellerin
f74a7c9d56 Make sure prepare_offline_pack command only accept a filename
This PR changes the behavior of the command when you were specify a directory
instead of a filename, if the directory exists it would have deleted the
directory and the files in it.

The new flow and validation is now safer, if you specify a directory
Logstash will tell you to specify a complete filename.

If the ZIP extension is missing, the command line will ask you to make
sure you target a right filename.

If the output file already exist it will *not* delete it but instead
will return a warning message, you can force a delete by using the
`--overwrite` option.

Fixes: #6862

Fixes #6861
2017-03-31 11:05:17 -04:00
Josh Soref
a06dc211ff Spelling fixes (#6806)
Spelling fixes across the board.
2017-03-29 19:33:26 -07:00
Pier-Hugues Pellerin
c98b4ee1df Do not try to reach the artifact server when no plugins is given
This PR fix an annoyance when running the `bin/logstash-plugin install
--no-verify` without any plugins, the command was making an unnecessary
call to the artifacts web server.

Fixes #6826
2017-03-26 20:44:07 -04:00
Tal Levy
2e3b06b812 migrate core-queue-jruby into logstash-core (#6782) 2017-03-02 10:12:03 -08:00
Tal Levy
6fb8096a54 migrate logstash-core-event-java to logstash-core (#6760) 2017-03-01 15:31:17 -08:00
Jordan Sissel
2ed9022500 Open file in binary mode.
Fixes #6640
2017-02-06 00:02:59 -05:00
Pier-Hugues Pellerin
4377a76c88 Ignore NIL/EMPTY values for LOGSTASH_PACK_URL environment variable
Fixes #6611
2017-02-02 09:15:41 -05:00
Pier-Hugues Pellerin
b3906c89cd Allow to run the bin/logstash-plugin install <pack> outside of the Logstash directory
Fixes: #6599

Fixes #6602
2017-01-31 13:15:41 -05:00
Pier-Hugues Pellerin
fdda39964d Add bin/logstash-plugin prepare-offline-pack command
This new command replace the old workflow of `pack`, `unpack` and the `install --local`, and wrap all the logic into one uniform way of installing plugins.
The work is based on the flow developed for installing an x-pack inside Logstash, when you call prepare-offline-pack, the specified plugins and their dependencies will be packaged in a zip.
And this zip can be installed with the same flow as the pack.

Definition:

Source Logstash: Where you run the prepare-offline-pack.
Target Logstash: Where you install the offline package.

PROS:
- If you install a .gem in the source logstash, the .gem and his dependencies will be bundled.
- The install flow doesn't need to have access to the internet.
- Nothing special need to be setup in the target logstash environment.

CONS:
- The is one minor drawback, the plugins need to have their JARS bundled with them for this flow to work, this is currently the case for all the official plugins.
- The source Logstash need to have access to the internet when you install plugins before packaging them.

Usage examples:
bin/logstash-plugin prepare-offline-pack logstash-input-beats
bin/logstash-plugin prepare-offline-pack logstash-filter-jdbc logstash-input-beats
bin/logstash-plugin prepare-offline-pack logstash-filter-*
bin/logstash-plugin prepare-offline-pack logstash-filter-* logstash-input-beats

How to install:
bin/logstash-plugin install file:///tmp/logstash-offline-plugins-XXXX.zip

Fixes #6404
2017-01-03 13:59:49 -05:00
Pier-Hugues Pellerin
f227610418 Make it work with update too
Fixes #6410
2016-12-16 10:27:33 -05:00
Pier-Hugues Pellerin
2d000ca146 Turn off any jar-dependencies lookup when running install command with --local
Fixes: #6386

Fixes #6410
2016-12-16 10:27:33 -05:00
Pier-Hugues Pellerin
2a281730c1 Explicitely require LogStash::Bundler.setup! make the plugin install process to require internet access
Fixes: #6386

Fixes #6388
2016-12-13 09:43:57 -05:00
Pier-Hugues Pellerin
91e6881698 Do not clean unused gems after updating gems
The are a difference between the gems installed and the available spec
loaded in memory making bundler remove the gem that we have just
updated.

Fixes: #6339

Fixes #6340
2016-12-01 18:57:07 -05:00
Pier-Hugues Pellerin
bf2d670d2a Logstash-docgen tool v2
**Motivation**: We have decided to rewrite the documentation generator to add more features
to our documentation and to fix some outstanding bugs.

This PR addresses the following problem:
- Hard to add new features to the code base.
- The code was tied with Logstash.
- No easy way to publish the doc for a single plugin
- The plugin author was not able to test their documentation changes
- The reported errors were hard to understand.
- No easy way to automate it.
- the minimal requirement on base classes.

Fixes #5720
2016-11-30 19:57:40 -05:00
Pier-Hugues Pellerin
d669540123 Relax the acceptance test expectation to match only the exception message
Fixes: #6310

Fixes #6325
2016-11-29 14:24:36 -05:00
Pier-Hugues Pellerin
12cfa69215 Feature: A way to install/remove a plugin pack
A pack in this context is a *bundle* of plugins that can be distributed outside of rubygems; it is similar to what ES and kibana are doing, and
the user interface is modeled after them. See https://www.elastic.co/downloads/x-pack

**Do not mix it with the `bin/logstash-plugin pack/unpack` command.**

- it contains one or more plugins that need to be installed
- it is self-contains with the gems and the needed jars
- it is distributed as a zip file
- the file structure needs to follow some rules.

- As a reserved name name on elastic.co download http server
    - `bin/plugin install logstash-mypack` will check on the download server if a pack for the current specific logstash version exist and it will be downloaded, if it doesn't exist we fallback on rubygems.
    - The file on the server will follow this convention `logstash-mypack-{LOGSTASH_VERSION}.zip`

- As a fully qualified url
    - `bin/plugin install http://test.abc/logstash-mypack.zip`, if it exists it will be downloaded and installed if it does not we raise an error.

- As a local file
    - `bin/plugin install file:///tmp/logstash-mypack.zip`, if it exists it will be installed

Fixes #6168
2016-11-17 14:00:02 -05:00
Pier-Hugues Pellerin
6626fa897c This PR changes two things:
- Allow plugins author to decide how their plugins are structured
- Allow a new kind of plugin that allow plugins author to add hooks into logstash core.

Fixes #6109
2016-11-11 09:43:43 -05:00
Guillaume Le Floch
ab8a5f3cf9 remove duplicate list subcommand
When running `./logstash-plugin --help`, there was twice time the list sub command

Fixes #6205
2016-11-07 17:59:38 -05:00
Colin Surprenant
761f9f1bc9 merge feature/java_persistence into master 2016-11-01 17:13:23 -04:00
Suyog Rao
44a52ff18e Deprecate uninstall for Plugin Manager
Adds remove and deprecates uninstall

Fixes #6041

Fixes #6042
2016-10-13 10:12:22 -04:00
Pier-Hugues Pellerin
ddfaa900f6 Silence require_jar warning
Fixes #5836
2016-08-26 14:43:12 -04:00
Andrew Cholakian
33c0a8e89d Add new Codec#encode_sync, Codec#multi_encode and Output#multi_receive_encoded methods.
These methods allow outputs to receive their events pre-encoded for them
by the pipeline. This is mostly useful in the context of `#shared` outputs, for whom
encoding a discrete batch in a threadsafe way is not necessarily straightforward.

It would be advised for codecs to prefer `#multi_encode` as the main way of operating
as the standard `#encode` method is not threadsafe.

Fixes #5770
2016-08-22 14:08:04 -04:00
Suyog Rao
5c7196a5e8 Remove use of map
Fixes #5740
2016-08-08 16:33:01 -04:00
Suyog Rao
288728c735 Fix warning when no local plugins are found
Fixes #5740
2016-08-08 16:33:01 -04:00
Suyog Rao
d5f1a24788 Remove validate warning because its useless
Fixes #5686

Fixes #5729
2016-08-04 17:31:37 -04:00
Joao Duarte
a859bd4a3f add single command release task and other release support tooling
Purpose:

* manage releases through a minimum number of rake tasks
* simplify building of snapshot builds
* create staged artifacts, candidates for releases, that required no changes to become releases
* this means the snapshot release process will not involve publishing gems, therefore:
* the gem artifacts should only be published to rubygems as a final artifact, at the time of GA

Changes:

* release artifacts no longer depend on gems of core components
* all core components are used locally AS-IS to minimize code changes between snapshot, RC and GA
* `versions.yml` describes the versions of all logstash parts and package
  * `rake version:set[version]` manage the yaml file and push the changes to the gemspecs/version.rb files
  * `rake version:set_plugin_api[version]` manage the yaml file and push the changes to the gemspecs/version.rb files
  * `rake artifact:all` generates SNAPSHOT artifacts: tar.gz, zip, rpm, deb
  * `RELEASE=1 rake artifact:all` creates release candidate artifacts + 4 gems: logstash-core, logstash-core-event, logstash-core-event-java and logstash-core-plugin-api

implements #5416 and #5414

Fixes #5460
2016-06-20 04:23:48 -04:00
Pere Urbon-Bayes
829af589cd wrap usage of Gems.versions withing a patch that forces UTF-8 encoding
locate the patch to his own location

rename patches directory

Fixes #5486
2016-06-15 06:45:43 -04:00
Pere Urbon-Bayes
f4fd8943e7 add codec as a new kind of templates in the plugin generator
Fixes #5421
2016-06-01 16:15:37 +00:00