Bug 2152618

Summary: Test for available issuercert before creating CA
Product: Red Hat Enterprise Linux 9 Reporter: John Ferlan <jferlan>
Component: swtpmAssignee: Marc-Andre Lureau <marcandre.lureau>
Status: CLOSED ERRATA QA Contact: Yanqiu Zhang <yanqzhan>
Severity: high Docs Contact:
Priority: unspecified    
Version: 9.2CC: ddepaula, jdenemar, lmen, marcandre.lureau, nmagnezi, xuzhang, yalzhang, yanqzhan, ymankad
Target Milestone: rcKeywords: AutomationTriaged, Triaged, ZStream
Target Release: 9.2   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: swtpm-0.8.0-1.el9 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: 2100508
: 2152916 2152917 (view as bug list) Environment:
Last Closed: 2023-05-09 07:47:50 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:
Bug Depends On: 2092944, 2100508    
Bug Blocks: 2108470, 2109987, 2152916, 2152917    

Description John Ferlan 2022-12-12 14:03:51 UTC
+++ This bug was initially created as a clone of Bug #2100508 +++

Description of problem:
We (assisted-installer team which are related to OpenShift product) are currently experiencing some problems when trying to use swtpm version 0.7.0 in our tests. The bug is documented better in this GitHub issue: https://github.com/stefanberger/swtpm/issues/644

We would like RHEL 8.6 to have the updated patch version 0.7.1 of swtpm, because it contains the bug-fix for that problem.

Version-Release number of selected component (if applicable):
swtpm/swtpm-tools/swtpm-libs 0.7.0

How reproducible:
The original bug is a race-condition, affecting around 60% of selected jobs.

--- Additional comment from Nir Magnezi on 2022-07-11 09:07:35 UTC ---

Hi Danilo,

Any chance this can get a priority? it is impacting our CI:
https://prow.ci.openshift.org/view/gs/origin-ci-test/logs/periodic-ci-openshift-assisted-test-infra-release-ocm-2.5-e2e-metal-assisted-tpmv2-periodic/1546312689087680512

--- Additional comment from Danilo Cesar Lemes de Paula on 2022-07-18 17:31:27 UTC ---

(In reply to Nir Magnezi from comment #1)
> Hi Danilo,
> 
> Any chance this can get a priority? it is impacting our CI:
> https://prow.ci.openshift.org/view/gs/origin-ci-test/logs/periodic-ci-
> openshift-assisted-test-infra-release-ocm-2.5-e2e-metal-assisted-tpmv2-
> periodic/1546312689087680512

Assigning to the right engineer so he can decide.

--- Additional comment from Marc-Andre Lureau on 2022-07-18 17:58:40 UTC ---

The patch looks safe enough to backport:
https://github.com/stefanberger/swtpm/commit/27d4c5d83ff014f3b08cb7fc8ffdbfc32306cfbb

Do we need it in 8.6z, or can we simply target 8.7?

--- Additional comment from Osher De Paz on 2022-07-18 18:10:45 UTC ---

For our team needs it's crucial to have it for 8.6 because that's the version our cloud provider and the QE machines are set on

--- Additional comment from Marc-Andre Lureau on 2022-07-18 18:34:56 UTC ---

please qa ack

--- Additional comment from John Ferlan on 2022-07-19 10:19:52 UTC ---

Set ITM=26 to get release+

--- Additional comment from John Ferlan on 2022-07-19 10:36:11 UTC ---

Whoops - wrong tab.  Let's use this as the y-stream bug and go through the proper z-stream cloning process.  

I also set the dependent product to make it clearer that this affects OpenShift as noted in the problem statement.

I have closed bug 2108470

--- Additional comment from RHEL Program Management on 2022-07-22 15:22:49 UTC ---

This BZ has been approved for cloning.

The BZ can be now cloned by everyone with the self-service cloning tool https://watson.engineering.redhat.com/rules

For more information regarding ZStream and cloning please visit https://docs.google.com/document/d/1yL8iTHjxyQ7sI-fC4PcPjpOOyfF5ECGnK-B7r_QRZm4/edit#

--- Additional comment from RHEL Program Management Team on 2022-07-22 15:55:23 UTC ---

This bug has been copied as 8.6.0 stream bug#2109987 and now must be resolved in the current update release, blocker flag set.

--- Additional comment from yanqzhan on 2022-07-25 08:00:29 UTC ---

Reproduce with swtpm-0.7.0-3.20211109gitb79fd91.module+el8.7.0+15743+c774064d.x86_64:
# rm -rf /var/lib/swtpm-localca/* ; for ((i = 0; i<200;i++)); do rm -rf /tmp/vtpm${i}; mkdir -p /tmp/vtpm${i}; swtpm_setup --tpm2 --tpmstate /tmp/vtpm${i} --create-ek-cert --create-platform-cert --pcr-banks sha256 2>&1 | grep -i read & done
[1] 104430
[2] 104434
[3] 104438
...
[200] 106130
# swtpm_localca exit with status 1: Need read rights on issuer certificate /var/lib/swtpm-localca/issuercert.pem for user root.
swtpm_localca exit with status 1: Need read rights on issuer certificate /var/lib/swtpm-localca/issuercert.pem for user root.
...

Verify with:
swtpm-0.7.0-4.20211109gitb79fd91.module+el8.7.0+15999+d24f860e.x86_64.rpm

# rm -rf /var/lib/swtpm-localca/* ; for ((i = 0; i<200;i++)); do rm -rf /tmp/vtpm${i}; mkdir -p /tmp/vtpm${i}; swtpm_setup --tpm2 --tpmstate /tmp/vtpm${i} --create-ek-cert --create-platform-cert --pcr-banks sha256 2>&1 | grep -i read & done
[1] 118044
[2] 118048
...
[200] 119748
#

--- Additional comment from errata-xmlrpc on 2022-08-05 07:54:14 UTC ---

This bug has been added to advisory RHEA-2022:92978 by Marc-Andre Lureau (mlureau)

--- Additional comment from errata-xmlrpc on 2022-11-08 00:20:31 UTC ---

Bug report changed to RELEASE_PENDING status by Errata System.
Advisory RHSA-2022:92978-06 has been changed to PUSH_READY status.
https://errata.devel.redhat.com/advisory/92978

--- Additional comment from errata-xmlrpc on 2022-11-08 09:20:10 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 (Low: virt:rhel and virt-devel:rhel security, 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/RHSA-2022:7472


+++++

Creating this clone in order to ensure backport of this patch into 9.0.z-stream in order to match the 9.0.z-stream bug 2109987

Comment 4 John Ferlan 2022-12-12 14:12:39 UTC
Requesting 9.0.z-stream in order to ensure the 8.6.z-stream resolved bug 2109987 does not cause a regression for any 9.0.z migration/upgrade

Comment 9 Yanqiu Zhang 2023-01-03 03:09:25 UTC
Tested with swtpm-0.8.0-1.el9.x86_64

# rm -rf /var/lib/swtpm-localca/* ; for ((i = 0; i<1000;i++)); do rm -rf /tmp/vtpm${i}; mkdir -p /tmp/vtpm${i}; swtpm_setup --tpm2 --tpmstate /tmp/vtpm${i} --create-ek-cert --create-platform-cert --pcr-banks sha256 2>&1 | grep -i read & done

(No such error: swtpm_localca exit with status 1: Need read rights on issuer certificate /var/lib/swtpm-localca/issuercert.pem for user root.)

Comment 13 Yanqiu Zhang 2023-01-10 09:01:48 UTC
Mark as verified per comment9 with a downstream pkg.

Comment 15 errata-xmlrpc 2023-05-09 07:47:50 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 (swtpm 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:2348