ranger-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Pradeep Agrawal <pradeepagrawal8...@gmail.com>
Subject Re: Review Request 71998: RANGER-2700: Use SecureRandom.getInstance(NativePRNGNonBlocking) to get random string
Date Thu, 16 Jan 2020 07:39:19 GMT

-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/71998/#review219291
-----------------------------------------------------------



Can you add the testing done for the fresh and upgrade case.

- Pradeep Agrawal


On Jan. 15, 2020, 2:19 a.m., Jiayi Liu wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/71998/
> -----------------------------------------------------------
> 
> (Updated Jan. 15, 2020, 2:19 a.m.)
> 
> 
> Review request for ranger, Ankita Sinha, bhavik patel, Gautam Borad, Abhay Kulkarni,
Madhan Neethiraj, Mehul Parikh, Nikhil P, Nitin Galave, Ramesh Mani, Sailaja Polavarapu, and
Velmurugan Periasamy.
> 
> 
> Bugs: RANGER-2700
>     https://issues.apache.org/jira/browse/RANGER-2700
> 
> 
> Repository: ranger
> 
> 
> Description
> -------
> 
> In Ranger-2.0.0, the request that creating new service often stuck on generateBase64EncodedIV()
in PasswordUtils.java. It uses SecureRandom.getInstanceStrong() to get the random string.
We can find a lot of information showing that this function often blocks and is very slow.
SecureRandom.getInstanceStrong() uses /dev/random, and /dev/random blocks the thread if there
isn't enough randomness available, but /dev/urandom will never block.
> 
> SecureRandom.getInstanceStrong() is equivalent to SecureRandom.getInstance("NativePRNGBlocking"),
so we can use /dev/urandom by replacing SecureRandom.getInstanceStrong().nextBytes(iv) with
SecureRandom.getInstance("NativePRNGNonBlocking").nextBytes(iv) which will not be blocked,
or we can use new SecureRandom().nextBytes(iv). /dev/random and /dev/urandom use the same
pool of randomness under the hood, and they are equally secure.
> 
> 
> Diffs
> -----
> 
>   agents-common/src/main/java/org/apache/ranger/plugin/util/PasswordUtils.java c08f55d6e

> 
> 
> Diff: https://reviews.apache.org/r/71998/diff/1/
> 
> 
> Testing
> -------
> 
> 
> Thanks,
> 
> Jiayi Liu
> 
>


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message