Skip to contentSkip to conversation

tests: add fsverity measurement test

RFC PATCH New Mimi Zohar 1 participant 1 message Nov 14, 2022 Keys-trusted

lore
Share & tools
lore

Mimi Zohar

author maintainer
#0 lore raw

RFC PATCH 1/1 tests: add fsverity measurement test

Test IMA support for including fs-verity enabled file measurements in the IMA measurement list based on the ima-ngv2 and ima-sigv2 records.

---
Comment:
- The fsverity.test executes locally, but fails to loopback mount a file in ci/travis.
- Limit running the fsverity.test to Altlinux where it is installed and Fedora where it is compiled.

 build.sh                  |   1 +
 ci/alpine.sh              |   2 +
 ci/alt.sh                 |   4 +-
 ci/debian.sh              |   2 +
 ci/fedora.sh              |   8 +-
 ci/tumbleweed.sh          |   2 +
 tests/Makefile.am         |   2 +-
 tests/fsverity.test       | 303 ++++++++++++++++++++++++++++++++++++++
 tests/install-fsverity.sh |   7 +
 9 files changed, 328 insertions(+), 3 deletions(-)
 create mode 100755 tests/fsverity.test
 create mode 100755 tests/install-fsverity.sh
build.sh +1 -0
index 0c2fdd9e995d..02dc15aeb369 100755
@@ -98,6 +98,7 @@ if [ $ret -eq 0 ]; then
 		   grep "skipped" tests/sign_verify.log | wc -l
 	fi
 	tail -20 tests/boot_aggregate.log
+	tail -10 tests/fsverity.log
 	exit 0
 fi
 
ci/alpine.sh +2 -0
index 0e4ba0da6beb..6b17942a43fd 100755
@@ -30,6 +30,7 @@ apk add \
 	diffutils \
 	docbook-xml \
 	docbook-xsl \
+	e2fsprogs-extra \
 	keyutils-dev \
 	libtool \
 	libxslt \
@@ -41,6 +42,7 @@ apk add \
 	pkgconfig \
 	procps \
 	sudo \
+	util-linux \
 	wget \
 	which \
 	xxd
ci/alt.sh +3 -1
index 65389bef4487..36ff6579267c 100755
@@ -11,7 +11,8 @@ apt-get install -y \
 		$TSS \
 		asciidoc \
 		attr \
-		docbook-style-xsl \
+		e2fsprogs \
+		fsverity-utils-devel \
 		gnutls-utils \
 		libattr-devel \
 		libkeyutils-devel \
@@ -21,6 +22,7 @@ apt-get install -y \
 		openssl-gost-engine \
 		rpm-build \
 		softhsm \
+		util-linux \
 		wget \
 		xsltproc \
 		xxd \
ci/debian.sh +2 -0
index 005b1f647ed8..431203aabb48 100755
@@ -40,6 +40,7 @@ $apt \
 	debianutils \
 	docbook-xml \
 	docbook-xsl \
+	e2fsprogs \
 	gzip \
 	libattr1-dev$ARCH \
 	libkeyutils-dev$ARCH \
@@ -50,6 +51,7 @@ $apt \
 	pkg-config \
 	procps \
 	sudo \
+	util-linux \
 	wget \
 	xsltproc
 
ci/fedora.sh +7 -1
index 09936070ea93..2272bbc57fae 100755
@@ -25,9 +25,12 @@ yum -y install \
 	automake \
 	diffutils \
 	docbook-xsl \
+	e2fsprogs \
+	git-core \
 	gnutls-utils \
 	gzip \
 	keyutils-libs-devel \
+	kmod \
 	libattr-devel \
 	libtool \
 	libxslt \
@@ -38,6 +41,7 @@ yum -y install \
 	pkg-config \
 	procps \
 	sudo \
+	util-linux \
 	vim-common \
 	wget \
 	which
@@ -49,4 +53,6 @@ yum -y install swtpm || true
 if [ -f /etc/centos-release ]; then
 	yum -y install epel-release
 fi
-yum -y install softhsm || true
\ No newline at end of file
+yum -y install softhsm || true
+
+./tests/install-fsverity.sh
ci/tumbleweed.sh +2 -0
index 4e3da0c6bb75..6f70b0fcc768 100755
@@ -26,6 +26,7 @@ zypper --non-interactive install --force-resolution --no-recommends \
 	diffutils \
 	docbook_5 \
 	docbook5-xsl-stylesheets \
+	e2fsprogs \
 	gzip \
 	ibmswtpm2 \
 	keyutils-devel \
@@ -37,6 +38,7 @@ zypper --non-interactive install --force-resolution --no-recommends \
 	pkg-config \
 	procps \
 	sudo \
+	util-linux \
 	vim \
 	wget \
 	which \
tests/Makefile.am +1 -1
index ff928e177406..feea235da873 100644
@@ -1,7 +1,7 @@
 check_SCRIPTS =
 TESTS = $(check_SCRIPTS)
 
-check_SCRIPTS += ima_hash.test sign_verify.test boot_aggregate.test
+check_SCRIPTS += ima_hash.test sign_verify.test boot_aggregate.test fsverity.test
 
 clean-local:
 	-rm -f *.txt *.out *.sig *.sig2
tests/fsverity.test new file +303 -0

303 lines not on this page · raw message

tests/install-fsverity.sh new file +7 -0
new file mode 100755
index 000000000000..418fc42f472b
@@ -0,0 +1,7 @@
+#!/bin/sh
+
+git clone https://git.kernel.org/pub/scm/linux/kernel/git/ebiggers/fsverity-utils.git
+cd fsverity-utils
+CC=gcc make -j$(nproc) && sudo make install
+cd ..
+rm -rf fsverity-utils
Signature · 1 line
2.31.1