elasticsearch/distribution
Ioannis Kakavas e7d06843f9
Gracefully handle exceptions from Security Providers (#65464)
In certain situations, such as when configured in FIPS 140 mode,
the Java security provider in use might throw a subclass of
java.lang.Error. We currently do not catch these and as a result
the JVM exits, shutting down elasticsearch.

This commit attempts to address this by catching subclasses of Error
that might be thrown for instance when a PBKDF2 implementation
is used from a Security Provider in FIPS 140 mode, with the password
input being less than 14 bytes (112 bits).

- In our PBKDF2 family of hashers, we catch the Error and
throw an ElasticsearchException while creating or verifying the
hash. We throw on verification instead of simply returning false
on purpose so that the message bubbles up and the cause becomes
obvious (otherwise it would be indistinguishable from a wrong
password).
- In KeyStoreWrapper, we catch the Error in order to wrap and re-throw 
a GeneralSecurityException with a helpful message. This can happen when 
using any of the keystore CLI commands, when the node starts or when we 
attempt to reload secure settings.
- In the `elasticsearch-users` tool, we catch the ElasticsearchException that
the Hasher class re-throws and throw an appropriate UserException.

Tests are missing because it's not trivial to set CI in fips approved mode
right now, and thus any tests would need to be muted. There is a parallel
effort in #64024 to enable that and tests will be added in a followup.
2020-11-26 15:57:33 +02:00
..
archives Move tasks in build scripts to task avoidance api (#64046) 2020-11-12 12:04:15 +01:00
bwc Wire local unreleased bwc versions more efficient for tests (#62473) 2020-10-01 10:45:21 +02:00
docker Rework Dockerfile instructions to save space (#65308) 2020-11-20 15:35:47 +00:00
licenses Add notice for bundled jdk (#40576) 2019-03-29 17:20:53 -04:00
packages Use services for archive and file operations in tasks (#62968) 2020-10-01 10:47:41 +02:00
src Windows service installation should allow multiple values in ES_JAVA_OPTS (#64254) 2020-10-30 14:13:17 -04:00
tools Gracefully handle exceptions from Security Providers (#65464) 2020-11-26 15:57:33 +02:00
build.gradle Move tasks in build scripts to task avoidance api (#64046) 2020-11-12 12:04:15 +01:00