요약·해설과 원문, 전문 번역을 서로 분리했습니다. API 이름, symbol, source path는 원문 표기를 사용합니다.
1. 요약·해설
원문의 핵심 논리와 kernel programming 관점의 보충 설명입니다. 아래의 전문 번역과는 별도로 작성했습니다.
Additive writes와 HMAC key transition
evm:32-82Write 값은 기존 initialization flags에 더해집니다. HMAC key load를 signal하면 metadata modification bit가 지워지며, 이는 해당 기능을 끄는 유일한 방법입니다.
Early boot key loading
evm:84-95Key load signal 전에는 security.evm을 생성·검증할 수 없어 INTEGRITY_UNKNOWN을 반환합니다. Trusted boot에서 측정된 initramfs 단계의 조기 load가 권장됩니다.
Protected xattr list 확장과 lock
evm:97-108evm_xattrs는 signature 계산·검증 대상 xattr를 보여 주고 runtime 추가를 허용합니다. 추가 xattr 기반 signature는 boot에도 같은 구성이 필요하며 period 하나를 쓰면 목록 변경을 잠급니다.
2. 영어 원문 전체
번역 기준이 된 Linux v6.18.37 원문입니다. 줄 번호는 이 버전의 파일 좌표입니다.
원문 전체 펼치기
What: /sys/kernel/security/evm
What: /sys/kernel/security/*/evm
Date: March 2011
Contact: Mimi Zohar <zohar@us.ibm.com>
Description:
EVM protects a file's security extended attributes(xattrs)
against integrity attacks. The initial method maintains an
HMAC-sha1 value across the extended attributes, storing the
value as the extended attribute 'security.evm'.
EVM supports two classes of security.evm. The first is
an HMAC-sha1 generated locally with a
trusted/encrypted key stored in the Kernel Key
Retention System. The second is a digital signature
generated either locally or remotely using an
asymmetric key. These keys are loaded onto root's
keyring using keyctl, and EVM is then enabled by
echoing a value to <securityfs>/evm made up of the
following bits:
=== ==================================================
Bit Effect
=== ==================================================
0 Enable HMAC validation and creation
1 Enable digital signature validation
2 Permit modification of EVM-protected metadata at
runtime. Not supported if HMAC validation and
creation is enabled (deprecated).
31 Disable further runtime modification of EVM policy
=== ==================================================
For example::
echo 1 ><securityfs>/evm
will enable HMAC validation and creation
::
echo 0x80000003 ><securityfs>/evm
will enable HMAC and digital signature validation and
HMAC creation and disable all further modification of policy.
::
echo 0x80000006 ><securityfs>/evm
will enable digital signature validation, permit
modification of EVM-protected metadata and
disable all further modification of policy. This option is now
deprecated in favor of::
echo 0x80000002 ><securityfs>/evm
as the outstanding issues that prevent the usage of EVM portable
signatures have been solved.
Echoing a value is additive, the new value is added to the
existing initialization flags.
For example, after::
echo 2 ><securityfs>/evm
another echo can be performed::
echo 1 ><securityfs>/evm
and the resulting value will be 3.
Note that once an HMAC key has been loaded, it will no longer
be possible to enable metadata modification. Signaling that an
HMAC key has been loaded will clear the corresponding flag.
For example, if the current value is 6 (2 and 4 set)::
echo 1 ><securityfs>/evm
will set the new value to 3 (4 cleared).
Loading an HMAC key is the only way to disable metadata
modification.
Until key loading has been signaled EVM can not create
or validate the 'security.evm' xattr, but returns
INTEGRITY_UNKNOWN. Loading keys and signaling EVM
should be done as early as possible. Normally this is
done in the initramfs, which has already been measured
as part of the trusted boot. For more information on
creating and loading existing trusted/encrypted keys,
refer to:
Documentation/security/keys/trusted-encrypted.rst. Both
dracut (via 97masterkey and 98integrity) and systemd (via
core/ima-setup) have support for loading keys at boot
time.
What: /sys/kernel/security/*/evm/evm_xattrs
Date: April 2018
Contact: Matthew Garrett <mjg59@google.com>
Description:
Shows the set of extended attributes used to calculate or
validate the EVM signature, and allows additional attributes
to be added at runtime. Any signatures generated after
additional attributes are added (and on files possessing those
additional attributes) will only be valid if the same
additional attributes are configured on system boot. Writing
a single period (.) will lock the xattr list from any further
modification.
3. 한국어 전문 번역
영어 원문의 문단 순서와 의미를 유지한 전체 번역입니다. 코드, 함수명, symbol과 URL은 원문 표기를 유지합니다.
EVM integrity protection과 policy bits
1-30| 항목 | 내용 |
|---|---|
| What | /sys/kernel/security/evm 및 /sys/kernel/security/*/evm |
| Date | 2011년 3월 |
| Contact | Mimi Zohar <zohar@us.ibm.com> |
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 | 효과 |
|---|---|
| 0 | HMAC validation과 creation 활성화 |
| 1 | Digital signature validation 활성화 |
| 2 | Runtime에 EVM-protected metadata 수정을 허용합니다. HMAC validation과 creation이 활성화된 경우에는 지원하지 않습니다. Deprecated입니다. |
| 31 | 이후의 EVM policy runtime 변경을 비활성화 |
Initialization flag 예제와 state transition
32-82echo 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-95Key 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 |
| Date | 2018년 4월 |
| Contact | Matthew Garrett <mjg59@google.com> |
| Description | EVM signature를 계산하거나 검증할 때 사용하는 extended attribute 집합을 보여 주며 runtime에 attribute를 더 추가할 수 있게 합니다. |
Additional attribute를 추가한 뒤 생성한 signature는 해당 additional attribute를 가진 file에서, system boot 때도 똑같은 additional attribute가 구성되어 있어야만 유효합니다. Period 하나, 즉 .을 쓰면 xattr list를 이후의 모든 변경으로부터 잠급니다.
Key 종류와 enable bit가 security.evm 생성·검증 방식을 정하고 policy·xattr lock은 이후 변경을 단방향으로 막는다.
security.evm classes와 enable bits
evm:1-30EVM은 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 변경 잠금입니다.