From 387b3776f4e3c1cf08150085039c03d1bd271da9 Mon Sep 17 00:00:00 2001 From: Benjamin Gilbert Date: Thu, 20 Jan 2022 16:41:07 -0500 Subject: [PATCH] 2.13.0 Resolves: rhbz#2003965 --- .gitignore | 1 + ignition.spec | 11 ++++++-- luks-volume-reuse.patch | 56 +++++++++++++++++++++++++++++++++++++++++ sources | 2 +- 4 files changed, 67 insertions(+), 3 deletions(-) create mode 100644 luks-volume-reuse.patch diff --git a/.gitignore b/.gitignore index 793e140..f6fd6db 100644 --- a/.gitignore +++ b/.gitignore @@ -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 diff --git a/ignition.spec b/ignition.spec index 8703bc2..2c42301 100644 --- a/ignition.spec +++ b/ignition.spec @@ -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 - 2.13.0-1 +- New release +- Fix LUKS volume reuse +- Avoid double patch application + * Thu Sep 16 2021 Sohan Kunkerkar - 2.12.0-1 - Suppress hardcoded library path warning - Fix go-mods-to-bundled-provides script to parse correct rpm version diff --git a/luks-volume-reuse.patch b/luks-volume-reuse.patch new file mode 100644 index 0000000..b27f481 --- /dev/null +++ b/luks-volume-reuse.patch @@ -0,0 +1,56 @@ +From aed47c18aee593d155d45c0fe9ba29a9e3123cf6 Mon Sep 17 00:00:00 2001 +From: Benjamin Gilbert +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 + diff --git a/sources b/sources index d8e596a..5799214 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (ignition-2.12.0.tar.gz) = 7bbccd680f52df25cdbdd56ae89a2c4f6e628cc0db21e0c3405fd6d4af640546707b1cb7a9ba0cc4db65bed1ecb3c18afea69001a6be42aabbaba43794e29a6f +SHA512 (ignition-2.13.0.tar.gz) = 8e5a2e2feac002e829f2d5de54596752efef3a42ad393e55a15c0cc50b7ea4c438380cbb82c9ed386721cccea4a579e32960c463a7ec4fc27ac8aa532cf425ca