Commit Graph

2218 Commits

Author SHA1 Message Date
jaymode 2db6f4e281 add type parameters to emptySet()
Original commit: elastic/x-pack-elasticsearch@e7de5b5aff
2015-03-31 10:07:39 -04:00
jaymode 366e27c551 add PKI realm
Adds PKI authentication realm that uses X.509 certificates for authentication.
Authorization is provided through the use of role mapping files.

Closes elastic/elasticsearch#782

Original commit: elastic/x-pack-elasticsearch@5a50e50598
2015-03-31 09:38:46 -04:00
Martijn van Groningen baf0901b3a test: adjusted find available port loop
Original commit: elastic/x-pack-elasticsearch@ae44c570c0
2015-03-30 20:50:14 +02:00
Brian Murphy 06efbf1481 Actually the test and don't call start twice on the same server.
Original commit: elastic/x-pack-elasticsearch@3b994ef9e7
2015-03-30 14:40:05 -04:00
Brian Murphy 72d2f5174e Fix HttpClientTest
If port 9200 isn't available inc the port and try again until we reach 9300.

Original commit: elastic/x-pack-elasticsearch@90ca05544f
2015-03-30 14:22:26 -04:00
Martijn van Groningen e00bb69982 Added http input.
The http input allows to let any http interface be the input for a watch.
The http input can be configured with the following options:
* `method` - Optional http method. (default to GET)
* `host` - The host of the http service.
* `port` - The port of the http service.
* `path` - The url path.
* `params` - Optional url query string options.
* `header` - Optional http header.
* `auth` - Optional authentication http heads.
* `body` - Optional body

The response of the http request is expected to be valid json.

Closes elastic/elasticsearch#157

Original commit: elastic/x-pack-elasticsearch@0b1f122615
2015-03-30 18:32:06 +02:00
uboness a632d57803 Introducing the `Trigger` notion
Today every `watch` is associated with a `schedule`. When the watch is added to the system, its schedule is registered with the `scheduler` that is responsible to trigger the watch based on the schedule. This is effectively time based triggering of a `watch`.

Thinking about it further, triggering a watch is a higher abstraction than the schedule. Many things can potentially trigger a watch - a schedule (or time based triggering) is just one example of such trigger.

A `Trigger` was added to provide this abstraction. A `watch` is associated with a `trigger` not with a `schedule` directly. One type of `trigger` that can be set on a watch is a `schedule`.

This abstraction will enable us much flexibility in the future as we'll be able to add other types of triggers that are not necessarily based on time. 3 examples:

- we're planning to have a API that executes triggers on demand (rather than waiting for them to be triggered "naturally"). We could have a `"passive"` trigger with the intention to have a watch that can only be executed on demand. Today (with schedule only) you can achieve this by setting a `cron` schedule that is set to trigger very far in the future - but it's a hack.

- In the future we plan to have changes API in elasticsearch. An interesting trigger that we might want to add is `"changes"` - an ESP (event-stream processing) trigger that listens to all (data) events in the changes API, processes them and using some sort of state machine decides to trigger a watch based on some condition.

- With Shield we have audit trails. currently the only audit trail that is supported is log based (access logs). Another audit trail we'll add soon will be index based (indexing the audit info to elasticsearch). In the future, we might want to have `watcher` extend shield and add a `"watcher"` audit trail. this will effectively be a `"audit"` trigger that will trigger watches based on events arriving in the audit trail (think about notifying at real-time about a potential DDoS attack)

To support this change, we needed to change existing and introduce new constructs:

- A `Trigger` defines the logic of when a watch should be triggered
- A `TriggerEngine` is responsible for executing the logic defined by the `Trigger`
- A `TriggerEvent` is created whenever the engine triggers the trigger. The event holds relevant information (may be different for every trigger depending on its type and nature).
- A `TriggerService` manages trigger engines.

We currently have a single engine implementation - a `"scheduler"` trigger

- `ScheduleTrigger` defines a clock/calendar based schedule on which a watch should be triggered
- `QuartzScheduleEngine` a trigger engine that runs quartz scheduler which triggers the registered schedules.
- `ScheduleTriggerEvent` holds the `triggered_time` (the time the trigger was actually triggered) and the `scheduled_time` (the time the trigger was scheduled to trigger)

- Updated the docs

Closes elastic/elasticsearch#158

Original commit: elastic/x-pack-elasticsearch@5be20917cc
2015-03-30 14:44:35 +02:00
uboness c1fe5378aa An attempt to fix in correct mime-type handling of JavaMail
Apparently sometimes Java doesn't pick up the correct mailcap file and therefore doesn't handle mime types correctly. This commit
statically sets the mailcap.

Relates to elastic/elasticsearch#126

Original commit: elastic/x-pack-elasticsearch@a958e07267
2015-03-29 22:41:20 +02:00
uboness fca9b6a1e6 Integration with Shield
- Change action names to be aligned with Shield. All actions are categorized as `cluster management`.. the read actions (get & stats) are also also categorized as `cluster monitoring`.

- Added `ShieldIntegration` and `WatcherShieldModule` to handle all the integration points.

- We have a new internal shield user `__watcher_user` that will be the actor behind all the watcher interal action executions (managing the `.watches` and `.watch_history` indices

- This integration revealed a bug where the watcher plugin would not wire correctly with transport clients. This is now fixed with the introduction of a dedicated `TransportClientWatcherModule`

- Added docs

Closes elastic/elasticsearch#43

Original commit: elastic/x-pack-elasticsearch@26e9b0da06
2015-03-27 20:19:19 +01:00
jaymode c0a197c933 Tests: add randomization settings file
Adds randomization.yml file that contains the versions of elasticsearch
and lucene to test the current branch against. This allows us to control
the versions we test against in the repo vs having to continually modify
the randomization scripts.

Closes elastic/elasticsearch#773

Original commit: elastic/x-pack-elasticsearch@5e5645a627
2015-03-27 12:07:02 -04:00
Martijn van Groningen 6277a32b91 Set minimum binary compatibility to ES 1.5
Closes elastic/elasticsearch#160

Original commit: elastic/x-pack-elasticsearch@10da3efb1a
2015-03-26 18:20:39 +01:00
uboness 0abef51d80 Enhanced integration with other plugins
- Added an option for other plugins to define reserved roles. These roles will be reserved for the plugins and will be used by the plugin when executing actions. The reserved roles cannot be overridden by the `roles.yml` file. While at it, also made sure the system role cannot be defined in the `roles.yml` file. The roles can be registered via the `AuthorizationModule.registerReservedRole` method.

- Enable plugins to add their own (new) cluster & index privileges. The can be done by simply calling `Cluster.addCustom` and `Index.addCustom` static methods.

Original commit: elastic/x-pack-elasticsearch@11f795bebd
2015-03-26 13:28:55 +01:00
Martijn van Groningen 9994326f11 Renamed AlertsBenchmark to WatcherBenchmark
Original commit: elastic/x-pack-elasticsearch@3c8000e7bf
2015-03-26 11:19:47 +01:00
jaymode a5e33b1aec [test] add active directory realm tests
This adds tests for the active directory realm using the unboundid
in memory directory server.

Closes elastic/elasticsearch#723

Original commit: elastic/x-pack-elasticsearch@e87c8bd65b
2015-03-25 08:15:06 -04:00
jaymode c55994417c [test] remove timing assertion from timeout test
The timeout test times an operation that involves much more than a simple
socket connect. There is overheard from the UnboundID library and its
asynchronous nature that could cause delay in a response. This removes
the assertion that the call to session took less than one second and adds
an assertion about the exceptions cause.

Closes elastic/elasticsearch#740

Original commit: elastic/x-pack-elasticsearch@45577626b6
2015-03-25 07:37:44 -04:00
uboness 41832b6f5b Change project name to elasticsearch-watcher
- `alerts` package is now `watcher` package
- we no longer use the term `Alert`, but instead we use `Watch`
- documentation still needs to be updated

Original commit: elastic/x-pack-elasticsearch@1225edf7e3
2015-03-24 13:46:01 +01:00
uboness 336d508172 Changed default in-mem password hashing
- Introduced `ssha256` hashing (salted sha-256) which is now the default in-mem hashing algorithm (instead of bcrypt4)
- changed the `md5` to be a real MD5 algorithm (used to be md5crypt.
- introduced `apr1` hashing algo. which is the old md5crypt algorithm.

Also updated the relevant docs & tests

Original commit: elastic/x-pack-elasticsearch@c8c0be5b95
2015-03-24 02:12:52 +01:00
jaymode 31f3afe684 use the BytesStreamInput with BytesArray
This resolves a compatibility issue with the current builds of elasticsearch
1.6.0.

Closes elastic/elasticsearch#774

Original commit: elastic/x-pack-elasticsearch@0ee97afa53
2015-03-23 21:08:06 -04:00
uboness b0ef266601 moved to elasticsearch 1.5.0
Original commit: elastic/x-pack-elasticsearch@c9fdf1f81a
2015-03-23 18:04:58 +01:00
jaymode 02a2309623 add 1.0.2 to ShieldVersion
Original commit: elastic/x-pack-elasticsearch@da77faf4e6
2015-03-23 09:09:05 -04:00
jaymode 5863e3ab69 update ShieldVersion with 1.1,1.2, and 1.3
Original commit: elastic/x-pack-elasticsearch@dd00a35f51
2015-03-23 07:30:21 -04:00
jaymode eedb677dc2 fix compile error due to new signature of InternalTestCluster
Original commit: elastic/x-pack-elasticsearch@bc8a9099dc
2015-03-20 07:01:57 -04:00
Martijn van Groningen a6bdbf0b0b Added simple benchmark to test fired alert throughput
Original commit: elastic/x-pack-elasticsearch@186b6305ff
2015-03-19 13:09:05 -07:00
Brian Murphy 100b5b922c Fix SearchInput tests.
SearchInput tests were failing locally for me in DEBUG because they weren't setting a valid alert on the ExecutionContext which was causing
the debug log messages in the SearchInput.execute method to NPE. I've added a dummy Alert to the context to fix things.
`

Original commit: elastic/x-pack-elasticsearch@2d744fdb7b
2015-03-19 15:56:19 -04:00
uboness 47b0fb4ea1 [docs] added docs for input, schedule and condition
Also:

- removed `throttle` file (throttling is not covered in `alert-anatomy` page)
- fixed ctx model parameters in templates/scripts to use the `ctx` prefix.
- added a dediated section in alert-anatomy about execution context as template/script model
- wrote first page of `transform` section

Original commit: elastic/x-pack-elasticsearch@471ca7f0d9
2015-03-19 12:07:20 -07:00
jaymode 1ff99994bc [Test] enable HTTP for rest tests
Original commit: elastic/x-pack-elasticsearch@4c631595b1
2015-03-19 14:12:03 -04:00
jaymode f2b493fa96 Upgrade elasticsearch dependency to 1.5.0-SNAPSHOT
This upgrades the elasticsearch dependency to 1.5.0-SNAPSHOT and removes
classes/functionality that were incorporated back into elasticsearch.

Closes elastic/elasticsearch#669

Original commit: elastic/x-pack-elasticsearch@65b76c41fb
2015-03-19 09:56:19 -04:00
Martijn van Groningen 5dfe02ec64 Core: Make sure that the queue size is set on the alert thread pools
Also removed hack leftover.

Original commit: elastic/x-pack-elasticsearch@44fd070f5d
2015-03-18 16:40:22 -07:00
Martijn van Groningen 2377d1525b Tests: added tests for AlertStore, AlertService and AlertLockService
Changed ClientProxy to be return responses instead of ActionFutures and removed builders. This helps with mocking.

Original commit: elastic/x-pack-elasticsearch@bfc36d9405
2015-03-18 10:08:28 -07:00
uboness 43a5fe07f4 fixed Introduced settings filtering for active directory
Filtering out the `hostname_verification` setting for active directory realms

Original commit: elastic/x-pack-elasticsearch@27b931c5c6
2015-03-17 16:30:50 -07:00
uboness 3015ebccdb Introduced settings filtering
Enables filtering out sensitive settings from the nodes info API rest endpoint. Also provide a mechanism to filter out additional settings via a new `shield.hide_settings` setting.

Original commit: elastic/x-pack-elasticsearch@9bab5049e7
2015-03-17 14:25:33 -07:00
jaymode 5ba1bdb816 [Test] increase logging for allocation related timeouts
On Windows, ensureGreen times out due to some shards not being initialized so
this increases allocation logging.

Original commit: elastic/x-pack-elasticsearch@e3777a8e89
2015-03-15 22:18:46 -07:00
jaymode 0cc784cbfd [Test] mute connect timeout tests that fail intermittently
Original commit: elastic/x-pack-elasticsearch@0b1d936d5b
2015-03-15 13:22:55 -07:00
jaymode 8704693888 Test: switch to using OpenLDAP url for connect timeout
After the switch from elasticsearch.com to elastic.co, these tests started failing
due to socket connect errors. Now we will just connect to the OpenLDAP server
which should be a different machines than the ones running tests.

Original commit: elastic/x-pack-elasticsearch@7bf713a313
2015-03-11 07:48:00 -07:00
Alexander Reelsen 15e0af9c9a Dynamic IP filtering: Disabling does not work in certain cases
Due to a bug in how old settings were stored, disabling dynamic
ip filtering did not work, when it had not been changed before.

Closes elastic/elasticsearch#762

Original commit: elastic/x-pack-elasticsearch@0868e1b6f2
2015-03-06 19:08:49 +01:00
Martijn van Groningen e6445a9d2e Iternal: Removed Payload.ActionResponse in favour of an extra constructor to Payload.XContent
Tests: Write more tests for AlertUtils

Closes elastic/elasticsearch#132

Original commit: elastic/x-pack-elasticsearch@b0e675b89c
2015-03-06 10:36:54 +01:00
uboness 50f4a1c0e3 Introducing TimeWarp mode for tests
The idea behind a time warp mode is that while it's enabled the time related constructs in the alerts module are replaced with a mock test friendly version.. so we'll be able to control time and therefore avoid sleeping the threads.

 In time warp mode:

-  The `SchedulerMock` is used to manually fire jobs
-  The `ClockMock` is used to set and fast forward time
-  The alerts are executed on the same thread as the scheduler mock... so we don't have to deal with async nature at all. This is accomplished by the added `AlertsExecutor` abstraction.

By default, the time warp mode is enabled and tests run in it. If a test must not use the time warp mode, it is possible to add `@TimeWarped(false)` annotation to the test and it will then run with the standard scheduler & clock. It is also possible to disable this mode all together by running the tests with `-Dtests.timewarp=false`.

All the updated tests now work in both modes (whether the time warp mode is dis/enabled). This is important as on the server we would like to run the tests outside of this mode as well, but locally we'd like to run them with time warped enabled (so they'll be faster)

Also, cleaned up the tests.. we now only do `assertThat(...)` calls (no `assertTrue` or `assertEquals`... for consistency sake)

Original commit: elastic/x-pack-elasticsearch@11e09f6dea
2015-03-06 08:33:21 +01:00
uboness a977bb404f Fixed a bug in anonymous user via REST
The resolved anonymous user was not added to the REST request context. This resulted in that when the request was "translated" to a transport request, the fallback was the `system user`. The commit fixes that.

Original commit: elastic/x-pack-elasticsearch@acea6becf1
2015-03-05 21:05:15 +01:00
Martijn van Groningen ffdf23b411 Tests: Added tests for HistoryStore
Closes elastic/elasticsearch#129

Original commit: elastic/x-pack-elasticsearch@16043bcec2
2015-03-05 20:49:22 +01:00
jaymode f0f4973ac3 [ldap] improve logging of exceptions during authentication
Any exception caught during authentication is only logged if DEBUG is enabled.
This changes the behavior to log these exceptions are WARN with the exception
message only or at DEBUG with the full exception.

The user template ldap implementation could potentially cause a lot of
logging to be generated because it always prints the full exception at WARN
level. This changes it to print the message at WARN level and the exception
at DEBUG.

Original commit: elastic/x-pack-elasticsearch@c607567d88
2015-03-05 11:02:02 -05:00
uboness 6eb27e2519 Introduced Clock as an abstraction over the system clock
Use in:

- Determining the execution time of an alert
- The period throttler to determine the time passed since last execution

Original commit: elastic/x-pack-elasticsearch@9197b86b68
2015-03-04 23:26:56 +01:00
Martijn van Groningen f28dee2e44 Tests: Made sure that resources are properly cleaned up after test classes extending from AbstractAlertsSingleNodeTests have been completed
Original commit: elastic/x-pack-elasticsearch@4621b76fe1
2015-03-04 12:11:21 +01:00
uboness 5903ea7493 Fixed NPE when email action has no subject or text body
Fixes elastic/elasticsearch#137

Original commit: elastic/x-pack-elasticsearch@7f575657f3
2015-03-04 11:03:13 +01:00
uboness f5c48576bc Cleaned up the use of execution context mocking in the tests
Added helper methods in `AlertsTestUtils` to mock `ExecutionContext` and create a simple payload

Original commit: elastic/x-pack-elasticsearch@eac6b63e62
2015-03-04 10:37:38 +01:00
uboness 3829d8e7a3 Added unboundID free use license to NOTICE.txt
Original commit: elastic/x-pack-elasticsearch@9ddb39bdc6
2015-03-04 10:34:55 +01:00
uboness 4874fa2f1b change the SES email port to 587
Original commit: elastic/x-pack-elasticsearch@d69d02236b
2015-03-04 10:03:07 +01:00
uboness 01145b8025 Aligned Transform.Result with all other result constructs
- the transform parser and registry can now parse transform results
- every transform result may have its own format
- the chain transform result outputs the "transformation trail" of all the chained transforms (great tool for debugging)
- removed `Transform.NOOP` - was redundant, when no transform is defined the alert's transform is `null`
- removed `payload` from the `AlertExecution`. Instead, the execution holds the input result, transform result and potentially the transform results of the actions
- changed the xcontent representing a transofrm result to `{ "transform_type" : { "payload" : {...}, ... } }`
- with this change, the `Action` interface is cleaned up (`execute` only accepts the execution context)

Original commit: elastic/x-pack-elasticsearch@6ecf7f2c92
2015-03-04 09:52:31 +01:00
Martijn van Groningen 167f6814ab Fix tests
Original commit: elastic/x-pack-elasticsearch@ad7b4ae1ef
2015-03-04 09:42:57 +01:00
Martijn van Groningen 0382310cae Moved testAlertsWithDifferentSearchType and testWithAggregations to more unit like tests.
Original commit: elastic/x-pack-elasticsearch@115e361c42
2015-03-04 09:15:35 +01:00
uboness f6c17bd802 Added a transform construct to actions
An alert may have multiple actions associated with it, but each action may need to have different view of the data. For example, the email may need a certain model for its templates while the index or webhook actions may need a completely different data structure.

Until now, there's only an option to defina a single `transform` on the alert level that would have applied to all actions. This commit adds
 the ability to associate a transform with each action. We still keep the tranform on the alert level (in case all actions need the same transformation, in which case we'd like to avoid repetition).

Original commit: elastic/x-pack-elasticsearch@5493a2179b
2015-03-04 03:20:17 +01:00