diff --git a/0001-Throw-error-if-SSH-keys-could-not-be-written.patch b/0001-Throw-error-if-SSH-keys-could-not-be-written.patch new file mode 100644 index 0000000..c5820d3 --- /dev/null +++ b/0001-Throw-error-if-SSH-keys-could-not-be-written.patch @@ -0,0 +1,29 @@ +commit 7d5235ce7ab91ec21e50f09295dd40fd59a98005 +Author: Ignaz Forster +Date: Wed Jan 8 17:29:55 2020 +0100 +References: [boo#1159232] +Upstream: Merged [gh#coreos/ignition#908] + + Throw error if SSH keys could not be written + +diff --git a/internal/exec/util/passwd.go b/internal/exec/util/passwd.go +index 5d961e3..55c378c 100644 +--- a/internal/exec/util/passwd.go ++++ b/internal/exec/util/passwd.go +@@ -173,11 +173,14 @@ func (u Util) AuthorizeSSHKeys(c types.PasswdUser) error { + } + + if distro.WriteAuthorizedKeysFragment() { +- writeAuthKeysFile(usr, filepath.Join(usr.HomeDir, ".ssh", "authorized_keys.d", "ignition"), []byte(ks)) ++ err = writeAuthKeysFile(usr, filepath.Join(usr.HomeDir, ".ssh", "authorized_keys.d", "ignition"), []byte(ks)) + } else { +- writeAuthKeysFile(usr, filepath.Join(usr.HomeDir, ".ssh", "authorized_keys"), []byte(ks)) ++ err = writeAuthKeysFile(usr, filepath.Join(usr.HomeDir, ".ssh", "authorized_keys"), []byte(ks)) + } + ++ if err != nil { ++ return fmt.Errorf("failed to set SSH key: %v", err) ++ } + return nil + }, "adding ssh keys to user %q", c.Name) + } diff --git a/ignition.changes b/ignition.changes index 0bf5ccd..098daa4 100644 --- a/ignition.changes +++ b/ignition.changes @@ -1,3 +1,10 @@ +------------------------------------------------------------------- +Wed Jan 8 17:47:30 UTC 2020 - Ignaz Forster + +- Add 0001-Throw-error-if-SSH-keys-could-not-be-written.patch: + Don't silently ignore if the SSH key could not be written + [boo#1159232] + ------------------------------------------------------------------- Mon Dec 23 09:16:22 UTC 2019 - iforster@suse.de diff --git a/ignition.spec b/ignition.spec index 71b0b71..0994f0d 100644 --- a/ignition.spec +++ b/ignition.spec @@ -1,7 +1,7 @@ # # spec file for package ignition # -# Copyright (c) 2019 SUSE LLC +# Copyright (c) 2020 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -24,6 +24,7 @@ License: Apache-2.0 Group: System/Management URL: https://github.com/coreos/ignition Source: %{name}-%{version}.tar.xz +Patch1: 0001-Throw-error-if-SSH-keys-could-not-be-written.patch Requires: dracut BuildRequires: dracut BuildRequires: libblkid-devel @@ -40,6 +41,7 @@ applies the configuration. %prep %setup -q +%patch1 -p1 %build sed -i -e 's|go build -ldflags|go build -buildmode=pie -ldflags|g' build