Skip to content

Commit

Permalink
Add test case for ima file signatures
Browse files Browse the repository at this point in the history
  • Loading branch information
ffesti committed Nov 20, 2024
1 parent 5d3a6c4 commit 39df85d
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
5 changes: 5 additions & 0 deletions tests/data/keys/privkey.pem
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
-----BEGIN EC PRIVATE KEY-----
MHQCAQEEIAqhMWlmwcHwa2pXlyxUfPUvKMdrHHxGAkKz0EfHrlZpoAcGBSuBBAAK
oUQDQgAEhJIpSysqJlsr0+nAwQDYaqk4hkLmU+2Pje5jCpI6QfakJD+bVrXqF+5Z
xbwEh+e+lrhDLfj9+jJTOda4WD83Ng==
-----END EC PRIVATE KEY-----
20 changes: 20 additions & 0 deletions tests/rpmsigdig.at
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 39df85d

Please sign in to comment.