Bug 1976880

Summary: RFE: Stop sending stderr to the void when decryption doesn't happen
Product: Red Hat Enterprise Linux 8 Reporter: Renaud Métrich <rmetrich>
Component: clevisAssignee: Sergio Correia <scorreia>
Status: CLOSED ERRATA QA Contact: Martin Zelený <mzeleny>
Severity: medium Docs Contact:
Priority: medium    
Version: 8.4CC: dapospis, mzeleny, rsroka
Target Milestone: rcKeywords: AutoVerified, FutureFeature, Triaged
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: clevis-15-4.el8 Doc Type: No Doc Update
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-05-10 13:52:43 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Renaud Métrich 2021-06-28 12:58:53 UTC
Description of problem:

When "clevis decrypt" fails for some reason, while in the initramfs and called through clevis_luks_unlock_device_by_slot() function call, the error it can produce is sent to /dev/null, which makes it hard to troubleshoot.

I think the error should be printed on the console, or at least saved to some storage and a message printed back to the user for the user to be able to troubleshoot after having manually unlocked the device:

Original code in /usr/bin/clevis-luks-common-functions:
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------
313 clevis_luks_unlock_device_by_slot() {
 :
326     if ! passphrase="$(printf '%s' "${jwe}" | clevis decrypt 2>/dev/null)" \
 :
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------

Proposed minimal enhancement:
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------
313 clevis_luks_unlock_device_by_slot() {
 :
326     if ! passphrase="$(printf '%s' "${jwe}" | clevis decrypt)" \
 :
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------

Fedora 34 code already has this, as part of commit:
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------
commit f4ed006f16380ad42efe2c70fe66080d0c420144
Author: Sergio Correia <scorreia>
Date:   Thu Mar 18 11:51:03 2021 -0300
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------


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

clevis-luks-15-1.el8.x86_64


How reproducible:

N/A

Comment 13 errata-xmlrpc 2022-05-10 13:52:43 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-2022:1857