Blame SOURCES/0001-Adjust-pin-tang-test-to-account-for-newer-tang-witho.patch

95204d
From 27a27befed2257c2156ed8b94d679951b9b1a4d5 Mon Sep 17 00:00:00 2001
566fbd
From: Sergio Correia <scorreia@redhat.com>
95204d
Date: Wed, 13 May 2020 23:51:04 -0300
95204d
Subject: [PATCH 1/8] Adjust pin-tang test to account for newer tang without
566fbd
 tangd-update
566fbd
566fbd
---
95204d
 src/luks/tests/unbind-unbound-slot-luks2 |  1 +
95204d
 src/pins/tang/meson.build                |  8 +-------
95204d
 src/pins/tang/pin-tang                   | 11 ++++++++---
95204d
 3 files changed, 10 insertions(+), 10 deletions(-)
566fbd
95204d
diff --git a/src/luks/tests/unbind-unbound-slot-luks2 b/src/luks/tests/unbind-unbound-slot-luks2
95204d
index 6a2aca5..6d814ad 100755
95204d
--- a/src/luks/tests/unbind-unbound-slot-luks2
95204d
+++ b/src/luks/tests/unbind-unbound-slot-luks2
95204d
@@ -36,6 +36,7 @@ TMP="$(mktemp -d)"
95204d
 
95204d
 DEV="${TMP}/luks2-device"
95204d
 new_device "luks2" "${DEV}"
95204d
+SLT=2
95204d
 if clevis luks unbind -d "${DEV}" -s "${SLT}"; then
95204d
     error "${TEST}: Unbind is expected to fail for device ${DEV} and slot ${SLT}" >&2
95204d
 fi
566fbd
diff --git a/src/pins/tang/meson.build b/src/pins/tang/meson.build
95204d
index 74a3442..9b9a3db 100644
566fbd
--- a/src/pins/tang/meson.build
566fbd
+++ b/src/pins/tang/meson.build
95204d
@@ -9,12 +9,6 @@ kgen = find_program(
95204d
   '/usr/lib/x86_64-linux-gnu/tangd-keygen',
566fbd
   required: false
566fbd
 )
566fbd
-updt = find_program(
566fbd
-  join_paths(libexecdir, 'tangd-update'),
566fbd
-  '/usr/libexec/tangd-update',
95204d
-  '/usr/lib/x86_64-linux-gnu/tangd-update',
566fbd
-  required: false
566fbd
-)
566fbd
 tang = find_program(
566fbd
   join_paths(libexecdir, 'tangd'),
566fbd
   '/usr/libexec/tangd',
95204d
@@ -28,7 +22,7 @@ if curl.found()
566fbd
   bins += join_paths(meson.current_source_dir(), 'clevis-encrypt-tang')
566fbd
   mans += join_paths(meson.current_source_dir(), 'clevis-encrypt-tang.1')
566fbd
 
566fbd
-  if actv.found() and kgen.found() and updt.found() and tang.found()
566fbd
+  if actv.found() and kgen.found() and tang.found()
566fbd
     env = environment()
566fbd
     env.set('SD_ACTIVATE', actv.path())
566fbd
     env.append('PATH',
566fbd
diff --git a/src/pins/tang/pin-tang b/src/pins/tang/pin-tang
95204d
index 1720d3d..8190f3d 100755
566fbd
--- a/src/pins/tang/pin-tang
566fbd
+++ b/src/pins/tang/pin-tang
95204d
@@ -31,18 +31,23 @@ mkdir -p "$TMP"/db
95204d
 mkdir -p "$TMP"/cache
566fbd
 
566fbd
 # Generate the server keys
95204d
+KEYS="$TMP"/db
95204d
 tangd-keygen "$TMP"/db sig exc
95204d
-tangd-update "$TMP"/db "$TMP"/cache
566fbd
+if which tangd-update; then
95204d
+    tangd-update "$TMP"/db "$TMP"/cache
566fbd
+    KEYS=$TMP/cache
566fbd
+fi
566fbd
 
566fbd
 # Start the server
95204d
 port="$(shuf -i 1024-65536 -n 1)"
95204d
-$SD_ACTIVATE --inetd -l 127.0.0.1:$port -a tangd "$TMP"/cache &
95204d
+$SD_ACTIVATE --inetd -l 127.0.0.1:$port -a tangd "$KEYS" &
95204d
 PID=$!
566fbd
 sleep 0.25
566fbd
 
95204d
 thp="$(jose jwk thp -i "$TMP/db/sig.jwk")"
566fbd
-adv="$TMP/cache/default.jws"
566fbd
 url="http://localhost:${port}"
566fbd
+adv="$TMP/adv"
566fbd
+curl "$url/adv" -o $adv
566fbd
 
95204d
 cfg="$(printf '{"url":"%s","adv":"%s"}' "$url" "$adv")"
95204d
 enc="$(echo -n "hi" | clevis encrypt tang "$cfg")"
566fbd
-- 
95204d
2.18.4
566fbd