insmod 签名引发的问题


  insmod 添加.ko时

  dmesg 

(1)发现 hello: module verification failed: signature and/or required key missing - tainting kernel

自3.7内核以后有了内核签名机制。

我的.config是这样

CONFIG_MODULE_SIG=y
# CONFIG_MODULE_SIG_FORCE is not set
CONFIG_MODULE_SIG_ALL=y

于是乎我把第二个打开了CONFIG_MODULE_SIG_FORCE=y

重新编译内核,再次insmod

(2)出现了insmod:ERROR :could not insert module hello.ko: Required key not available

当CONFIG_MODULE_SIG_FORCE=y时, 现在内核将只加载带有公钥的合法签名模块,

现在只能自己往.ko里添加签名了

/usr/src/linux-4.9.61/scripts/sign-file sha512 /usr/src/linux-4.9.61/certs/signing_key.pem /usr/src/linux-4.9.61/certs/signing_key.x509 hello.ko

再insmod 搞定!

(3)在网上找资料时看见 出现Required key not available的问题,多数是因为secure boot被打开导致的。因为CONFIG_MODULE_SIG_FORCE=y默认都是关闭的。

我找一个支持uefi的电脑,efi启动下安装的ubuntu16.04,内核4.4,secure boot打开,重现了问题,

现在要做的就是往系统中添加自己的证书,mokutil --import pubilc_key.der

问题又来了!This system does't support Secure Boot,什么情况??我明明是secure boot启动的 为什么会提示这个,

he 呵,原来是我这台联想的bios 不支持证书导入!这就是厂家的关系了,我想更新下bios看看的,但是我不感动啊。



猜你喜欢

转载自blog.csdn.net/lyw13522476337/article/details/79486326