From 39df85d8cdbf602a22e497333bd15712bfa4ad75 Mon Sep 17 00:00:00 2001 From: Florian Festi Date: Wed, 20 Nov 2024 14:18:43 +0100 Subject: [PATCH] Add test case for ima file signatures Resolves: #3237 --- tests/data/keys/privkey.pem | 5 +++++ tests/rpmsigdig.at | 20 ++++++++++++++++++++ 2 files changed, 25 insertions(+) create mode 100644 tests/data/keys/privkey.pem diff --git a/tests/data/keys/privkey.pem b/tests/data/keys/privkey.pem new file mode 100644 index 0000000000..a450877447 --- /dev/null +++ b/tests/data/keys/privkey.pem @@ -0,0 +1,5 @@ +-----BEGIN EC PRIVATE KEY----- +MHQCAQEEIAqhMWlmwcHwa2pXlyxUfPUvKMdrHHxGAkKz0EfHrlZpoAcGBSuBBAAK +oUQDQgAEhJIpSysqJlsr0+nAwQDYaqk4hkLmU+2Pje5jCpI6QfakJD+bVrXqF+5Z +xbwEh+e+lrhDLfj9+jJTOda4WD83Ng== +-----END EC PRIVATE KEY----- diff --git a/tests/rpmsigdig.at b/tests/rpmsigdig.at index 7ce324af5a..3d8f5e153e 100644 --- a/tests/rpmsigdig.at +++ b/tests/rpmsigdig.at @@ -1624,3 +1624,23 @@ POST-IMPORT gpgconf --kill gpg-agent RPMTEST_CLEANUP + +AT_SETUP([ima]) +AT_KEYWORDS([rpmsign file signature]) + +RPMDB_INIT +cp "${RPMTEST}"/data/RPMS/hello-2.0-1.x86_64.rpm "${RPMTEST}"/tmp/ +gpg2 --import ${RPMTEST}/data/keys/rpm.org-rsa-2048-test.secret +runroot rpmsign --key-id 4344591E1964C5FC --addsign --signfiles --fskpath=/data/keys/privkey.pem /tmp/hello-2.0-1.x86_64.rpm + +RPMTEST_CHECK([ +runroot rpm -qp --qf "[%{filenames} %{filesignatures}\n]" /tmp/hello-2.0-1.x86_64.rpm | cut -c -20 +runroot rpm -qp --qf "[%{filenames} %{filesignatures}\n]" /data/RPMS/imatest-1.0-1.fc34.noarch.rpm +], +[0], +[/usr/bin/hello 03020 +/usr/share/example1 030204a598255400483046022100e5117bdafa73baaeb1f1dc46ecaa46981a62d417745a33532572b63dc6d95d16022100c789107ac5b91e2d915e1df3c7b78414f6b3f50899d44c1de381d0e938dfc82b +], +[ignore]) + +RPMTEST_CLEANUP