Bug 1540907 - Use native SecureRandom implementation instead of SHA1PRNG
Summary: Use native SecureRandom implementation instead of SHA1PRNG
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: ovirt-engine
Classification: oVirt
Component: AAA
Version: ---
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: ovirt-4.2.2
: ---
Assignee: Martin Perina
QA Contact: Lukas Svaty
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2018-02-01 09:57 UTC by Martin Perina
Modified: 2018-03-29 11:12 UTC (History)
4 users (show)

Fixed In Version: ovirt-engine-4.2.2
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2018-03-29 11:12:52 UTC
oVirt Team: Infra
Embargoed:
rule-engine: ovirt-4.2+


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Bugzilla 1540909 0 medium CLOSED Use native SecureRandom implementation instead of SHA1PRNG 2021-02-22 00:41:40 UTC
oVirt gerrit 87000 0 'None' 'MERGED' 'core: Use NativePRNG instead of SHA1PRNG' 2019-11-21 14:16:53 UTC
oVirt gerrit 87548 0 'None' 'MERGED' 'core: Use static SecureRandom instance in CryptMD5' 2019-11-21 14:16:53 UTC
oVirt gerrit 87549 0 'None' 'MERGED' 'core: Use static SecureRandom instance in TicketEncoder' 2019-11-21 14:16:53 UTC
oVirt gerrit 87557 0 'None' 'MERGED' 'core: Use NativePRNG instead of SHA1PRNG' 2019-11-21 14:16:53 UTC
oVirt gerrit 87558 0 'None' 'MERGED' 'core: Use static SecureRandom instance in CryptMD5' 2019-11-21 14:16:53 UTC
oVirt gerrit 87559 0 'None' 'MERGED' 'core: Use static SecureRandom instance in TicketEncoder' 2019-11-21 14:16:54 UTC

Internal Links: 1540909

Description Martin Perina 2018-02-01 09:57:06 UTC
Probably from historical reasons engine was using SHA1PRNG implementation for random number generation. SHA1PRNG is pseudo-random number generator implemented within JVM (more details at [1]) and it's blocking implementation (it can block the entire process if there is not enough entropy), which could cause issues when engine is running inside a VM.

We should switch to NativePRNG, which is blocking only for seed generation. More information about Java implementation is available at [1] and [2].


[1] https://docs.oracle.com/javase/8/docs/technotes/guides/security/StandardNames.html#SecureRandom 
[2] https://tersesystems.com/blog/2015/12/17/the-right-way-to-use-securerandom/

Comment 1 Roy Golan 2018-02-06 07:21:17 UTC
Running systems out there may benefit by simply setting the JRE to use /dev/urandom in java.security property file:

 $JAVA_HOME/jre/lib/security/java.security
 ...
 securerandom.source=file:/dev/urandom

Comment 2 Martin Perina 2018-02-06 09:33:11 UTC
(In reply to Roy Golan from comment #1)
> Running systems out there may benefit by simply setting the JRE to use
> /dev/urandom in java.security property file:
> 
>  $JAVA_HOME/jre/lib/security/java.security
>  ...
>  securerandom.source=file:/dev/urandom

I'd personally rather not change the platform default. And also I'm not sure if this will affect us, because AFAIK SHA1PRNG is custom Java implementation and not sure if it uses /dev/(u)random or not. That's why I think it's better to switch from SHA1PRNG to NativePRNG without changing JVM default.

Comment 3 Roy Golan 2018-02-06 16:29:54 UTC
(In reply to Martin Perina from comment #2)

> I'd personally rather not change the platform default.

I mentioned this is for existing setups that may suffer from it.

> And also I'm not sure
> if this will affect us, because AFAIK SHA1PRNG is custom Java implementation
> and not sure if it uses /dev/(u)random or not.

According to the sources you mentioned in the patch and reading the oracle implementation it does look like they are using the device that is mentioned java.security

> That's why I think it's
> better to switch from SHA1PRNG to NativePRNG without changing JVM default.

Comment 4 Lukas Svaty 2018-03-07 09:49:12 UTC
adding CodeChange moving to VERIFIED

Comment 5 Martin Perina 2018-03-07 13:15:41 UTC
BZ1421472 is the original bug, I have found this issue when investigating it. So I think you can use the same reproducing steps to verify it.

Comment 6 Sandro Bonazzola 2018-03-29 11:12:52 UTC
This bugzilla is included in oVirt 4.2.2 release, published on March 28th 2018.

Since the problem described in this bug report should be
resolved in oVirt 4.2.2 release, it has been closed with a resolution of CURRENT RELEASE.

If the solution does not work for you, please open a new bug report.


Note You need to log in before you can comment on or make changes to this bug.