Skip to content

[7.10] Gracefully handle exceptions from Security Providers (#65464)#65554

Merged
jkakavas merged 1 commit intoelastic:7.10from
jkakavas:backport/7.10/pr-65464
Nov 26, 2020
Merged

[7.10] Gracefully handle exceptions from Security Providers (#65464)#65554
jkakavas merged 1 commit intoelastic:7.10from
jkakavas:backport/7.10/pr-65464

Conversation

@jkakavas
Copy link
Copy Markdown
Contributor

Backports the following commits to 7.10:

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 elastic#64024 to enable that and tests will be added in a followup.
@jkakavas jkakavas merged commit 12ba9e3 into elastic:7.10 Nov 26, 2020
jkakavas added a commit that referenced this pull request Nov 26, 2020
…#65554)"

This reverts commit 12ba9e3. This
commit was mechanically backported to 7.10 while it shouldn't have
been.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant