CN112487435B - 基于x86架构的安全启动方法 - Google Patents

基于x86架构的安全启动方法 Download PDF

Info

Publication number
CN112487435B
CN112487435B CN202011231938.6A CN202011231938A CN112487435B CN 112487435 B CN112487435 B CN 112487435B CN 202011231938 A CN202011231938 A CN 202011231938A CN 112487435 B CN112487435 B CN 112487435B
Authority
CN
China
Prior art keywords
kernel
certificate
rpm
uefi
initramfs
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202011231938.6A
Other languages
English (en)
Other versions
CN112487435A (zh
Inventor
郭皓
吴春光
刘步权
齐璇
战茅
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Kirin Software Co Ltd
Original Assignee
Kirin Software Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Kirin Software Co Ltd filed Critical Kirin Software Co Ltd
Priority to CN202011231938.6A priority Critical patent/CN112487435B/zh
Publication of CN112487435A publication Critical patent/CN112487435A/zh
Application granted granted Critical
Publication of CN112487435B publication Critical patent/CN112487435B/zh
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/50Monitoring users, programs or devices to maintain the integrity of platforms, e.g. of processors, firmware or operating systems
    • G06F21/57Certifying or maintaining trusted computer platforms, e.g. secure boots or power-downs, version controls, system software checks, secure updates or assessing vulnerabilities
    • G06F21/575Secure boot
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation

Landscapes

  • Engineering & Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Software Systems (AREA)
  • Computer Hardware Design (AREA)
  • Computer Security & Cryptography (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Stored Programmes (AREA)

Abstract

本发明涉及一种基于X86架构的安全启动方法,包括如下步骤:步骤S1:利用编译机产生可信根证书和被证书签名的内核rpm包;步骤S2:利用测试机导入可信根证书,并打开SecureBoot功能。本发明使用X86平台下的UEFI软件中的SecureBoot功能,通过使用自制根证书和签名重新编译内核源码包,从而保证了PC或服务器中的Linux内核和initramfs的有效性,当内核或initramfs被修改后,无法进入系统,达到防止他人私自篡改内核和initramfs的效果。

Description

基于X86架构的安全启动方法
技术领域
本发明涉及数据安全技术领域,具体涉及一种基于X86架构的安全启动方法。
背景技术
X86架构的服务器操作系统通常都是开源的Linux操作系统,如CentOS、Fedora、Ubuntu。Linux的内核和initramfs都是开源的,可能会被篡改,这就会给服务器造成较大的安全隐患。为了避免这个安全隐患,就需要带有安全启动功能的X86平台,在开机启动时主动度量linux内核和initramfs,从而保证服务器操作系统的安全性。
Intel公司牵头研发的UEFI软件代替了BIOS。UEFI软件提供的SecureBoot功能用于保证linux内核和initramfs的有效性。但是大多数X86架构的主板在出厂时,使用的是微软可信根和Fedora可信根。当我们把使用Fedora或CentOS提供的内核软件包源码编译内核时,也会使用Fedora可信根。这就会导致虽然开启了安全启动功能,但无法保证内核和initramfs的有效性。
也有不使用UEFI软件的SecureBoot功能实现安全启动的方法,有的面向嵌入式,不适用于X86平台,有的需要借助其他特殊芯片、特殊处理器,不适用于常见的PC或服务器。
发明内容
为解决已有技术存在的不足,本发明提供了一种基于X86架构的安全启动方法,包括如下步骤:
步骤S1:利用编译机产生可信根证书和被证书签名的内核rpm包;
步骤S2:利用测试机导入可信根证书,并打开SecureBoot功能。
其中,所述步骤S1包括:
步骤S11:制作SecureBoot的启动证书;
步骤S12:进行签名证书创建;
步骤S13:制作SecureBoot启动的证书的uefi-secureboot-key软件rpm包;
步骤S14:安装secureboot启动的证书的rpm包;
步骤S15:重新编译shim-signed、grub2、kernel。
其中,所述步骤S13包括:将生成的myca.der以及tmp文件夹中的cert8.db、key3.db、secmod.db打包为uefi-secureboot-key-1.0.tar.gz,然后使用SPECS文件:uefi-secureboot-key.spec制作为uefi-secureboot-key-1.0-el7.x86_64.rpm。
其中,所述步骤S2包括:
步骤S21:更新编译机编译的shim、grub2、kernel;
步骤S22:导入证书;
步骤S23:系统重启,进入shim,开启SecureBoot。
本发明使用X86平台下的UEFI软件中的SecureBoot功能,通过使用自制根证书和签名重新编译内核源码包,从而保证了PC或服务器中的Linux内核和initramfs的有效性,当内核或initramfs被修改后,无法进入系统,达到防止他人私自篡改内核和initramfs的效果。
具体实施方式
为了对本发明的技术方案及有益效果有更进一步的了解,下面详细说明本发明的技术方案及其产生的有益效果。
本发明的总体思路在于,为服务器增加自己产生的可信根证书,并使用此根证书重新生成内核和initramfs,把可信根证书导入到机器中,并打开SecureBoot功能。
打开SecureBoot后,验证流程如下:
(1)固件验证第一阶段的bootloader(shim-signed),验证的秘钥存储在DB中。
(2)第一阶段的bootloader(shim-signed)验证第二阶段的bootloader(grub2-efi-x64)。
(3)第二阶段的bootloader(grub2-efi-x64)调用shim接口验证kernel的签名。
(4)kernel验证modules。
在具体实施中,需要用到两个环境,分别是编译机和测试机,编译机用于产生可信根证书和被证书签名的内核RPM包。两个环境均安装CentOS7.6操作系统。
具体步骤如下:
一、编译机操作步骤:
1、制作SecureBoot的启动证书
nss=$(mktemp-p$PWD-d)
echo>${nss}/pwfile
certutil-N-d${nss}-f${nss}/pwfile
certutil-S-s"CN=test ca,O=Myself,L=Zhengzhou,ST=
Henan,C=CN"-n"test_ca"-x-t"CT,C,C"-1-2-5-m 730-d${nss}。
2、进行签名证书创建
certutil-S-s"CN=test signer,O=Myself,L=Zhengzhou,S T=Henan,C=CN"-n test_signer-c"test_ca"-t"u,u,u"-1-5-6-8-m 730-d${nss}
certutil-L-n"test_ca"-d${nss}-r>~/myca.der certutil-F-n test_ca-d${nss}
certutil-A-n"test_ca"-i~/myca.der-d${nss}-t"CT,C,C"rm-f${nss}/pwfile。
3、制作SecureBoot启动的证书的uefi-secureboot-key软件rpm包
将生成的myca.der以及tmp文件夹中的cert8.db、key3.db、secmod.db打包为uefi-secureboot-key-1.0.tar.gz,然后使用SPECS文件:uefi-secureboot-key.spec制作为uefi-secureboot-key-1.0-el7.x86_64.rpm。
4、安装secureboot启动的证书的rpm包uefi-secureboot-key-1.0-el7.x86_64.rpm yum install uefi-secureboot-key。
5、重新编译shim-signed、grub2、kernel
rpm-ivh shim-signed-15-1.el7.centos.src.rpm
cd rpmbuild/SPESC
yum-builddep shim-signed.spec
rpmbuild-ba shim-signed.spec
rpm-ivh grub2-2.02-0.44.el7.src.rpm
cd rpmbuild/SPESC
yum-builddep grub2.spec
rpmbuild-ba grub2.spec
rpm-ivh kernel-3.10.0-957.el7.src.rpm
cd rpmbuild/SPESC
yum-builddep kernel.spec
rpmbuild-ba kernel.spec
二、测试机操作步骤
1、更新编译机编译的shim、grub2、kernel
rpm-Uvh shim-x64-15-1.el7.x86_64.rpm mokutil-15-1.el7.x86_64.rpmefibootmgr-17-2.el7.x86_64.rpm efivar-36-11.el7.x86_64.rpm efivar-devel-36-11.el7.x86_64.rpm efivar-libs-36-11.el7.x86_64.rpm
rpm-Uvh grub2-2.02-0.76.el7.centos.x86_64.rpm grub2-pc-2.02-0.76.el7.centos.x86_64.rpm
grub2-common-2.02-0.76.el7.centos.noarch.rpm
grub2-pc-modules-2.02-0.76.el7.centos.noarch.rpm
grub2-tools-2.02-0.76.el7.centos.x86_64.rpm
grub2-tools-minimal-2.02-0.76.el7.centos.x86_64.rpm
grub2-tools-extra-2.02-0.76.el7.centos.x86_64.rpm
grub2-efi-x64-2.02-0.76.el7.centos.x86_64.rpm
grub2-efi-x64-modules-2.02-0.76.el7.centos.noarch.rpm
rpm-Uvh--force kernel-3.10.0-957.el7.rpm。
2、导入证书
mokutil--import myca.der
输入密码,此密码为重启后进入shim环境后导入秘钥时使用。
3、系统重启,进入shim,开启SecureBoot
选择Enrolle MOK
选择Continue
输入导入myca.der时的密码
重启
在主板设置中,选择secureboot enable。
本发明使用X86平台下的UEFI软件中的SecureBoot功能,通过使用自制根证书和签名重新编译内核源码包,从而保证了PC或服务器中的Linux内核和initramfs的有效性,当内核或initramfs被修改后,无法进入系统,达到防止他人私自篡改内核和initramfs的效果。
虽然本发明已利用上述较佳实施例进行说明,然其并非用以限定本发明的保护范围,任何本领域技术人员在不脱离本发明的精神和范围之内,相对上述实施例进行各种变动与修改仍属本发明所保护的范围,因此本发明的保护范围以权利要求书所界定的为准。

Claims (2)

1.一种基于X86架构的安全启动方法,其特征在于,包括如下步骤:
步骤S1:利用编译机产生可信根证书和被证书签名的内核rpm包;
步骤S2:利用测试机导入可信根证书,并打开SecureBoot功能;
所述步骤S1包括:
步骤S11:制作SecureBoot的启动证书;
步骤S12:进行签名证书创建;
步骤S13:制作SecureBoot启动的证书的uefi-secureboot-key软件rpm包;
步骤S14:安装secureboot启动的证书的rpm包;
步骤S15:重新编译shim-signed、grub2、kernel;
所述步骤S2包括:
步骤S21:更新编译机编译的shim、grub2、kernel;
步骤S22:导入证书;
步骤S23:系统重启,进入shim,开启SecureBoot。
2.如权利要求1所述的基于X86架构的安全启动方法,其特征在于,所述步骤S13包括:将生成的myca.der以及tmp文件夹中的cert8.db、key3.db、secmod.db打包为uefi-secureboot-key-1.0.tar.gz,然后使用SPECS文件:uefi-secureboot-key.spec制作为uefi-secureboot-key-1.0-el7.x86_64.rpm。
CN202011231938.6A 2020-11-06 2020-11-06 基于x86架构的安全启动方法 Active CN112487435B (zh)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011231938.6A CN112487435B (zh) 2020-11-06 2020-11-06 基于x86架构的安全启动方法

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011231938.6A CN112487435B (zh) 2020-11-06 2020-11-06 基于x86架构的安全启动方法

Publications (2)

Publication Number Publication Date
CN112487435A CN112487435A (zh) 2021-03-12
CN112487435B true CN112487435B (zh) 2022-09-06

Family

ID=74928709

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011231938.6A Active CN112487435B (zh) 2020-11-06 2020-11-06 基于x86架构的安全启动方法

Country Status (1)

Country Link
CN (1) CN112487435B (zh)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113051584B (zh) * 2021-05-31 2023-05-02 武汉深之度科技有限公司 一种系统安全启动方法、装置、计算设备及可读存储介质

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103258164A (zh) * 2013-02-20 2013-08-21 中国电力科学研究院 一种嵌入式可信系统的启动方法
CN110224869A (zh) * 2019-06-13 2019-09-10 北京航空航天大学 一种微服务网站的自动化部署方法
CN111159726A (zh) * 2019-12-10 2020-05-15 中国电子科技网络信息安全有限公司 一种基于uefi环境变量的全盘加解密方法及系统

Family Cites Families (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
AU2007276673B2 (en) * 2006-07-18 2013-01-17 Blackberry Limited System and method for authenticating a gaming device
US20090327741A1 (en) * 2008-06-30 2009-12-31 Zimmer Vincent J System and method to secure boot uefi firmware and uefi-aware operating systems on a mobile internet device (mid)
CN103927490A (zh) * 2014-04-25 2014-07-16 华为技术有限公司 操作系统安全启动方法及装置
CN106940769B (zh) * 2017-03-01 2020-04-28 广州大学 操作系统安全远程加载方法
EP3602375A4 (en) * 2017-03-28 2020-12-16 Sierra Wireless, Inc. METHOD AND DEVICE FOR SAFELY STARTING UP A COMPUTER DEVICE
US10664599B2 (en) * 2017-05-01 2020-05-26 International Business Machines Corporation Portable executable and non-portable executable boot file security
CN109905242A (zh) * 2017-12-07 2019-06-18 航天信息股份有限公司 数字证书的存储、更新、验证方法及装置
CN110768940B (zh) * 2018-07-27 2022-03-22 深信服科技股份有限公司 基于https协议密文数据管控方法、系统、代理服务器及存储介质
CN109598126B (zh) * 2018-12-03 2021-05-04 贵州华芯通半导体技术有限公司 一种基于国密算法的系统安全启动方法、装置和系统
CN109977679A (zh) * 2019-02-22 2019-07-05 北京天地和兴科技有限公司 一种基于tcm芯片的工控安全设备升级包安装方法

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103258164A (zh) * 2013-02-20 2013-08-21 中国电力科学研究院 一种嵌入式可信系统的启动方法
CN110224869A (zh) * 2019-06-13 2019-09-10 北京航空航天大学 一种微服务网站的自动化部署方法
CN111159726A (zh) * 2019-12-10 2020-05-15 中国电子科技网络信息安全有限公司 一种基于uefi环境变量的全盘加解密方法及系统

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
成功编译LINUX内核的一种方法;赵培元;《潍坊教育学院学报》;20071215(第04期);全文 *
数字信封信息安全技术;饶文碧等;《武汉理工大学学报》;20040225(第02期);全文 *

Also Published As

Publication number Publication date
CN112487435A (zh) 2021-03-12

Similar Documents

Publication Publication Date Title
US11861372B2 (en) Integrity manifest certificate
US7802087B2 (en) Universal method for submitting gaming machine source code software to a game certification laboratory
US7788730B2 (en) Secure bytecode instrumentation facility
AU2010364976B2 (en) Repairing corrupt software
US20130031371A1 (en) Software Run-Time Provenance
US7739516B2 (en) Import address table verification
JP7100201B2 (ja) トラステッドコンピューティング方法およびサーバ
WO2017166561A1 (zh) 一种基于安卓系统apk下载方法及其系统
US20050283622A1 (en) System for managing security index scores
JP2010033563A (ja) マルチパーティ検証のプラットフォームに基づく信用検証サービスに関する方法およびシステム
US20090287917A1 (en) Secure software distribution
CN108345805B (zh) 验证固件的方法及装置
JP2017538217A (ja) アプリケーション整合性の検証を提供する方法及びデバイス
CN108205491B (zh) 一种基于nkv6.0系统的可信技术兼容性测试方法
CN112487435B (zh) 基于x86架构的安全启动方法
US9122864B2 (en) Method and apparatus for transitive program verification
US20120222015A1 (en) Security Role Testing Using an Embeddable Container and Properties Object
WO2022108713A1 (en) Firmware runtime patch secure release process
de Carné de Carnavalet et al. Challenges and implications of verifiable builds for security-critical open-source software
CN117150573A (zh) Bios镜像验证的故障定位方法、装置、设备及介质
CN110610091A (zh) 一种基于国产网络平台的安全pxe方法
Lyle Trustable remote verification of web services
Pöll et al. Automating the Quantitative Analysis of Reproducibility for Build Artifacts derived from the Android Open Source Project
Drexel et al. Reproducible Builds and Insights from an Independent Verifier for Arch Linux
Berger et al. File Signatures Needed!

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant