Save full security.ima attribute to a file
authorVivek Goyal <vgoyal@redhat.com>
Fri, 12 Jul 2013 18:52:12 +0000 (14:52 -0400)
committerDmitry Kasatkin <d.kasatkin@samsung.com>
Fri, 9 Aug 2013 12:57:26 +0000 (15:57 +0300)
commit59ef0a0b99d87437b92b1185e7b845d2ad88c6a4
tree6a93c5d27f0f91e63fbd54621ede3a4159f83e16
parentab18c60ec1160d6460083818e1e5390f33766e2a
Save full security.ima attribute to a file

Right now if -f option is passed in, we only save the actual signature to
a file and not the full security.ima attribute.

I think it makes more sense to save full security.ima attribute so that
it can act as detached signatures and one can install signature later.
That is signing can take place on build server and detached signatures
can be generated and these signatures can be installed later on target.

One can use following steps.

evmctl ima_sign -f -x -a sha256 /tmp/data.txt

hexdump -v -e '1/1 "%02x"' /tmp/data.txt.sig > /tmp/data.txt.sig.hex
printf "# file: /tmp/data.txt\nsecurity.ima=0x" | cat - /tmp/data.txt.sig.hex | setfattr --restore -

evmctl ima_verify /tmp/data.txt

Signed-off-by: Vivek Goyal <vgoyal@redhat.com>
src/evmctl.c