RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 2207488 - clevis luks bind failed with "Password generation failed - required entropy too low for settings"
Summary: clevis luks bind failed with "Password generation failed - required entropy t...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 9
Classification: Red Hat
Component: clevis
Version: 9.1
Hardware: Unspecified
OS: Unspecified
unspecified
medium
Target Milestone: rc
: ---
Assignee: Sergio Arroutbi
QA Contact: Martin Zelený
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2023-05-16 06:09 UTC by Ding-Yi Chen
Modified: 2023-11-07 09:29 UTC (History)
4 users (show)

Fixed In Version: clevis-18-112.el9
Doc Type: No Doc Update
Doc Text:
Clone Of:
Environment:
Last Closed: 2023-11-07 08:29:26 UTC
Type: Bug
Target Upstream Version:
Embargoed:
sarroutb: needinfo-
pm-rhel: mirror+


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Issue Tracker RHELPLAN-157300 0 None None None 2023-05-16 06:12:40 UTC
Red Hat Issue Tracker SECENGSP-5191 0 None None None 2023-05-16 06:12:44 UTC
Red Hat Knowledge Base (Solution) 3486131 0 None None None 2023-05-31 04:27:20 UTC
Red Hat Product Errata RHBA-2023:6386 0 None None None 2023-11-07 08:29:29 UTC

Description Ding-Yi Chen 2023-05-16 06:09:42 UTC
Description of problem:

For Systems that conform STIG V-230360 [1], pwmake cannot always generate passwords that fit the specification in pwquality.conf

Thus, whenever pwmake failed to generate password [2] that meet the criteria in pwquality.conf, clevis luks bind failed as well.


1. https://www.stigviewer.com/stig/red_hat_enterprise_linux_8/2020-11-25/finding/V-230360

2. https://bugzilla.redhat.com/show_bug.cgi?id=2207479 -  misleading error message "Password generation failed - required entropy too low for settings"

Version-Release number of selected component (if applicable):

clevis-18-106.el9.x86_64

How reproducible:

Only appear whenever pwmake failed to generate password

Steps to Reproduce:
1. Assuming that tangserver is at http://tangserver:7500, and disk partition to encrypt is /dev/sda3 
2. clevis luks bind -d /dev/sda3 sss '{"t":1,"pins":{"tang":[{"url":"http://tangserver:7500"}]}}'


Actual results:
  
  When pwmake failed to generated password, following will be shown

  Warning: Value 512 is outside of the allowed entropy range, adjusting it.
  Error: Password generation failed - required entropy too low for settings

Expected results:

No error

Additional info:

Workaround:
  Instead of using pwmake to generate password, use some others to generate password, such as:

  head -c 256 /dev/urandom | tr -dc '[:print:]' | head -c 20

Comment 1 Ding-Yi Chen 2023-05-16 06:17:51 UTC
Upstream [1] does have similar discussion, yet it was talking about warning 

"Value 512 is outside of the allowed entropy range, adjusting it.", which is just a harmless warning from pwmake.
 
However, the issue does not discuss in depth about "Password generation failed - required entropy too low for settings"


1. https://github.com/latchset/clevis/issues/321

Comment 2 Sergio Arroutbi 2023-05-25 11:44:53 UTC
Hello @dchen.

I could reproduce the issue on RHEL9.1. However, it seems it is fixed in RHEL9.2, possible because of this fix: https://bugzilla.redhat.com/show_bug.cgi?id=2159735

Could you please verify it in RHEL9.2?

Besides this, take into accout pwmake takes its entropy from /dev/urandom file, so proposed fix with /dev/urandom is not a correct alternative way IMHO.

Comment 3 Ding-Yi Chen 2023-05-31 04:18:21 UTC
(In reply to Sergio Arroutbi from comment #2)
> Hello @dchen.
> 
> I could reproduce the issue on RHEL9.1. However, it seems it is fixed in
> RHEL9.2, possible because of this fix:
> https://bugzilla.redhat.com/show_bug.cgi?id=2159735
> 
> Could you please verify it in RHEL9.2?

That fix just caps the bit to 256. It does make the following warning go away. 

"Value 512 is outside of the allowed entropy range, adjusting it."

Still, if `pwmake 256` failed, clevis luks bind failed as well.

I can still reproduce the bug with RHEL 9.2.

In order to properly reproduce the issue, use the following /etc/security/pwquality.conf

~~~
minlen = 15
ucredit = -1
dcredit = -1
maxclassrepeat = 4
minclass = 4
maxrepeat = 3
lcredit = -1
difok = 8
dictcheck = 1
ocredit = -1
~~~

And run the following loop:

~~~
for((i=0;i<30;i++));do pwmake 256; done
~~~

My RHEL 9.2 shows 
~~~
Error: Password generation failed - required entropy too low for settings
Error: Password generation failed - required entropy too low for settings
Error: Password generation failed - required entropy too low for settings
Error: Password generation failed - required entropy too low for settings
8imQes4Get4xCYxalZOmt
Error: Password generation failed - required entropy too low for settings
+iwLaGGoq[Us2Icv@g3g!yc&Iv0x@B,UGreN73H5@L)YL@S3k-aw;
Error: Password generation failed - required entropy too low for settings
Error: Password generation failed - required entropy too low for settings
Error: Password generation failed - required entropy too low for settings
)3LTobV@r^aRQ4zar4zOK0jk4n!USoc.yh#ONiL&up%Iz7yM@zYzH
Error: Password generation failed - required entropy too low for settings
yK3t4LYbIzahOfOg5oq*UfozJyJ6UbeLj4MiGIr1@J3GmEG%3G)uw;
Error: Password generation failed - required entropy too low for settings
UHbUh[Urb4sIj;ulKuS3R@GD0skUttAR83KYxErMucHUn]UxxEn90
Error: Password generation failed - required entropy too low for settings
t4maNAk=Otem^0N$AN6@r8UkaR*efUdyLsiq,OzYgVoB3P-@bpONv
Error: Password generation failed - required entropy too low for settings
Error: Password generation failed - required entropy too low for settings
Error: Password generation failed - required entropy too low for settings
Error: Password generation failed - required entropy too low for settings
Error: Password generation failed - required entropy too low for settings
Error: Password generation failed - required entropy too low for settings
VISreBPAl=UhIp0jEcih5yzUgYzdOtyD;YSq0zPixaGuBLAkq4pvOv
Error: Password generation failed - required entropy too low for settings
Error: Password generation failed - required entropy too low for settings
Error: Password generation failed - required entropy too low for settings
Error: Password generation failed - required entropy too low for settings
Error: Password generation failed - required entropy too low for settings
LupBOgdYSxyPyJ4p4N-axOfp3zaK4g;4f3lr0mDil0GoKew(0GoM^E
~~~

Less that half success.

> 
> Besides this, take into accout pwmake takes its entropy from /dev/urandom
> file, so proposed fix with /dev/urandom is not a correct alternative way
> IMHO.

I am fully aware that both my workaround and pwmake use /dev/urandom.
That implies I am totally not against the usage of /dev/urandom.

It is fully reasonable that you want to hang on pwmake.
So how about: replace 

~~~
pwmake "${bits}"
~~~

with 

~~~
for((i=0;i<50;i++));do if pwmake "${bits}" 2>/dev/null; then break; fi;  done
~~~

This loop attempts to generate a password using the 'pwmake' command.
It iterates 50 times or until a password is successfully generated via pwmake

Comment 14 errata-xmlrpc 2023-11-07 08:29:26 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (clevis bug fix and enhancement update), and where to find the updated
files, follow the link below.

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

https://access.redhat.com/errata/RHBA-2023:6386


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