Raspberry Pi 上的 IMA 测量中只有“boot_aggregate”

Raspberry Pi 上的 IMA 测量中只有“boot_aggregate”

我正在尝试在 Raspberry Pi 3B+ 上使用完整性测量架构 (IMA)。

我使用以下选项编译了内核(使用以下配置menuconfig

CONFIG_IMA=y
CONFIG_IMA_MEASURE_PCR_IDX=10
# CONFIG_IMA_TEMPLATE is not set
CONFIG_IMA_NG_TEMPLATE=y
# CONFIG_IMA_SIG_TEMPLATE is not set
CONFIG_IMA_DEFAULT_TEMPLATE="ima-ng"
# CONFIG_IMA_DEFAULT_HASH_SHA1 is not set
CONFIG_IMA_DEFAULT_HASH_SHA512=y
CONFIG_IMA_DEFAULT_HASH="sha512"
# CONFIG_IMA_WRITE_POLICY is not set
CONFIG_IMA_READ_POLICY=y
# CONFIG_IMA_APPRAISE is not set

CONFIG_INTEGRITY=y
# CONFIG_INTEGRITY_SIGNATURE is not set
CONFIG_INTEGRITY_AUDIT=y

ima_policy通过/boot/cmdline.txt如下设置进行配置:

console=serial0,115200 console=tty1 root=PARTUUID=8e9714d8-02 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait ima_policy=tcb ima_policy=appraise_tcb

Raspberry 正常启动,我可以访问 IMA sysfs 文件夹。

我获得了这个/sysfs/kernel/security/ima/policy文件。

dont_measure fsmagic=0x9fa0 
dont_measure fsmagic=0x62656572 
dont_measure fsmagic=0x64626720 
dont_measure fsmagic=0x1021994 
dont_measure fsmagic=0x1cd1 
dont_measure fsmagic=0x42494e4d 
dont_measure fsmagic=0x73636673 
dont_measure fsmagic=0xf97cff8c 
dont_measure fsmagic=0x43415d53 
dont_measure fsmagic=0x27e0eb 
dont_measure fsmagic=0x63677270 
dont_measure fsmagic=0x6e736673 
dont_measure fsmagic=0xde5e81e4 
measure func=MMAP_CHECK mask=MAY_EXEC 
measure func=BPRM_CHECK mask=MAY_EXEC 
measure func=FILE_CHECK mask=^MAY_READ euid=0 
measure func=FILE_CHECK mask=^MAY_READ uid=0 
measure func=MODULE_CHECK 
measure func=FIRMWARE_CHECK 
measure func=POLICY_CHECK 
dont_appraise fsmagic=0x9fa0 
dont_appraise fsmagic=0x62656572 
dont_appraise fsmagic=0x64626720 
dont_appraise fsmagic=0x1021994 
dont_appraise fsmagic=0x858458f6 
dont_appraise fsmagic=0x1cd1 
dont_appraise fsmagic=0x42494e4d 
dont_appraise fsmagic=0x73636673 
dont_appraise fsmagic=0xf97cff8c 
dont_appraise fsmagic=0x43415d53 
dont_appraise fsmagic=0x6e736673 
dont_appraise fsmagic=0xde5e81e4 
dont_appraise fsmagic=0x27e0eb 
dont_appraise fsmagic=0x63677270 
appraise fowner=0 

我也/sysfs/kernel/security/ima/ascii_runtime_measurements仅用一行就获得了这个。

10 45e7e585a82d311e1ee226b4256604c341dbc6b9 ima-ng sha512:00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 boot_aggregate

我的问题是我的 Raspberry Pi 似乎无法测量任何文件,而我希望有一个ascii_runtime_measurements包含许多测量值的文件。

有人知道我做错了什么吗?

感谢您的帮助。

答案1

可能是内核问题。您可以尝试在 iinit.c 中将其更改为这个。对我来说有效。祝你好运!更新的部分是以下第一个和原始部分。<

 static void init_once(void *foo)
 {
    struct integrity_iint_cache *iint = foo;
 
    memset(iint, 0, sizeof(*iint));
    iint->ima_file_status = INTEGRITY_UNKNOWN;
    iint->ima_mmap_status = INTEGRITY_UNKNOWN;
    iint->ima_bprm_status = INTEGRITY_UNKNOWN;
    iint->ima_read_status = INTEGRITY_UNKNOWN;
    iint->ima_creds_status = INTEGRITY_UNKNOWN;
    iint->evm_status = INTEGRITY_UNKNOWN;
    mutex_init(&iint->mutex);
 }
 
 
    if (!iint_cache)
    {
        iint_cache =
        kmem_cache_create("iint_cache", sizeof(struct integrity_iint_cache),
                  0, SLAB_PANIC, init_once);
    }
 
 



static void init_once(void *foo)
 {
    struct integrity_iint_cache *iint = foo;
 
    memset(iint, 0, sizeof(*iint));
    iint->ima_file_status = INTEGRITY_UNKNOWN;
    iint->ima_mmap_status = INTEGRITY_UNKNOWN;
    iint->ima_bprm_status = INTEGRITY_UNKNOWN;
    iint->ima_read_status = INTEGRITY_UNKNOWN;
    iint->ima_creds_status = INTEGRITY_UNKNOWN;
    iint->evm_status = INTEGRITY_UNKNOWN;
    mutex_init(&iint->mutex);
 }

相关内容