From 372711c823223cae677ea19701648dc28f8874f1 Mon Sep 17 00:00:00 2001 From: kn Date: Wed, 30 Aug 2023 17:21:40 +0000 Subject: [PATCH] exercise [-p passfile] (this is not a keydisk) --- regress/sbin/bioctl/Makefile | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/regress/sbin/bioctl/Makefile b/regress/sbin/bioctl/Makefile index 6bb57229799..81b726d92e4 100644 --- a/regress/sbin/bioctl/Makefile +++ b/regress/sbin/bioctl/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.7 2023/08/30 16:45:57 kn Exp $ +# $OpenBSD: Makefile,v 1.8 2023/08/30 17:21:40 kn Exp $ BIOCTL ?= /sbin/bioctl @@ -6,21 +6,27 @@ CHUNKFILE = disk.img CHUNKDEVFILE = chunk.txt VOLDEVFILE = vol.txt ROUNDSFILE = rounds.txt +PASSFILE = passphrase.txt OLDPW = oldsecret NEWPW = securenew NROUNDS ?= 17 -REGRESS_SETUP_ONCE = create-chunk +REGRESS_SETUP_ONCE = create-chunk create-passfile create-chunk: dd if=/dev/zero of=${CHUNKFILE} bs=512k count=0 seek=1 status=none ${SUDO} vnconfig -- ${CHUNKFILE} 1>${CHUNKDEVFILE} echo 'RAID *' | ${SUDO} disklabel -wAT- -- "$$(<${CHUNKDEVFILE})" +create-passfile: + ${SUDO} install -o root -m u=rw,go= /dev/null ${PASSFILE} + printf '%s\n' '${OLDPW}' | ${SUDO} tee ${PASSFILE} 1>/dev/null + SUCCESS_TESTS = scripted-create-volume \ scripted-recreate-volume \ + reopen-volume-with-passfile \ scripted-change-passphrase \ verify-increased-rounds REGRESS_TARGETS = ${SUCCESS_TESTS} @@ -36,6 +42,10 @@ scripted-recreate-volume: detach-volume ${SUDO} ${BIOCTL} -s -Cforce -r${NROUNDS} -cC -l"$$(<${CHUNKDEVFILE})a" -- softraid0 | \ grep -o 'sd[0-9]*$$' -- 1>${VOLDEVFILE} +reopen-volume-with-passfile: detach-volume create-passfile + ${SUDO} ${BIOCTL} -p${PASSFILE} -cC -l"$$(<${CHUNKDEVFILE})a" -- softraid0 | \ + grep -o 'sd[0-9]*$$' -- 1>${VOLDEVFILE} + scripted-change-passphrase: printf '%s\n%s\n' '${OLDPW}' '${NEWPW}' | \ ${SUDO} ${BIOCTL} -s -P -v -- "$$(<${VOLDEVFILE})" | \ -- 2.20.1