clevis-luks-askpass now exits cleanly with SIGTERM

Backport of upstream PR#230.
Resolves: rhbz#1876001
This commit is contained in:
Sergio Correia 2020-09-08 10:02:42 -03:00
parent aedbfaae21
commit fe15ade0e2
2 changed files with 41 additions and 1 deletions

View File

@ -0,0 +1,33 @@
From 6eba228a763ea319a8f0a9b9ba1e76e66cef733c Mon Sep 17 00:00:00 2001
From: Sergio Correia <scorreia@redhat.com>
Date: Sat, 5 Sep 2020 09:09:06 -0300
Subject: [PATCH] systemd: clevis-luks-askpass: exit cleanly with SIGTERM
Especially when running in early boot, clevis-luks-askpass may be
looping because e.g. we still have devices remaining to unlock, as
per crypttab, or we were unable to determine if there are any devices
left to be unlocked.
Eventually we may receive a SIGTERM, from e.g. systemd and we should
exit cleanly in this situation.
---
src/luks/systemd/clevis-luks-askpass | 3 +++
1 file changed, 3 insertions(+)
diff --git a/src/luks/systemd/clevis-luks-askpass b/src/luks/systemd/clevis-luks-askpass
index d17d122..285bba4 100755
--- a/src/luks/systemd/clevis-luks-askpass
+++ b/src/luks/systemd/clevis-luks-askpass
@@ -22,6 +22,9 @@ set -eu
. clevis-luks-common-functions
+# Make sure to exit cleanly if SIGTERM is received.
+trap 'echo "Exiting due to SIGTERM" && exit 0' TERM
+
loop=
path=/run/systemd/ask-password
while getopts ":lp:" o; do
--
2.28.0

View File

@ -1,12 +1,14 @@
Name: clevis Name: clevis
Version: 14 Version: 14
Release: 3%{?dist} Release: 4%{?dist}
Summary: Automated decryption framework Summary: Automated decryption framework
License: GPLv3+ License: GPLv3+
URL: https://github.com/latchset/%{name} URL: https://github.com/latchset/%{name}
Source0: https://github.com/latchset/%{name}/releases/download/v%{version}/%{name}-%{version}.tar.xz Source0: https://github.com/latchset/%{name}/releases/download/v%{version}/%{name}-%{version}.tar.xz
Patch0001: 0001-systemd-clevis-luks-askpass-exit-cleanly-with-SIGTER.patch
BuildRequires: git BuildRequires: git
BuildRequires: gcc BuildRequires: gcc
BuildRequires: meson BuildRequires: meson
@ -182,6 +184,11 @@ exit 0
%attr(4755, root, root) %{_libexecdir}/%{name}-luks-udisks2 %attr(4755, root, root) %{_libexecdir}/%{name}-luks-udisks2
%changelog %changelog
* Tue Sep 08 2020 Sergio Correia <scorreia@redhat.com> - 14-4
- Backport upstream PR#230 - clevis-luks-askpass now exits cleanly
when receives a SIGTERM
Resolves: rhbz#1876001
* Sat Sep 05 2020 Sergio Correia <scorreia@redhat.com> - 14-3 * Sat Sep 05 2020 Sergio Correia <scorreia@redhat.com> - 14-3
- If clevis-luks-askpass is enabled, it may be using a wrong target, - If clevis-luks-askpass is enabled, it may be using a wrong target,
since that changed in v14. Check and update it, if required. since that changed in v14. Check and update it, if required.