|
|
4ba90c |
From 8f0fcf2e7384ad757042e7e6a0850f655eb70b7e Mon Sep 17 00:00:00 2001
|
|
|
4ba90c |
From: Sergio Correia <scorreia@redhat.com>
|
|
|
4ba90c |
Date: Thu, 18 Nov 2021 16:45:58 -0300
|
|
|
4ba90c |
Subject: [PATCH 4/4] systemd: drop ncat dependency
|
|
|
4ba90c |
|
|
|
4ba90c |
When using systemd, i.e., clevis-luks-askpass, we use ncat to send
|
|
|
4ba90c |
the decrypted password to the systemd socket as per systemd's password
|
|
|
4ba90c |
agents specification [1].
|
|
|
4ba90c |
|
|
|
4ba90c |
However, systemd itself has a utility that does exactly that,
|
|
|
4ba90c |
systemd-reply-password.
|
|
|
4ba90c |
|
|
|
4ba90c |
In this commit we drop the ncat dependency and instead use
|
|
|
4ba90c |
systemd-reply-password in clevis-luks-askpass.
|
|
|
4ba90c |
|
|
|
4ba90c |
[1] https://systemd.io/PASSWORD_AGENTS/
|
|
|
4ba90c |
---
|
|
|
4ba90c |
...is-luks-askpass => clevis-luks-askpass.in} | 2 +-
|
|
|
4ba90c |
.../systemd/dracut/clevis/module-setup.sh.in | 4 ++--
|
|
|
4ba90c |
src/luks/systemd/meson.build | 19 +++++++++++++++++--
|
|
|
4ba90c |
3 files changed, 20 insertions(+), 5 deletions(-)
|
|
|
4ba90c |
rename src/luks/systemd/{clevis-luks-askpass => clevis-luks-askpass.in} (97%)
|
|
|
4ba90c |
|
|
|
4ba90c |
diff --git a/src/luks/systemd/clevis-luks-askpass b/src/luks/systemd/clevis-luks-askpass.in
|
|
|
4ba90c |
similarity index 97%
|
|
|
4ba90c |
rename from src/luks/systemd/clevis-luks-askpass
|
|
|
4ba90c |
rename to src/luks/systemd/clevis-luks-askpass.in
|
|
|
4ba90c |
index f19671f..a6699c9 100755
|
|
|
4ba90c |
--- a/src/luks/systemd/clevis-luks-askpass
|
|
|
4ba90c |
+++ b/src/luks/systemd/clevis-luks-askpass.in
|
|
|
4ba90c |
@@ -58,7 +58,7 @@ while true; do
|
|
|
4ba90c |
fi
|
|
|
4ba90c |
|
|
|
4ba90c |
uuid="$(cryptsetup luksUUID "${d}")"
|
|
|
4ba90c |
- if ! printf '+%s' "${pt}" | ncat -U -u --send-only "${s}"; then
|
|
|
4ba90c |
+ if ! printf '%s' "${pt}" | @SYSTEMD_REPLY_PASS@ 1 "${s}"; then
|
|
|
4ba90c |
echo "Unable to unlock ${d} (UUID=${uuid}) with recovered passphrase" >&2
|
|
|
4ba90c |
continue
|
|
|
4ba90c |
fi
|
|
|
4ba90c |
diff --git a/src/luks/systemd/dracut/clevis/module-setup.sh.in b/src/luks/systemd/dracut/clevis/module-setup.sh.in
|
|
|
4ba90c |
index ebf969f..d46c6e2 100755
|
|
|
4ba90c |
--- a/src/luks/systemd/dracut/clevis/module-setup.sh.in
|
|
|
4ba90c |
+++ b/src/luks/systemd/dracut/clevis/module-setup.sh.in
|
|
|
4ba90c |
@@ -36,6 +36,7 @@ install() {
|
|
|
4ba90c |
|
|
|
4ba90c |
inst_multiple \
|
|
|
4ba90c |
/etc/services \
|
|
|
4ba90c |
+ @SYSTEMD_REPLY_PASS@ \
|
|
|
4ba90c |
@libexecdir@/clevis-luks-askpass \
|
|
|
4ba90c |
clevis-luks-common-functions \
|
|
|
4ba90c |
grep sed cut \
|
|
|
4ba90c |
@@ -45,8 +46,7 @@ install() {
|
|
|
4ba90c |
luksmeta \
|
|
|
4ba90c |
clevis \
|
|
|
4ba90c |
mktemp \
|
|
|
4ba90c |
- jose \
|
|
|
4ba90c |
- ncat
|
|
|
4ba90c |
+ jose
|
|
|
4ba90c |
|
|
|
4ba90c |
dracut_need_initqueue
|
|
|
4ba90c |
}
|
|
|
4ba90c |
diff --git a/src/luks/systemd/meson.build b/src/luks/systemd/meson.build
|
|
|
4ba90c |
index 369e7f7..e3b3d91 100644
|
|
|
4ba90c |
--- a/src/luks/systemd/meson.build
|
|
|
4ba90c |
+++ b/src/luks/systemd/meson.build
|
|
|
4ba90c |
@@ -1,6 +1,15 @@
|
|
|
4ba90c |
systemd = dependency('systemd', required: false)
|
|
|
4ba90c |
|
|
|
4ba90c |
-if systemd.found()
|
|
|
4ba90c |
+sd_reply_pass = find_program(
|
|
|
4ba90c |
+ join_paths(get_option('prefix'), get_option('libdir'), 'systemd', 'systemd-reply-password'),
|
|
|
4ba90c |
+ join_paths(get_option('prefix'), 'lib', 'systemd', 'systemd-reply-password'),
|
|
|
4ba90c |
+ join_paths('/', 'usr', get_option('libdir'), 'systemd', 'systemd-reply-password'),
|
|
|
4ba90c |
+ join_paths('/', 'usr', 'lib', 'systemd', 'systemd-reply-password'),
|
|
|
4ba90c |
+ required: false
|
|
|
4ba90c |
+)
|
|
|
4ba90c |
+
|
|
|
4ba90c |
+if systemd.found() and sd_reply_pass.found()
|
|
|
4ba90c |
+ data.set('SYSTEMD_REPLY_PASS', sd_reply_pass.path())
|
|
|
4ba90c |
subdir('dracut')
|
|
|
4ba90c |
|
|
|
4ba90c |
unitdir = systemd.get_pkgconfig_variable('systemdsystemunitdir')
|
|
|
4ba90c |
@@ -12,8 +21,14 @@ if systemd.found()
|
|
|
4ba90c |
configuration: data,
|
|
|
4ba90c |
)
|
|
|
4ba90c |
|
|
|
4ba90c |
+ configure_file(
|
|
|
4ba90c |
+ input: 'clevis-luks-askpass.in',
|
|
|
4ba90c |
+ output: 'clevis-luks-askpass',
|
|
|
4ba90c |
+ install_dir: libexecdir,
|
|
|
4ba90c |
+ configuration: data
|
|
|
4ba90c |
+ )
|
|
|
4ba90c |
+
|
|
|
4ba90c |
install_data('clevis-luks-askpass.path', install_dir: unitdir)
|
|
|
4ba90c |
- install_data('clevis-luks-askpass', install_dir: libexecdir)
|
|
|
4ba90c |
else
|
|
|
4ba90c |
warning('Will not install systemd support due to missing dependencies!')
|
|
|
4ba90c |
endif
|
|
|
4ba90c |
--
|
|
|
4ba90c |
2.33.1
|
|
|
4ba90c |
|