Commit Graph

456 Commits

Author SHA1 Message Date
jaymode bff95d9ca1 Add CryptoService to support signing and encryption operations
This changes the SignatureService into a CryptoService that now supports encryption
operations in addition to the signing operations. The encryption leverages the existing
system key and uses it with AES.

Closes elastic/elasticsearch#805

Original commit: elastic/x-pack-elasticsearch@a792ed4a54
2015-04-21 08:38:40 -04:00
jaymode 39f587a497 [CLI] attempt to restore owner and group on new files
For the CLI tools in Shield we create a new temp file and replace the existing file
to prevent issues with reloading a half written file. This has a potential side effect
of changing the user and group that own the file. Many times the commands are
run with root privileges (sudo) and when run with root privileges we can actually
reset the owner and group correctly.

Closes elastic/elasticsearch#812

Original commit: elastic/x-pack-elasticsearch@1ee3715376
2015-04-21 07:32:44 -04:00
jaymode 197817e900 use a time constant comparison function for security
For HMAC and password hash comparisons we need to use a time
constant comparison that always compares the whole value in order
to protect against timing attacks.

Original commit: elastic/x-pack-elasticsearch@f6082c76b9
2015-04-10 09:37:41 -04:00
jaymode d1759ff322 Tests: update randomization for ES 1.5.1
Elasticsearch version 1.5.1 was released today, so move to testing against
the release version and add 1.5.2-SNAPSHOT.

Original commit: elastic/x-pack-elasticsearch@36b502dbb1
2015-04-09 10:19:11 -04:00
jaymode aec8982996 Build: rename zip to shield-version.zip
As part of the release process, the shield zip files are renamed prior to
uploading to the downloads server. This change removes the need to
rename the file.

Closes elastic/elasticsearch#760

Original commit: elastic/x-pack-elasticsearch@f1822d9d4c
2015-04-07 13:47:23 -04:00
jaymode 11790f3f0d Test: fix compilation error with ES 1.6.0-SNAPSHOT
The contentUnsafe field was removed and this caused a compilation error
with two implementations of RestRequest in test code. This fixes the compilation
error and only uses a single implementation of RestRequest.

Original commit: elastic/x-pack-elasticsearch@d4d8a6ba6b
2015-04-01 10:01:06 -04:00
jaymode f80d49e19c Test: fix realm ordering so that node transport clients still work
Original commit: elastic/x-pack-elasticsearch@24b660ac45
2015-03-31 11:45:55 -04:00
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
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
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
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 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
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
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
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
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 3829d8e7a3 Added unboundID free use license to NOTICE.txt
Original commit: elastic/x-pack-elasticsearch@9ddb39bdc6
2015-03-04 10:34:55 +01:00
Alexander Reelsen 9a3488304e Testing: Ensure http.enabled is set consistently for all nodes in test
Make sure that IpFilteringUpdateTests set http.enabled for all nodes same.

Closes elastic/elasticsearch#748

Original commit: elastic/x-pack-elasticsearch@a26521afb1
2015-03-03 09:10:57 +01:00
jaymode 7cfdf521c3 [SSL/TLS] filter out unsupported ciphers before setting the cipher list
This change filters out unsupported ciphers before setting the ciphers on the
SSLEngine. The unsupported ciphers are logged in a message at the error
level. If none of the specified ciphers are supported, then an exception will
be thrown.

Closes elastic/elasticsearch#698

Original commit: elastic/x-pack-elasticsearch@68cf47ec19
2015-03-02 12:18:18 -05:00
Alexander Reelsen 6a6e44545c IP Filtering: Make IP filtering a dynamic setting
In order to be able to configure ip filtering in a dynamic way, all
the ip filter related settings have been made dynamic.

This commit also fixed a bug, as the setting shield.http.filter.enabled
was not working, but mentioned in the documentation.

Documentation has been updated along the way.

Closes elastic/elasticsearch#697

Original commit: elastic/x-pack-elasticsearch@2760c47b5b
2015-03-02 18:14:17 +01:00
Robert Muir c8a169e3be Don't tableize runautomatons.
tableizing means evaluation is strictly linear time O(inputLength),
but costs #states * alphabet in ram. alphabet here is unicode (64k) so it blows up huge.

With tableize=false, it just means evaluation is O(inputLength * log(numIntervals)).
This is plenty fast for our purposes.

For these same reasons lucene only tableizes ByteRunAutomaton (alphabet size=256)
by default, for CharRunAutomaton it defaults to false.

Ban the trappy RunAutomaton ctor that tableizes. Fix tests using it.

Closes elastic/elasticsearch#739.

Original commit: elastic/x-pack-elasticsearch@28ab66b0ee
2015-02-25 12:33:30 -05:00
jaymode 82beae9c0c [test] check node ports to see if they are already bound
A large number of recent test failures have been caused by failure to bind
a port in the range 32900 to 32999. The ports are now tested to see if they
can be bound by this JVM and if not tries to bind another port. This will
decrease the likelihood of a port bind failure but another application could
still bind a port before the node starts up.

Closes elastic/elasticsearch#737

Original commit: elastic/x-pack-elasticsearch@aaf098758f
2015-02-25 12:05:00 -05:00
jaymode 121a20ca87 [test] add lucene expressions jar as test dependency
REST tests that use expressions as the script language requires the
lucene-expressions library to be loaded.

Original commit: elastic/x-pack-elasticsearch@c0f2b8a4b2
2015-02-24 15:23:55 -05:00
jaymode 021000e4d8 [ldap] move bind user settings out of the user_search settings
The bind user can be used for other operations in the future, so it is being moved
out of the user_search settings into the top level ldap realm settings.

Closes elastic/elasticsearch#729

Original commit: elastic/x-pack-elasticsearch@babc5ece0b
2015-02-24 06:10:42 -05:00
jaymode 7336509acc [ldap] allow mapping users to roles
This change will always attempt to map a user's distinguished name
to a role in addition to the user's groups.

Closes elastic/elasticsearch#324

Original commit: elastic/x-pack-elasticsearch@9ebcdd549c
2015-02-24 05:53:59 -05:00
jaymode c2a61d2207 [ldap] add user search with base dn and bind dn
This adds a second mode of operation to the ldap realm. This mode of operation
allows for single bind user to be specified. This bind user will be used to
search for user DNs starting from a base DN. The user DN will then be used to
authenticate via a bind operation. The bind user will then search for the user's
groups.

Closes elastic/elasticsearch#552
Closes elastic/elasticsearch#323

Original commit: elastic/x-pack-elasticsearch@3338730a64
2015-02-23 08:52:38 -05:00
jaymode d108faede3 [Test] AwaitsFix for tcp timeout tests. See elastic/elasticsearch#499
Original commit: elastic/x-pack-elasticsearch@31b79d51ac
2015-02-18 20:02:59 -05:00
jaymode cac922974d [Test] add a ldap search to the tcp timeout tests
If tests are run on the same machine as the ldap server a bind may be
succesfull. This adds a search to the test which should take longer than
1 millisecond for the server to respond.

Original commit: elastic/x-pack-elasticsearch@f37fb912e8
2015-02-18 18:20:59 -05:00
jaymode 52a2dd4acf [SSL/TLS] reduce logging when non https traffic is received on ssl channel
This removes the logging of an exception at the default log level when a incoming request in
the http transport is unencrypted and the http transport expects traffic to be encrypted.

Closes elastic/elasticsearch#561

Original commit: elastic/x-pack-elasticsearch@0cf23e8e9d
2015-02-18 10:27:20 -05:00
jaymode 4de8d04f9f [ldap] Migrate to using UnboundID SDK for LDAP
This migrates all of the LDAP code off of JNDI and makes use of the UnboundID
SDK to perform LDAP communication. As much as possible the behavior has
remained consistent. The minimum ldap search timeout is now 1s as UnboundID
only accepts this timeout in seconds; previously a value in milliseconds could be
specified.

Closes elastic/elasticsearch#694

Original commit: elastic/x-pack-elasticsearch@dd1c92bf91
2015-02-18 07:38:47 -05:00
Alexander Reelsen 17e16e2c53 Testing: Try to rebind in case of BindException
Original commit: elastic/x-pack-elasticsearch@e68e156a54
2015-02-17 15:36:07 +01:00
Alexander Reelsen 3f9f0fcadb Testing: Properly terminate thread pools
Original commit: elastic/x-pack-elasticsearch@a16cbed365
2015-02-17 15:21:28 +01:00
uboness a4a88c1a82 Updated ShieldVersion with version 1.0.1
Original commit: elastic/x-pack-elasticsearch@eea021633f
2015-02-12 17:54:47 -08:00
uboness d29cbe4ef7 Added NOTICE.txt
Original commit: elastic/x-pack-elasticsearch@aad60b86a8
2015-02-12 17:25:22 -08:00
jaymode 59fbf4d5f2 add the automaton library to the plugin zip
Original commit: elastic/x-pack-elasticsearch@6ceff1fc0f
2015-02-12 13:44:11 -08:00
jaymode af409e2ff8 [authz] fix Indices.Globals iterator to continue past a global without indices
If a Global permission is encountered that has no indices the iterator would not continue
to the rest of the entries. This change fixes the iterator to check if a Global has indices and
if not continues to look for a Global with indices permissions.

Closes elastic/elasticsearch#701

Original commit: elastic/x-pack-elasticsearch@5fbe318046
2015-02-12 12:58:22 -08:00
jaymode 6a8d971df1 [ldap] group search base_dn should not be null
JNDI will throw a NullPointerException when base_dn is not specified.
This should always be a non-null value that points to at least the base
of the directory or higher.

Closes elastic/elasticsearch#703

Original commit: elastic/x-pack-elasticsearch@825afcdd78
2015-02-12 12:36:41 -08:00