Commit Graph

5732 Commits

Author SHA1 Message Date
Brian Murphy 87e056d762 Fix missing index issue by explicitly creating the index if implicit creation fails
This really shouldn't be happening.

Original commit: elastic/x-pack-elasticsearch@7d334ec76f
2014-11-26 18:10:52 +00:00
Brian Murphy 193865925c Properly catch errors on startup and return false from start if we get errors looking for the alert history indices.
Original commit: elastic/x-pack-elasticsearch@9db4691783
2014-11-26 17:27:22 +00:00
Brian Murphy 779e7e83c0 TEST Fix Bootstrap test that got munged by merge.
Original commit: elastic/x-pack-elasticsearch@b0f40fd764
2014-11-26 16:28:11 +00:00
Brian Murphy c55ebc29e2 Merge pull request elastic/elasticsearch#49 from elasticsearch/timebased_histroy
Timebased history index

Original commit: elastic/x-pack-elasticsearch@0be1188599
2014-11-26 16:00:58 +00:00
Brian Murphy f8e26c2f75 Remove dependency on the alert history indices being started in the actions.
Original commit: elastic/x-pack-elasticsearch@a3f0e0fe46
2014-11-26 15:58:52 +00:00
Brian Murphy 713327cee5 TEST : Add bootstrap test to boot strap different history indices.
Original commit: elastic/x-pack-elasticsearch@72c36f6d4d
2014-11-26 15:58:52 +00:00
Brian Murphy aaef7de62d TEST: This test got forgotten when I squash the commits.
Original commit: elastic/x-pack-elasticsearch@5109b4bea6
2014-11-26 15:58:52 +00:00
Brian Murphy 914a5035fd Remove merge conflict in comment.
Original commit: elastic/x-pack-elasticsearch@aa4bb3dab6
2014-11-26 15:58:52 +00:00
Brian Murphy f6027e9a6b Alert History : Make alert history index time based.
This commit makes the alert history index a time based index.
The alert history now is a timebased index prefixed with .alert_history_
with the time fomat YYYY-MM-dd.

This commit makes the alert history index a time based index.

Original commit: elastic/x-pack-elasticsearch@df6d6dee29
2014-11-26 15:58:52 +00:00
Martijn van Groningen 8512dfcb36 Removed enable from Alert.
Original commit: elastic/x-pack-elasticsearch@d65a883f70
2014-11-26 15:30:11 +01:00
Martijn van Groningen b0b3721f84 Added forgotten cluster block check
Original commit: elastic/x-pack-elasticsearch@022be40b54
2014-11-26 14:59:27 +01:00
Martijn van Groningen a34504b45e Test: stabilize the alert stopping during test cluster close and between tests.
Original commit: elastic/x-pack-elasticsearch@f2e7818d86
2014-11-26 12:21:05 +01:00
Areek Zillur 79c8cd8a30 Change pom profile to elasticsearch-private
Original commit: elastic/x-pack-elasticsearch@c6abc409f5
2014-11-25 19:48:53 -05:00
Martijn van Groningen b7dfde7de7 Changed the way alerting gets shut down when the test cluster gets closed.
Original commit: elastic/x-pack-elasticsearch@74c148c025
2014-11-26 00:26:43 +01:00
uboness af74f43aea Introduced realms factories
Today it is possible to configure 3 realms in shield - `esusers`, `ldap` and `active_directory`. These realms are created once based on the configuration. There are several problems with this approach:

- Taking `ldap` as an example, it is currently not possible to have multiple `ldap` realms configured (where one serving as a fallback for the other). While the `ldap` realm itself enables defining multiple ldap URLs, it has the limitation that the fallback LDAP must have the exact same configuration as the primary LDAP (+ there's the limitation that all URLs must either us SSL or not... there cannot be a mix of SSL URL and a normal URL)

- The realms are created and bound internally by guice. This will limit the configurability at runtime of the realms which we might want to introduce in shield 2.0.

This commit changes the way realms are managed & configured. Instead of having guice bind the realms themselves. A new realm factory construct will be introduced. The realm factory will represent a realm type and guice will bind these factories. At load time, we'll read the configuration and based on the types of the configured realms, the relevant factories will create the realms based on the settings. This means that potentially we can expose the realms as a dynamic configuration and rebuild the realm chain at runtime.

A nice side effect of this approach is that the multiple URLs feature that is currently supported by both `ldap` and `active_directory` can be dropped. Instead, the users will just need to configure multiple `ldap`/`active_directory` realms.

Closes: elastic/elasticsearch#370

Original commit: elastic/x-pack-elasticsearch@3232f153bb
2014-11-25 14:31:51 -08:00
Paul Echeverri f178575625 Adds Shield's requirement for disabling multicast discovery and links to the
main ES discovery docs.

Original commit: elastic/x-pack-elasticsearch@1d9742c0ae
2014-11-25 13:59:45 -08:00
Paul Echeverri b2949d76c8 Adds sample logging output to verify a functional Shield installation to Getting Started section.
Original commit: elastic/x-pack-elasticsearch@1b5505090d
2014-11-25 13:54:14 -08:00
Martijn van Groningen 470fb053fd Load quartz job in batch style when starting the scheduler.
Original commit: elastic/x-pack-elasticsearch@9bcf84092a
2014-11-25 21:18:02 +01:00
javanna 706a8fd38d [TEST] move integration tests to use the global cluster and run against multiple nodes
Every test class was previously running against its own SUITE cluster composed of a single node due to misconfiguration.
Also there were some repetitions and bugs in the settings: first of all unicast wasn't properly configured, also the plugin wasn't registered properly in the transport client, thus the "shield.user" settings wasn't properly converted into the basic auth header. For the very same reason the settings used for authc wasn't randomized for transport client.

Extracted out all the needed configuration to the `ShieldSettingsSource` class, that takes care of the unicast configuration, loading of the plugin and all of the configuration files and parameters.
Used the global cluster whenever possible, that has the following characteristics:
- unicast discovery
- ssl configured and enabled at the transport level
- ssl configured but disabled at the http level (REST tests use the same cluster and don't support SSL at this time)
- single user configured with an allow_all role
- auditing enabled or not is randomized
- the setting used to do basic auth is randomized between reuest.headers.Authorization and our own shield.user for both node and transport client

Test classes that need to override defaults settings can do so by declaring scope=SUITE and overriding the nodeSettings method. Also roles, users and users_roles have specialized methods to be overridden that just return the content of the whole file if it differs from the default. Note that given that ssl is properly configured although disabled for http, tests that need it on can just enable it without any additional configuration.

Closes elastic/elasticsearch#31

Original commit: elastic/x-pack-elasticsearch@fa6f162497
2014-11-25 17:34:10 +01:00
javanna a62a11f430 Internal: remove static assert that will trip once we upgrade to 1.4.1 or any new version
Although it is nice to be alerted through assert as soon as we upgrade the es core dependency, this can be done only in test code, in production code it prevents us from supporting any future version once the code gets released.

Replaced the assert with a TODO.

Original commit: elastic/x-pack-elasticsearch@b0d59c2fd3
2014-11-25 16:55:39 +01:00
Martijn van Groningen c9e181e597 Test: Replaced the internal clearing of the alert manager between tests with public stop alert service, delete alerts and alerts history index and start alert service calls.
Original commit: elastic/x-pack-elasticsearch@57c0120eb4
2014-11-25 15:12:00 +01:00
Martijn van Groningen 4b147b8f85 Fixes updating an existing alert works as expected.
Original commit: elastic/x-pack-elasticsearch@236407367a
2014-11-25 13:21:37 +01:00
javanna 22eabc19b2 [TEST] Remove SSLRequireAuthTests as the tested functionality (ssl client auth and settings) was removed
Original commit: elastic/x-pack-elasticsearch@0b646606aa
2014-11-25 12:28:30 +01:00
javanna 2eaa1cb969 Internal: resolve a few compiler warnings
@NotThreadSafe is not a valid standard java annotation. Removed unused method and empty @param javadoc annotation

Original commit: elastic/x-pack-elasticsearch@3583bcfa66
2014-11-25 12:17:28 +01:00
Martijn van Groningen 00bfd694af Tests: restart action manager before clearing store between tests
Original commit: elastic/x-pack-elasticsearch@15f057c820
2014-11-25 00:17:43 +01:00
Martijn van Groningen 4eca3c86a0 Tests: restart the action manager between tests.
Original commit: elastic/x-pack-elasticsearch@73bc51717b
2014-11-24 21:33:30 +01:00
Martijn van Groningen 98bb60e4ba improve assert
Original commit: elastic/x-pack-elasticsearch@cfedeb5da8
2014-11-24 21:27:14 +01:00
Martijn van Groningen 7eb1ec8ba0 Test: Also clear the alert actions te be processed between tests.
Original commit: elastic/x-pack-elasticsearch@f6da5717aa
2014-11-24 21:14:18 +01:00
Martijn van Groningen 53ef534567 No need to clear the scheduler when it is going to be shut down.
Original commit: elastic/x-pack-elasticsearch@5e8e4134ee
2014-11-24 21:06:47 +01:00
Martijn van Groningen 3c896c3d44 Test: Fix mistake, this test requires cluster scope test
Original commit: elastic/x-pack-elasticsearch@e84b055c19
2014-11-24 18:38:03 +01:00
Martijn van Groningen 1a4e118d0d Improving the starting and stop logic of the alert manager.
- Remove synchronized
- Add STOPPING state
- Expose alert state in stats api
- Let the test framework disable alerting before closing the test cluster

Original commit: elastic/x-pack-elasticsearch@5794f5fd8f
2014-11-24 17:35:10 +01:00
Martijn van Groningen 4e543ded65 Test: Move ClusterScope annotation to base alerting test class.
Original commit: elastic/x-pack-elasticsearch@96bb107c03
2014-11-24 16:21:45 +01:00
javanna 68e4876915 [DOCS] hopefully fixed formatting of TESTING.asciidoc
Original commit: elastic/x-pack-elasticsearch@516db83599
2014-11-24 11:55:25 +01:00
javanna e25f189fc2 [TEST] Added TESTING.asciidoc with some info on testing
The goal of TESTING.asciidoc is not to repeat what's already in the elasticsearch core test cheatsheet, but only add what is different in shield.

Original commit: elastic/x-pack-elasticsearch@51ad3894d2
2014-11-24 11:52:41 +01:00
javanna 48002d0d45 Internal: don't override user in the context if already existing
This bug was caused by the fact that we serialize the user and don't re-authenticate on each node anymore. With auto create index, we ended up overriding the user in the context with system due to wrong checks (we would check the headers instead of the context). This bug was revealed by our REST tests.

Also refactored the method for readability and removed check for token.

Original commit: elastic/x-pack-elasticsearch@2aa260b46c
2014-11-24 11:31:00 +01:00
Alexander Reelsen f1e5de40f5 Ip filtering: Use settings file instead of own configuration
This will allow in the future to make this a dynamic setting,
which can also be shared accress the cluster instead of having
to use (and distribute) files.

Another change is, that the order of `deny` and `allow` now does not matter
anymore. Allow will win over deny.

The last change is that `all` now is `_all` in order to align with the
rest of Elasticsearch

Documentation has been updated accordingly.

Original commit: elastic/x-pack-elasticsearch@daa0b18343
2014-11-24 10:46:15 +01:00
Martijn van Groningen 619afe51af Test: use refresh and assertBusy
Original commit: elastic/x-pack-elasticsearch@44e0dab7ef
2014-11-24 10:15:14 +01:00
Martijn van Groningen e0eecc5550 Test: ensure alerting is started before adding alerts
Original commit: elastic/x-pack-elasticsearch@f034d20016
2014-11-23 21:02:21 +01:00
Martijn van Groningen 44b9d8229f Set the manually stopped flag we a node gets shutdown.
Original commit: elastic/x-pack-elasticsearch@f3841481b0
2014-11-23 20:55:40 +01:00
Martijn van Groningen 4e239a8be6 Test: check no master block on all nodes
Original commit: elastic/x-pack-elasticsearch@611ce01d69
2014-11-23 20:32:50 +01:00
uboness b31beb1e36 [Cleanup] - renamed KeyService/KeyModule to SignatureService/SignatureModule
Also moved to appropriate package

Original commit: elastic/x-pack-elasticsearch@cb373314b8
2014-11-22 21:46:13 +01:00
uboness 22eea8aba0 [Cleanup] - Refactored security filter
Nuked the security filter and separated the different filter to their own constructs:

- Added a shield action package & module that is responsible for binding the shield action filter (and later will hold all shield actions)
- Added a shield rest package & module that is responsible for binding the shield rest filter and registering all the rest actions
- Moved the client & server transport filters to the transport package

General cleanup:

- Code formatting
- moved `ShieldPlugin` to the top level package `org.elasticsearch.shield`

Original commit: elastic/x-pack-elasticsearch@d652041860
2014-11-22 05:31:03 +01:00
uboness 6087480368 Avoid re-authenticating on in-cluster requests
Now, on first successful authentication, we put the user in the message header so it'll be send with any subsequent cluster internal requests (e.g. shard level search) to avoid re-authentication on every node in the cluster. We can do that now, as with multi-binding transport we can guarantee isolation of the internal cluster from client communication. While it's generally safe for transmission, the user header that is sent between the nodes is still signed using the `system_key` as yet another security layer.

As part of this change, also added/changed:

 - A new audit log entry - anonymous access for Rest request.
 - Changed how system user is assumed. Previously, system user was assumed on the receiving node when no user was associated with the request. Now the system user is assumed on the sending node, meaning, when a node sends a system originated request, initially this request won't be associated with a user. Shield now picks those requests up and attaches the system user to the role and then sends it together with the request. This has two advantages: 1) it's safer to assume system locally where the requests originate from. 2) this will prevent nodes without shield from connecting to nodes with shield. (currently, the attached users are signed using the system key for safety, though this behaviour may be disabled in the settings).

 - System realm is now removed (no need for that as the system user itself is serialized/attached to the requests)

 - Fixed some bugs in the tests

 Closes elastic/elasticsearch#215

Original commit: elastic/x-pack-elasticsearch@3172f5d126
2014-11-21 21:42:15 +01:00
Areek Zillur 6d5b2569f1 [CORE] Renamed internal action to be consistent
Original commit: elastic/x-pack-elasticsearch@21df16eba4
2014-11-21 13:07:59 -05:00
Martijn van Groningen beb4fada5f Core: Changed the loading logic in AlertManager to happen all in a single forked thread only. Also retry attempts stay on the the same thread and is only done if there is a new cluster state version.
Test: Added first version of test that fails the elected master multiple times.

Original commit: elastic/x-pack-elasticsearch@2f7b840f5a
2014-11-21 18:15:09 +01:00
Areek Zillur 32af5a9d9c Remove third-party licensing library
Incorporate Feedback:
 - verify signature for signed licenses whenever it is read from cluster state
 - encrypt trial licenses with default pass phrase when storing it
 - moved toSignature & fromSignature to License

Make LicenseManager a Utility class

Refactor:
 - renamed LicenseManager to LicenseVerifier
 - LicensesMetaData now holds a list of license objects (for signed licenses) and a set of encoded strings (trial licenses)
 - minor test cleanup

incorporate feedback

incorporated feedback

switch to a stronger secret key gen algo; clean up build files & LicensesMetaData

cosmetic changes to LicenseSigner

incorporate LicnesesMetaData feedback

Original commit: elastic/x-pack-elasticsearch@0510091d2d
2014-11-21 11:37:19 -05:00
Alexander Reelsen 2b108203fb SSL/TLS: Added support for different certs per profile
In order to run on different certs per port, we needed to adapt
the logic of starting up.

Also different profiles can now be applied to the N2NAuthenticator, so that
a different profile can allow/deny different hosts.

In addition minor refactorings have been done
* Group keystore/truststore settings instead of using underscores
* Change to transport profile settings instead of using specific shield ones

Documentation has been updated as well

Closes elastic/elasticsearch#290

Original commit: elastic/x-pack-elasticsearch@ad1ab974ea
2014-11-21 17:02:58 +01:00
Brian Murphy c471abdab5 Merge branch 'master' of https://github.com/elasticsearch/elasticsearch-alerts
Original commit: elastic/x-pack-elasticsearch@7aee9aef96
2014-11-21 15:52:08 +00:00
Martijn van Groningen e6336010be Changed info log into debug log
Original commit: elastic/x-pack-elasticsearch@b142696ca5
2014-11-21 14:30:51 +01:00
Brian Murphy 97bbd747ea DOCS : Add REST API doc for akcing alerts.
Original commit: elastic/x-pack-elasticsearch@633444773d
2014-11-21 12:52:31 +00:00