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