← Documents Documentation/ABI/testing/evm GitHub 원문 ↗

Linux 6.18.37 · ABI / testing

EVM securityfs policy와 protected xattrs ABI

EVM이 security xattrs를 HMAC-SHA1 또는 digital signature로 보호하는 방식, additive initialization flags와 policy lock, key-load state transition, runtime evm_xattrs 확장·잠금을 설명합니다.

Source pathDocumentation/ABI/testing/evm
Source versionLinux v6.18.37
TranslationDUJINLABS 전문 번역 + 해설

요약·해설과 원문, 전문 번역을 서로 분리했습니다. API 이름, symbol, source path는 원문 표기를 사용합니다.

1. 요약·해설

원문의 핵심 논리와 kernel programming 관점의 보충 설명입니다. 아래의 전문 번역과는 별도로 작성했습니다.

security.evm classes와 enable bits

evm:1-30

EVM은 locally generated HMAC-SHA1 또는 local·remote asymmetric digital signature를 security.evm에 저장합니다. Bit 0은 HMAC, bit 1은 signature, bit 2는 deprecated metadata modification, bit 31은 policy 변경 잠금입니다.

Additive writes와 HMAC key transition

evm:32-82

Write 값은 기존 initialization flags에 더해집니다. HMAC key load를 signal하면 metadata modification bit가 지워지며, 이는 해당 기능을 끄는 유일한 방법입니다.

Early boot key loading

evm:84-95

Key load signal 전에는 security.evm을 생성·검증할 수 없어 INTEGRITY_UNKNOWN을 반환합니다. Trusted boot에서 측정된 initramfs 단계의 조기 load가 권장됩니다.

Protected xattr list 확장과 lock

evm:97-108

evm_xattrs는 signature 계산·검증 대상 xattr를 보여 주고 runtime 추가를 허용합니다. 추가 xattr 기반 signature는 boot에도 같은 구성이 필요하며 period 하나를 쓰면 목록 변경을 잠급니다.

2. 영어 원문 전체

번역 기준이 된 Linux v6.18.37 원문입니다. 줄 번호는 이 버전의 파일 좌표입니다.

원문 전체 펼치기
1 What: /sys/kernel/security/evm
2 What: /sys/kernel/security/*/evm
3 Date: March 2011
4 Contact: Mimi Zohar <[email protected]>
5 Description:
6 EVM protects a file's security extended attributes(xattrs)
7 against integrity attacks. The initial method maintains an
8 HMAC-sha1 value across the extended attributes, storing the
9 value as the extended attribute 'security.evm'.
10
11 EVM supports two classes of security.evm. The first is
12 an HMAC-sha1 generated locally with a
13 trusted/encrypted key stored in the Kernel Key
14 Retention System. The second is a digital signature
15 generated either locally or remotely using an
16 asymmetric key. These keys are loaded onto root's
17 keyring using keyctl, and EVM is then enabled by
18 echoing a value to <securityfs>/evm made up of the
19 following bits:
20
21 === ==================================================
22 Bit Effect
23 === ==================================================
24 0 Enable HMAC validation and creation
25 1 Enable digital signature validation
26 2 Permit modification of EVM-protected metadata at
27 runtime. Not supported if HMAC validation and
28 creation is enabled (deprecated).
29 31 Disable further runtime modification of EVM policy
30 === ==================================================
31
32 For example::
33
34 echo 1 ><securityfs>/evm
35
36 will enable HMAC validation and creation
37
38 ::
39
40 echo 0x80000003 ><securityfs>/evm
41
42 will enable HMAC and digital signature validation and
43 HMAC creation and disable all further modification of policy.
44
45 ::
46
47 echo 0x80000006 ><securityfs>/evm
48
49 will enable digital signature validation, permit
50 modification of EVM-protected metadata and
51 disable all further modification of policy. This option is now
52 deprecated in favor of::
53
54 echo 0x80000002 ><securityfs>/evm
55
56 as the outstanding issues that prevent the usage of EVM portable
57 signatures have been solved.
58
59 Echoing a value is additive, the new value is added to the
60 existing initialization flags.
61
62 For example, after::
63
64 echo 2 ><securityfs>/evm
65
66 another echo can be performed::
67
68 echo 1 ><securityfs>/evm
69
70 and the resulting value will be 3.
71
72 Note that once an HMAC key has been loaded, it will no longer
73 be possible to enable metadata modification. Signaling that an
74 HMAC key has been loaded will clear the corresponding flag.
75 For example, if the current value is 6 (2 and 4 set)::
76
77 echo 1 ><securityfs>/evm
78
79 will set the new value to 3 (4 cleared).
80
81 Loading an HMAC key is the only way to disable metadata
82 modification.
83
84 Until key loading has been signaled EVM can not create
85 or validate the 'security.evm' xattr, but returns
86 INTEGRITY_UNKNOWN. Loading keys and signaling EVM
87 should be done as early as possible. Normally this is
88 done in the initramfs, which has already been measured
89 as part of the trusted boot. For more information on
90 creating and loading existing trusted/encrypted keys,
91 refer to:
92 Documentation/security/keys/trusted-encrypted.rst. Both
93 dracut (via 97masterkey and 98integrity) and systemd (via
94 core/ima-setup) have support for loading keys at boot
95 time.
96
97 What: /sys/kernel/security/*/evm/evm_xattrs
98 Date: April 2018
99 Contact: Matthew Garrett <[email protected]>
100 Description:
101 Shows the set of extended attributes used to calculate or
102 validate the EVM signature, and allows additional attributes
103 to be added at runtime. Any signatures generated after
104 additional attributes are added (and on files possessing those
105 additional attributes) will only be valid if the same
106 additional attributes are configured on system boot. Writing
107 a single period (.) will lock the xattr list from any further
108 modification.
109

3. 한국어 전문 번역

영어 원문의 문단 순서와 의미를 유지한 전체 번역입니다. 코드, 함수명, symbol과 URL은 원문 표기를 유지합니다.

EVM integrity protection과 policy bits

1-30
항목내용
What/sys/kernel/security/evm 및 /sys/kernel/security/*/evm
Date2011년 3월
ContactMimi Zohar <[email protected]>

EVM은 file의 security extended attributes(xattrs)를 integrity attack으로부터 보호합니다. 초기 방식은 extended attributes 전체에 대한 HMAC-sha1 값을 유지하고 그 값을 security.evm extended attribute에 저장합니다.

EVM은 두 종류의 security.evm을 지원합니다. 첫째는 Kernel Key Retention System에 저장된 trusted/encrypted key로 local에서 생성한 HMAC-sha1입니다. 둘째는 asymmetric key로 local 또는 remote에서 생성한 digital signature입니다. 이 key들은 keyctl로 root의 keyring에 load합니다. 그런 다음 아래 bit로 구성한 값을 <securityfs>/evm에 echo해 EVM을 활성화합니다.

Bit효과
0HMAC validation과 creation 활성화
1Digital signature validation 활성화
2Runtime에 EVM-protected metadata 수정을 허용합니다. HMAC validation과 creation이 활성화된 경우에는 지원하지 않습니다. Deprecated입니다.
31이후의 EVM policy runtime 변경을 비활성화

Initialization flag 예제와 state transition

32-82
echo 1 ><securityfs>/evm

HMAC validation과 creation을 활성화합니다.

echo 0x80000003 ><securityfs>/evm

HMAC과 digital signature validation, HMAC creation을 활성화하고 이후의 모든 policy 변경을 비활성화합니다.

echo 0x80000006 ><securityfs>/evm

Digital signature validation을 활성화하고 EVM-protected metadata 수정을 허용하며 이후의 모든 policy 변경을 비활성화합니다. EVM portable signature 사용을 막던 남은 문제가 해결되었으므로 이 option은 이제 다음 명령을 선호해 deprecated되었습니다.

echo 0x80000002 ><securityfs>/evm

값을 echo하는 동작은 additive입니다. 새 값은 기존 initialization flags에 추가됩니다. 예를 들어 다음 두 write 뒤의 결과 값은 3입니다.

echo 2 ><securityfs>/evm
echo 1 ><securityfs>/evm

HMAC key가 load되고 나면 metadata modification을 더는 활성화할 수 없습니다. HMAC key가 load되었다는 signal은 해당 flag를 지웁니다. 예를 들어 현재 값이 6, 즉 값 2와 4가 set된 경우 다음 write는 새 값을 3으로 만들며 값 4를 지웁니다.

echo 1 ><securityfs>/evm

HMAC key를 load하는 것이 metadata modification을 비활성화하는 유일한 방법입니다.

Key load signal과 boot ordering

84-95

Key loading이 signal되기 전까지 EVM은 security.evm xattr를 생성하거나 검증할 수 없고 INTEGRITY_UNKNOWN을 반환합니다. Key를 load하고 EVM에 signal하는 작업은 가능한 한 이르게 해야 합니다. 일반적으로 trusted boot의 일부로 이미 측정된 initramfs에서 수행합니다.

기존 trusted/encrypted key를 만들고 load하는 자세한 방법은 Documentation/security/keys/trusted-encrypted.rst를 참조하십시오. Dracut은 97masterkey와 98integrity를 통해, systemd는 core/ima-setup을 통해 boot time key loading을 지원합니다.

EVM signature 대상 xattr 목록

97-108
항목내용
What/sys/kernel/security/*/evm/evm_xattrs
Date2018년 4월
ContactMatthew Garrett <[email protected]>
DescriptionEVM signature를 계산하거나 검증할 때 사용하는 extended attribute 집합을 보여 주며 runtime에 attribute를 더 추가할 수 있게 합니다.

Additional attribute를 추가한 뒤 생성한 signature는 해당 additional attribute를 가진 file에서, system boot 때도 똑같은 additional attribute가 구성되어 있어야만 유효합니다. Period 하나, 즉 .을 쓰면 xattr list를 이후의 모든 변경으로부터 잠급니다.

EVM key·policy·xattr state
Trusted or encrypted keyLocal HMAC-SHA1Bit 0 validation and creationsecurity.evm
Asymmetric keyLocal or remote digital signatureBit 1 validationsecurity.evm
Before key-load signalCannot create or validateINTEGRITY_UNKNOWN
HMAC key load signalClear metadata-modification value 4Modification cannot be re-enabled
Bit 31Lock further runtime policy modification
Add runtime evm_xattrsSame attributes required at boot for signature validityWrite periodLock xattr list

Key 종류와 enable bit가 security.evm 생성·검증 방식을 정하고 policy·xattr lock은 이후 변경을 단방향으로 막는다.