evmctl - IMA/EVM control tool
[platform/upstream/ima-evm-utils.git] / README
1
2 1. Generate private key
3
4 openssl genrsa -out privkey_evm.pem 1024
5
6 2. Generate public key
7
8 openssl rsa -pubout -in privkey_evm.pem -out pubkey_evm.pem
9
10 3. Copy public (+private if to sign on device) key to the device/qemu /etc/keys
11
12 scp pubkey_evm.pem mad:/etc/keys
13
14 4. Load keys and enable EVM
15
16 evm_enable.sh
17
18 This should be done at early phase, before mounting root filesystem.
19
20 5. Sign EVM and use hash value for IMA - common case
21
22 evmctl sign --imahash test.txt
23
24 6. Sign IMA and EVM - for immutable files and modules
25
26 evmctl sign --imasig test.txt
27
28 7. Sign whole filesystem
29
30 evm_sign_all.sh
31 or
32 find / \( -fstype rootfs -o -fstype ext3 -o -fstype ext4 \) ! -path "/lib/modules/*" -type f -uid 0 -exec evmctl sign --imahash '{}' \;
33 find /lib/modules ! -name "*.ko" -type f -uid 0 -exec evmctl sign --imahash '{}' \;
34 # security.ima needs to have signature for modules
35 find /lib/modules -name "*.ko" -type f -uid 0 -exec evmctl sign --imasig '{}' \;
36
37 8. Label filesystem in fix mode...
38
39 ima_fix_dir.sh <dir>
40