Resolves: rhbz#2003965
This commit is contained in:
Benjamin Gilbert 2022-01-20 16:41:07 -05:00
parent 410f3514a1
commit 387b3776f4
4 changed files with 67 additions and 3 deletions

1
.gitignore vendored
View File

@ -54,3 +54,4 @@
/ignition-1d56dc8.tar.gz
/ignition-2.9.0.tar.gz
/ignition-2.12.0.tar.gz
/ignition-2.13.0.tar.gz

View File

@ -10,7 +10,7 @@
# https://github.com/coreos/ignition
%global goipath github.com/coreos/ignition
%global gomodulesmode GO111MODULE=on
Version: 2.12.0
Version: 2.13.0
%gometa
@ -26,6 +26,8 @@ Summary: First boot installer and configuration tool
License: ASL 2.0
URL: %{gourl}
Source0: %{gosource}
# https://github.com/coreos/ignition/pull/1307
Patch0: luks-volume-reuse.patch
BuildRequires: libblkid-devel
@ -236,10 +238,10 @@ Ignition project's Github releases page.
%prep
%if 0%{?fedora}
%goprep -k
%autopatch -p1
%else
%forgeautosetup -p1
%endif
%autopatch -p1
%build
export LDFLAGS="-X github.com/coreos/ignition/v2/internal/version.Raw=%{version} -X github.com/coreos/ignition/v2/internal/distro.selinuxRelabel=true "
@ -309,6 +311,11 @@ install -p -m 0755 ./ignition %{buildroot}/%{dracutlibdir}/modules.d/30ignition
%endif
%changelog
* Thu Jan 20 2022 Benjamin Gilbert <bgilbert@redhat.com> - 2.13.0-1
- New release
- Fix LUKS volume reuse
- Avoid double patch application
* Thu Sep 16 2021 Sohan Kunkerkar <skunkerk@redhat.com> - 2.12.0-1
- Suppress hardcoded library path warning
- Fix go-mods-to-bundled-provides script to parse correct rpm version

56
luks-volume-reuse.patch Normal file
View File

@ -0,0 +1,56 @@
From aed47c18aee593d155d45c0fe9ba29a9e3123cf6 Mon Sep 17 00:00:00 2001
From: Benjamin Gilbert <bgilbert@redhat.com>
Date: Mon, 17 Jan 2022 21:17:08 -0500
Subject: [PATCH] disks: fix reuse of statically keyed LUKS volume
We need to persist a volume's keyfile to the real root even if we take
the early `continue` when reusing the volume. Rather than copying code,
enable persistence up front and then disable it afterward if we decide
not to persist the key.
Fixes error:
CRITICAL : Ignition failed: creating crypttab entries: missing persisted keyfile for [...]
Fixes: https://github.com/coreos/ignition/issues/1305
Fixes: 65e9c1611128 ("stages/disks: use State to persist keyfiles for files stage")
---
internal/exec/stages/disks/luks.go | 15 ++++++++-------
1 file changed, 8 insertions(+), 7 deletions(-)
diff --git a/internal/exec/stages/disks/luks.go b/internal/exec/stages/disks/luks.go
index 77ecc24e..5fa15e70 100644
--- a/internal/exec/stages/disks/luks.go
+++ b/internal/exec/stages/disks/luks.go
@@ -156,6 +156,13 @@ func (s *stage) createLuks(config types.Config) error {
}
}
}
+ // store the key to be persisted into the real root
+ // do this here so device reuse works correctly
+ key, err := ioutil.ReadFile(keyFilePath)
+ if err != nil {
+ return fmt.Errorf("failed to read keyfile %q: %w", keyFilePath, err)
+ }
+ s.State.LuksPersistKeyFiles[luks.Name] = dataurl.EncodeBytes(key)
if !util.IsTrue(luks.WipeVolume) {
// If the volume isn't forcefully being created, then we need
@@ -329,13 +336,7 @@ func (s *stage) createLuks(config types.Config) error {
); err != nil {
return fmt.Errorf("removing key file from luks device: %v", err)
}
- } else {
- // store the key to be persisted into the real root
- key, err := ioutil.ReadFile(keyFilePath)
- if err != nil {
- return fmt.Errorf("failed to read keyfile %q: %w", keyFilePath, err)
- }
- s.State.LuksPersistKeyFiles[luks.Name] = dataurl.EncodeBytes(key)
+ delete(s.State.LuksPersistKeyFiles, luks.Name)
}
}
--
2.33.1

View File

@ -1 +1 @@
SHA512 (ignition-2.12.0.tar.gz) = 7bbccd680f52df25cdbdd56ae89a2c4f6e628cc0db21e0c3405fd6d4af640546707b1cb7a9ba0cc4db65bed1ecb3c18afea69001a6be42aabbaba43794e29a6f
SHA512 (ignition-2.13.0.tar.gz) = 8e5a2e2feac002e829f2d5de54596752efef3a42ad393e55a15c0cc50b7ea4c438380cbb82c9ed386721cccea4a579e32960c463a7ec4fc27ac8aa532cf425ca