Commit Graph

1624 Commits

Author SHA1 Message Date
Chris Cowan 1559bdfc26 removing stuff from README
Original commit: elastic/x-pack-elasticsearch@801c5d8eb4
2015-06-01 14:05:43 -07:00
Chris Cowan e3538c1105 Adding some instructions to the readme
Original commit: elastic/x-pack-elasticsearch@379b0a76c8
2015-06-01 14:04:43 -07:00
Chris Cowan 406f9da884 Merge branch 'master' of github.com:elasticsearch/elasticsearch-marvel into watchers
Original commit: elastic/x-pack-elasticsearch@08fe1eb036
2015-06-01 13:57:37 -07:00
jaymode a12eba49fa make encryption and decryption tolerant to missing key
Today, an exception is thrown when calls to the encrypt and decrypt methods are
made without a key being present. For now, we will not require the system key and
this behavior is undesirable.

This commit changes the behavior to just return the provided characters or bytes
when no key is present. Additionally, a method has been added for callers to see
if encryption is supported. Finally, the listener interface has been made public and
expanded to provide the old keys when the keys are changed. This allows
consumers to decrypt with the old key and re-encrypt with the new key.

Original commit: elastic/x-pack-elasticsearch@de3d5b6180
2015-06-01 13:47:09 -04:00
jaymode 5309353745 allow authentication exceptions for unauthorized anonymous users
Today, we always throw an AuthorizationException for an unauthorized user. This is
problematic when anonymous access is enabled and the HTTP client being used
does not support preemptive basic authentication as only the anonymous user
will be used by such a client.

This change adds a setting to allow an AuthenticationException to be thrown for
anonymous users. This will clients such as browsers to work with anonymous
access and authenticated access.

Closes elastic/elasticsearch#853

Original commit: elastic/x-pack-elasticsearch@d338b468c7
2015-06-01 09:40:55 -04:00
jaymode d393cc2740 do not attempt to resolve permissions in the esusers tool
The esusers tool reads the list of roles to provide validation feedback to the user,
however since we have added custom roles the tool doesn't know about these roles
as they come from outside of Shield. When a custom role was found, a warning
was printed that can be confusing to users.

Now when validating roles, we only read the names from the roles.yml file.

Closes elastic/elasticsearch#835

Original commit: elastic/x-pack-elasticsearch@89d0e3efce
2015-06-01 09:07:10 -04:00
jaymode 03520e0aa7 [CLI] check the number of arguments for esusers commands
Adds a check to all of the esusers commands to ensure the correct number
of arguments are found. If extra arguments are found, they are printed out
with an error message and the tool exits.

Closes elastic/elasticsearch#817

Original commit: elastic/x-pack-elasticsearch@cd3e786267
2015-06-01 08:21:31 -04:00
jaymode b8f75a2bae Netty: reduce logging for a close request during handshake
Reduces the amount of logging on both HTTP and Transport protocols for
a channel being closed while in the middle of a handshake. This often
occurs when the client does not trust the server certificate and aborts the
handshake. Also, reduces logging on the Transport protocol for a
plain text message received on a channel that is using TLS.

Closes elastic/elasticsearch#771

Original commit: elastic/x-pack-elasticsearch@321c384ddd
2015-06-01 08:04:55 -04:00
jaymode 6e660dbd7d remove commons codec dependency
This commit removes the commons codec dependency and simplifies the
hasher code by only supporting bcrypt encryption in the users file. All tests
now also exercise the esusers realm with bcrypt instead of plain text passwords.

Closes elastic/elasticsearch#806

Original commit: elastic/x-pack-elasticsearch@3119267851
2015-06-01 07:52:38 -04:00
Martijn van Groningen 47247dc46a Stats api: fix serialization issue
Renamed pending watches left overs to queued watches

Original commit: elastic/x-pack-elasticsearch@c2bcdf547c
2015-05-31 13:14:32 +02:00
Martijn van Groningen 0890001470 stats: Add queued watches metric
The queued watches metric gives insight into the watches that are queued for execution.
Per watch that is queued, executing information is shared, like the `watch_id`,
when the watch was triggered and when execution started.

Original commit: elastic/x-pack-elasticsearch@deb5ddfde2
2015-05-31 11:13:13 +02:00
Martijn van Groningen 4335669635 Refactoring: Introduced TriggeredWatch concept.
Before WatchRecord was used to keep track of an execution of a Watch and used to store actual end results to it before sealing it. (for example build dashboard on the history indices)

The keeping track of an execution has been moved from WatchRecord to TriggeredWatch. If a watch triggers a TriggeredWatch is stored. The TriggeredWatch has its own index and only the watch_id (is part of id), trigger event and state is stored. If the execution of a Watch has finished (regardless if it was successfully) a WatchRecord is stored in a history index and the TriggeredWatch is deleted.

When a watch is getting executedtThe triggered watch is used the create the watch context.

Also the WatchRecord.State has been removed to its own enum class named ExecutionState. The CHECKING value has been removed, because it wasn't really used. The CHECKING state was set when the execution began, but it was never persisted and because of this state has also been removed from triggered watch.

By separating the result of a watch execution we are more flexible to in the future change the document format of WatchRecord. The history indices will be used by users to build analytics on top of watcher. Also the history indices become truely append only indices.

When update the watch status, only change the status part with the update api
Also set the version when we delete the watch on the in memory instance enforce more ensureStarted() in the components

Removed all watch record and result parsing code (actions, conditions, inputs and transforms)

Original commit: elastic/x-pack-elasticsearch@8f5ffdac13
2015-05-30 17:59:24 +02:00
Areek Zillur 900ea3cd20 fix XContextSerialization test failure
Original commit: elastic/x-pack-elasticsearch@f2e1b19214
2015-05-29 16:29:13 -04:00
jaymode ba1001a3a4 update BCrypt implementation to version 0.4
This updates the BCrypt implementation that we use to version 0.4, which
corrects an integer overflow bug when a large number of rounds are used.

Closes elastic/elasticsearch#865

Original commit: elastic/x-pack-elasticsearch@2f9a07e7c8
2015-05-29 13:52:39 -04:00
jaymode 2e4f3e8d23 make TLSv1.2 the default protocol
This commit makes TLSv1.2 the default protocol for better security. The
old value of TLS would only pick a TLSv1.0 supporting context and cause
client connections to be negotiated using that protocol when TLSv1.2 is
supported and considered an improved protocol.

Closes elastic/elasticsearch#867

Original commit: elastic/x-pack-elasticsearch@1f062f6dde
2015-05-29 13:46:48 -04:00
jaymode 44017711e2 remove DHE cipher from default list
This commit removes the DHE cipher from our list of enabled ciphers
due to the recently published Logjam attack. The default configuration
is not susceptible to the Logjam attack, but since we support Java 7
the maximum prime size (768 bit) is considered too weak. Java 8 supports
1024 bit primes, but these are also not ideal and this cipher should not be
used with a prime smaller than 2048 bits.

Closes elastic/elasticsearch#862

Original commit: elastic/x-pack-elasticsearch@9785bf47cf
2015-05-29 13:33:54 -04:00
jaymode c01eef8863 Test: update with new core actions and upgrade api changes
Original commit: elastic/x-pack-elasticsearch@0189cf850f
2015-05-29 09:16:31 -04:00
uboness 6175b9efda Disallow negative time value settings
- Consolidated setting validation under `WatcherSettingsValidation`
- `WatcherSettingsException` is now only used for settings errors

We need this consolidation as Guice doesn't deal well with exceptions in constructors. So instead, `WatcherSettingsValidation` can be injected and used as a registry for settings errors and then, since it's a service, if there any registered errors, it'll throw `WatcherSettingsException` when it's started.

Fixes elastic/elasticsearch#539

Original commit: elastic/x-pack-elasticsearch@2c1895d18c
2015-05-28 23:24:18 +02:00
Martijn van Groningen f66f460313 test: removed @Seed
Original commit: elastic/x-pack-elasticsearch@aafc29f3b1
2015-05-28 12:40:33 +02:00
jaymode 9643ec2c62 add support for separate keystore and truststore in HttpClient
The HttpClient class tried to use the truststore as a keystore for watcher with Shield fallback.
This is trappy because in Shield, the default is to only have a keystore that also acts as the
truststore, so the fallback would probably fail in most cases. Additionally, support was missing
for a keystore that had a separate key password.

The new behavior allows for specifying both a keystore and a truststore. If only a keystore is
specified, it will also be used as the truststore. If neither is defined, the system truststore will
be used. All settings fallback to shield settings.

Closes elastic/elasticsearch#480

Original commit: elastic/x-pack-elasticsearch@ad02814806
2015-05-28 06:04:40 -04:00
uboness 45d0fdf3de Changed Execute Watch API response format
- the response now returns the id of the stored watch record
- update/fixed the docs

Closes elastic/elasticsearch#538

Original commit: elastic/x-pack-elasticsearch@5df7d166f4
2015-05-27 21:18:16 +02:00
uboness fb893e774a Add the ability to ack specific actions
- now it's possible to ack specific actions via the `Ack Watch API`
- Added tests for acking specific actions
- Changed the watch status structure such that the action ack state can be referred to by `status.actions.<action_id>.ack` (instead of `status.actions.<action_id>.ack_status`... removed the extra redundant "_status")
- As part of this work, also added validation for watch/action ids, such that we disallow having whitespaces in them.
- Updated the docs around acking & throttling of watch actions

Closes elastic/elasticsearch#531
Closes elastic/elasticsearch#537

Original commit: elastic/x-pack-elasticsearch@813e601bf5
2015-05-27 19:29:46 +02:00
jaymode 84c5115889 Test: use URI so paths work on Windows
Original commit: elastic/x-pack-elasticsearch@3e6a185ac4
2015-05-27 06:55:19 -04:00
jaymode fb7cbbe581 fix compilation due to renamed transport actions
Original commit: elastic/x-pack-elasticsearch@fca64087dd
2015-05-27 06:42:42 -04:00
jaymode 24d63b1eef fix compilation after renamed transport actions
Original commit: elastic/x-pack-elasticsearch@3deb3b184f
2015-05-27 06:31:29 -04:00
jaymode 7c4ce5760f Test: workaround JNA being required on windows now
Adds JNA as a test time dependency to work around it being required on
windows in elasticsearch core.

Original commit: elastic/x-pack-elasticsearch@b8fc70a051
2015-05-26 15:26:01 -04:00
jaymode 39915f92bc update shield to depend on elasticsearch 2.0
This commit is a squashed commit of work done in conjunction with @rmuir to make
shield work properly with elasticsearch 2.0. This includes ensuring all tests
pass when running with the security manager and updating the code to be compatible
with the latest core forbidden apis.

Shield is now a child project of elasticsearch-parent and inherits a lot of common
build, test, and static coverage functionality from that project resulting in a much
smaller and simpler pom.xml for shield. As part of this work, Shield can now read
rest tests from the elasticsearch jar so the rest tests are run automatically when
running the slow tests.

Original commit: elastic/x-pack-elasticsearch@2ebbf4284a
2015-05-26 13:57:58 -04:00
uboness 6acc3f2616 Added support for headers in HttpClient
- HttpResponse now holds the response headers
- Added specific support for content type of the response, based on which we create the xcontent payload.

Original commit: elastic/x-pack-elasticsearch@beae27f576
2015-05-26 16:53:05 +02:00
Brian Murphy 46c111b016 Add execution_duration to watch history records.
This change add the actual length of time a watch spends executing. This is useful to find watches that take long to execute to pinpoint those watches that may be candidates for throttling.
Add the execution_duration as a number of milliseconds rather than a timevalue so it can be aggregated from the watch_history index.

Original commit: elastic/x-pack-elasticsearch@0036468f55
2015-05-26 10:34:24 -04:00
Areek Zillur b21494d95d FIX: Absorb ImmutableSettings into Settings
Original commit: elastic/x-pack-elasticsearch@f0f70f39f1
2015-05-26 00:36:20 -04:00
Robert Muir 6e557b82da simplify license header checking
Original commit: elastic/x-pack-elasticsearch@d48ce3f7bf
2015-05-22 18:44:56 -04:00
uboness 2f48d980b3 Fixing issues after master rebase
Original commit: elastic/x-pack-elasticsearch@d3dfa53483
2015-05-22 20:57:51 +02:00
uboness 33bc0761e7 fixed bad rebase merge
Original commit: elastic/x-pack-elasticsearch@a6793fedf8
2015-05-22 20:57:51 +02:00
uboness 575208c338 Centralized xcontent parsing of time values
- Renamed `WatcherDateUtils` to `WatcherDateTimeUtils`

Original commit: elastic/x-pack-elasticsearch@6b5557058a
2015-05-22 20:57:51 +02:00
uboness e0a70722e0 Move acking/throttling to the action level
Until now, acking and throttling functionality was applied at the watch level. This has major drawbacks in different aspects:

- When multiple actions are defined on a watch, acking a watch effectively acks all the actions. This is conceptually wrong. Say you have two actions: `email` and `index`. It's very likely you'd like to ack the email action (to avoid receiving too many emails) but at the same time continue indexing the data in the `index` action. Right now it's not possible.

- Different actions types may require different throttling. An `email` action probably needs a longer throttle period compared to an `index` action. Also for different `webhook` actions, the throttling is ultimately determined by the 3rd party system that is called.

This commit changes how we do throttling & acking. Moving this functionality to the action level. Now, when acking, each action in the watch will be acked separately. During executiong, each action will determine whether it needs to be throttled or not. The throttler is not associated with the action, not with the watch.

The throttle period was enhanced. There is a default throttle period that is configured for watcher as a whole (using the `watcher.execution.default_throttle_period` setting. Next to that, each `watch` can define its own `throttle_period` that can serve as the default throttle period for the actions in the watch. Lastly, each action can have its own throttle period set.

Since the throttler is now an action "thing", the `throttle` package was renamed to `throttler` and moved under the `actions` package. Also, `WatchThrottler` was renamed to `ActionThrottler`.

With this change, the `Watch Execute API` changed as well. Now, when executing a watch, you can define an execution mode per action. The execution mode offers 4 types of execution:
- `execute`: executes the watch normally (actually executing the action and it may be throttled)
- `force_execute`: skips/ignores throttling and executes the watch
- `simulate`: simulates the watch execution yet it may be throttled
- `force_simulate`: skips/ignores throttling and simulates the watch execution

As part of this change, the structure of the watch status changed along with the xconent representing the `watch_record`. A new `ActionStatus` was introduced (as part of the `WatchStatus`) and is always set for every action in the watch. This status holds:
 - the current state of the action (`ackable`, `awaits_successful_execution`, `acked`)
 - the last execution state (success/failure + reason)
 - the last successful execution state
 - the last throttle state (timestamp + reason)

Original commit: elastic/x-pack-elasticsearch@32c2985ed8
2015-05-22 20:57:51 +02:00
uboness ea91c1e617 third attempt to fix the failing tests windows
Original commit: elastic/x-pack-elasticsearch@30bb93ce4a
2015-05-22 11:39:09 +02:00
Robert Muir 8ea126de90 switch to plugin pom
Original commit: elastic/x-pack-elasticsearch@6fcfa52959
2015-05-21 23:01:57 -04:00
uboness 8e13a03069 fixing failing test on windows... now for realz
Original commit: elastic/x-pack-elasticsearch@159144f18c
2015-05-22 00:41:32 +02:00
Robert Muir 19e1b5597c Merge pull request elastic/elasticsearch#50 from rmuir/parent_cleanups_forbidden
Sync up with elasticsearch-parent changes:

Original commit: elastic/x-pack-elasticsearch@420b0cbd3e
2015-05-21 17:15:35 -04:00
Robert Muir b34b18be3f Remove duplicate test config
Original commit: elastic/x-pack-elasticsearch@2acd8bdf8c
2015-05-21 17:13:28 -04:00
uboness 47e50008a0 fixing failing test on windows
Original commit: elastic/x-pack-elasticsearch@5af44b88d2
2015-05-21 22:00:41 +02:00
Robert Muir 6d66e0f4f5 Resolve paths against environment
Original commit: elastic/x-pack-elasticsearch@7e30f66bc0
2015-05-21 12:25:20 -04:00
Robert Muir e3270183ef Fix this in a simpler way
Original commit: elastic/x-pack-elasticsearch@40bbb991d1
2015-05-21 12:15:36 -04:00
Robert Muir 5f1cfd025c restore executions section here
Original commit: elastic/x-pack-elasticsearch@0ed3d2c5af
2015-05-21 12:05:04 -04:00
Robert Muir e8ee650694 Sync up with elasticsearch-parent changes:
* removes lots of duplicate pom logic
* removes duplicate forbidden API logic
* fixes new forbidden API violations

Original commit: elastic/x-pack-elasticsearch@1fc5c6f79e
2015-05-21 11:49:33 -04:00
Martijn van Groningen 1bdd84bcb2 test: Add a simple runner that allows to run Watcher from the IDE and work out of the box with Sense.
Original commit: elastic/x-pack-elasticsearch@8c4100258e
2015-05-21 14:44:13 +02:00
Martijn van Groningen bbcfecbe90 test: added 'cluster:monitor/nodes/info' role for the test user
Original commit: elastic/x-pack-elasticsearch@78144d3313
2015-05-21 13:35:19 +02:00
Martijn van Groningen 39f83974ef test: added missing roles for the test user
Original commit: elastic/x-pack-elasticsearch@36f6d36817
2015-05-21 12:41:30 +02:00
Martijn van Groningen 2861f8ce21 test: Add more Shield related tests for testing the Watcher roles.
Original commit: elastic/x-pack-elasticsearch@482d8fe65c
2015-05-21 12:05:44 +02:00
Martijn van Groningen 284a60e16d stats: fix npe during serialization
Original commit: elastic/x-pack-elasticsearch@3233836d0b
2015-05-21 11:38:24 +02:00