A method and system for a system kernel to bootstrap integrity measurement
Patent Information
- Application Number
- CN202210437192.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-04-20
- Publication Date
- 2026-10-30
- Estimated Expiration
- 2042-04-20
AI Technical Summary
[0004]目前Linux系统上在引导内核时进行完整性度量的方法较为单一,无法满足不同场景下对内核完整性度量的需求
1.根据当前参数和预设的参数模式列表,从而能够得到匹配的硬件模式或软件模式。接着获取被度量文件,然后根据相应的度量模式对被度量文件进行度量,从而加载启动内核。能够根据不同的度量模式值选择软件模式或硬件模式,从而能够尽可能满足不同场景下对内核完整性度量的需求;
Smart Images

Figure CN114818006B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the technical field of system security, and in particular to a method and system for measuring the integrity of system kernel boot. Background Technology
[0002] Linux, short for GNU / Linux, is a free and open-source Unix-like operating system. It is a POSIX-based, multi-user, multi-tasking operating system that supports multi-threading and multi-CPU systems. Linux is not only stable in performance but also features open-source code, no copyright restrictions, and a large technical community.
[0003] GNUGRUB (GRandUnifiedBootloader, or "GRUB" for short) is a multi-boot loader from the GNU project. GRUB is an implementation of the multi-boot specification, allowing users to have multiple operating systems running simultaneously on their computer and choose which one to run at startup. GRUB can be used to select different kernels on operating system partitions and to pass boot parameters to these kernels.
[0004] Currently, the methods for performing kernel integrity measurement on Linux systems are relatively limited and cannot meet the needs of kernel integrity measurement in different scenarios. Summary of the Invention
[0005] To meet the needs of kernel integrity measurement in different scenarios as much as possible, this application provides a method and system for measuring system kernel boot integrity.
[0006] Firstly, this application provides a method for measuring the integrity of system kernel boot, employing the following technical solution: A method for measuring system kernel boot integrity includes: Determine the system's environment variables; The measurement mode is obtained based on the environmental variables, and the measurement mode includes a hardware mode and a software mode. Obtain the current parameters of the measurement mode; Based on the current parameters and the preset parameter mode list, the matching hardware mode or software mode is obtained. The parameter mode list includes different measurement modes and corresponding measurement mode values. Obtain the file being measured; The measured file is measured based on the corresponding measurement mode in order to load and start the kernel.
[0007] By adopting the above technical solution, the measurement mode is obtained based on environment variables, then the file to be measured is acquired, and the content of the file is measured according to the corresponding measurement mode. Finally, the decision on whether to load and start the kernel is made based on the measurement mode and measurement results. This solution allows for the selection of either software or hardware measurement modes as needed, thereby meeting the requirements for kernel integrity measurement in different scenarios as much as possible.
[0008] Preferably, the hardware mode includes hardware measurement and attempted hardware measurement; The software model includes software metrics and trial software metrics.
[0009] By adopting the above technical solutions, hardware measurement, attempted hardware measurement, software measurement, and attempted software measurement can further meet the needs of kernel integrity measurement in different scenarios.
[0010] Preferably, when the measurement mode is the hardware measurement or the software measurement, the step of measuring the measured file based on the corresponding measurement mode to load the boot kernel includes: Obtain the baseline digest value of the measured file; Obtain the current summary value of the measured file; Determine whether the current digest value is the same as the baseline digest value; If the current digest value is the same as the baseline digest value, then load and start the kernel; If the current digest value is different from the baseline digest value, the kernel startup is determined to have failed and an error audit record is output.
[0011] By employing the above technical solution, when the measurement mode is hardware or software measurement, the kernel boot conditions can be determined by comparing the current digest value with the baseline digest value. If the current digest value matches the baseline digest value, the system loads and boots the kernel; if the current digest value differs from the baseline digest value, the kernel boot process is determined to have failed, and an error audit log is output. This allows for the assessment of kernel boot security, and the output of the error audit log upon boot failure helps identify the cause of the failure.
[0012] Preferably, when the measurement mode is the attempted hardware measurement or the attempted software measurement, the step of measuring the measured file based on the corresponding measurement mode to load the boot kernel includes: Obtain the current summary value of the measured file; Determine whether the current digest value is the same as the baseline digest value; If the current digest value is the same as the baseline digest value, then load and start the kernel; If the current digest value is different from the baseline digest value, then continue loading the startup kernel and output the error audit record.
[0013] By adopting the above technical solution, when the measurement mode is either hardware measurement or software measurement, the kernel boot conditions can be further determined by comparing the current digest value with the baseline digest value. If the current digest value matches the baseline digest value, the system loads and boots the kernel; if they do not match, the kernel is still loaded and booted, and an error audit log is output. When the current digest value differs from the baseline digest value, the error audit log records the file location where the difference exists and the measurement time, facilitating querying.
[0014] As a preferred option, it also includes: The password algorithm type is obtained based on the aforementioned environment variables; The current digest value is obtained based on the cryptographic algorithm type.
[0015] By adopting the above technical solution, the current digest value can be obtained according to the cryptographic algorithm type, thereby improving the security of the acquisition and thus improving the security of loading and booting the kernel.
[0016] Preferably, the cryptographic algorithm types include: Chinese national cryptographic algorithms, MD5 algorithms, SHA1 algorithms, and SHA256 algorithms.
[0017] By adopting the above technical solutions, the diversity of cryptographic algorithm types can be increased, which can further improve the security of acquired data.
[0018] Preferably, the process includes the following steps before obtaining the file being measured: Get the configuration list; Obtain the baseline verification value of the configuration list; Obtain the current verification value of the configuration list based on the cryptographic algorithm type; Determine whether the current check value is equal to the baseline check value; If the current verification value is equal to the baseline verification value, then read the measured file from the configuration list; If the current verification value is not equal to the baseline verification value, then the measured file in the configuration list will not be read.
[0019] By employing the above technical solution, the current verification value of the configuration list is compared with the baseline verification value to determine whether they are the same, thus validating the configuration list. If the current verification value and the baseline verification value are the same, the file to be measured in the configuration list is read; if the current verification value and the baseline verification value are different, the configuration list is invalid, and the file to be measured in the configuration list is not read, thereby improving the security of obtaining the file to be measured.
[0020] Preferably, after measuring the file to be measured based on the corresponding measurement mode to load the boot kernel, the method further includes: Obtain the verification code; Determine whether the verification password is the same as the preset password; If the verification password is the same as the preset password, then the preset interface will be entered; The measurement mode and the cryptographic algorithm type are preset based on the preset interface; If the verification password is different from the preset password, the preset interface will not be accessed.
[0021] By employing the above technical solution, determining whether the verification password equals the preset password allows for the assessment of the validity of modifications to the measurement mode and cryptographic algorithm type. If the verification password matches the preset password, the user is directed to the preset interface, where they can then set the measurement mode and cryptographic algorithm type. If the verification password differs from the preset password, it indicates that setting the measurement mode and cryptographic algorithm type is invalid. In this case, the user is not directed to the preset interface, thus preventing the setting of the measurement mode and cryptographic algorithm type and enhancing the security of setting these parameters.
[0022] Preferably, after measuring the file to be measured based on the corresponding measurement mode to load the boot kernel, the method further includes: Get the setup password; Determine whether the set password is equal to the preset verification password; If the set password is equal to the verification password, then the digest value of the measured file is modified and replaced; If the set password is not equal to the verification password, the digest value of the measured file will not be modified or replaced.
[0023] By employing the above technical solution, it is possible to determine whether the modification of the measured file is valid by judging whether the preset password is equal to the preset verification password. If the password is equal to the verification password, the digest value of the measured file is modified and replaced; if the password is not equal to the verification password, it proves that the modification of the measured file is invalid, and the digest value of the measured file is not modified and replaced. This improves the security of the digest value of the measured file, thereby further enhancing the security of the system kernel startup.
[0024] Secondly, this application provides a system for measuring the integrity of system kernel boot, which adopts the following technical solution: A system for measuring kernel boot integrity, comprising: The variable determination module is used to determine the system's environment variables; The mode acquisition module is used to acquire the measurement mode based on the environmental variables, the measurement mode including hardware mode and software mode; The parameter acquisition module is used to acquire the current parameters of the measurement mode; The mode determination module is used to obtain the matching hardware mode or software mode based on the current parameters and a preset parameter mode list. The parameter mode list includes different measurement modes and corresponding measurement mode values. The file acquisition module is used to acquire the file being measured. The measurement control module is used to measure the measured file based on the corresponding measurement mode in order to load and start the kernel.
[0025] By adopting the above technical solution, after the variable determination module determines the system's environment variables, it sends the determined environment variables to the connected mode acquisition module. The mode acquisition module then obtains the measurement mode based on the environment variables, where the measurement mode includes hardware mode and software mode. The mode acquisition module sends the measurement mode to the connected parameter acquisition module, which obtains the current parameters of the measurement mode and sends them to the connected mode determination module. The mode determination module, based on the current parameters and a preset parameter mode list, obtains the matching hardware mode and software mode and sends them to the connected measurement control module. The parameter mode list includes different measurement modes and their corresponding measurement mode values. Next, the file acquisition module obtains the file to be measured and sends it to the connected measurement control module. Finally, the measurement control module measures the file to be measured according to the corresponding measurement mode to load and start the kernel. This allows for the selection of either software mode or hardware mode based on different measurement mode values, thereby meeting the needs for kernel integrity measurement in different scenarios as much as possible.
[0026] In summary, this application includes at least one of the following beneficial technical effects: 1. Based on the current parameters and a list of preset parameter modes, the matching hardware or software mode can be obtained. Next, the file to be measured is acquired, and then measured according to the corresponding measurement mode, thereby loading and booting the kernel. It can select either software or hardware mode based on different measurement mode values, thus meeting the needs for kernel integrity measurement in different scenarios as much as possible. 2. Hardware metrics, attempted hardware metrics, software metrics, and attempted software metrics can further meet the needs of different scenarios for kernel integrity measurement. Attached Figure Description
[0027] Figure 1 This is a schematic diagram of the overall process of a method for measuring the integrity of system kernel boot provided in an embodiment of this application; Figure 2 This is a flowchart illustrating steps S11 to S15 in one embodiment of this application; Figure 3 This is a flowchart illustrating steps S21 to S24 in one embodiment of this application; Figure 4 This is a flowchart illustrating steps S31 to S32 in one embodiment of this application; Figure 5 This is a flowchart illustrating steps S41 to S46 in one embodiment of this application; Figure 6 This is a flowchart illustrating steps S51 to S55 in one embodiment of this application; Figure 7 This is a flowchart illustrating steps S61 to S64 in one embodiment of this application; Figure 8 This is a structural block diagram of a system for measuring the integrity of system kernel booting, provided in an embodiment of this application.
[0028] Explanation of reference numerals in the attached figures: 1. Variable determination module; 2. Pattern acquisition module; 3. Parameter acquisition module; 4. Pattern determination module; 5. File acquisition module; 6. Measurement control module. Detailed Implementation
[0029] The following is in conjunction with the appendix Figure 1-8 This application will be described in further detail.
[0030] This application discloses a method for measuring the integrity of system kernel boot.
[0031] Reference Figure 1 Methods for measuring system kernel boot integrity include: S1. Determine the system's environment variables; S2. Obtain measurement patterns based on environmental variables; S3. Get the current parameters of the measurement mode; S4. Based on the current parameters and the preset parameter mode list, obtain the matching hardware mode or software mode; S5. Obtain the file to be measured; S6. Measure the file being measured based on the corresponding measurement mode to load and start the kernel.
[0032] Specifically, the system first powers on and enters the GRUB bootloader. GRUB is a complete program used to load and manage system startup. It is the most common bootloader in Linux distributions. Then, the system environment variables are determined; the method for determining these environment variables can be selected by the user.
[0033] The GRUB bootloader then retrieves the measurement mode based on environment variables. This measurement mode includes hardware mode and software mode. The bootloader then obtains the current parameters for each measurement mode. Next, it retrieves a preset parameter mode list, which includes different measurement modes and their corresponding parameters (hardware mode and software mode, and the parameters corresponding to each mode). Finally, it matches the current parameters with the preset parameter mode list to determine the appropriate measurement mode—either hardware mode or software mode.
[0034] Specifically, the parameter mode list can include hardware modes and their corresponding hardware metric mode values, as well as software modes and their corresponding software metric mode values. The current parameter is then matched against both the hardware and software metric mode values. If the current parameter matches the hardware metric mode value corresponding to the hardware mode, the obtained metric mode is the hardware mode; if the current parameter matches the software metric mode value corresponding to the software mode, the obtained metric mode is the software mode.
[0035] Next, the file to be measured is obtained. This file is a pre-stored file, referring to the file that needs to be measured. Finally, the file is measured according to the obtained measurement mode, thereby loading and starting the kernel. It can select software or hardware mode based on different parameters, thus enabling hardware or software measurement, and can meet the needs of kernel integrity measurement in different scenarios as much as possible.
[0036] In another embodiment, the hardware mode includes hardware metrics and attempted hardware metrics, and the software mode includes software metrics and attempted software metrics. During the measurement process, the measurement method needs to be further determined. Specifically, each measurement method may correspond to a specific vmode value; for example, the vmode value for hardware metrics is 1, the vmode value for attempted hardware metrics is 2, the vmode value for software metrics is 3, and the vmode value for attempted software metrics is 4.
[0037] In other words, hardware metric mode values correspond to vmode values 1 and 2, software metric mode values correspond to vmode values 3 and 4, and the current parameter is the current vmode value. When vmode value is 1, the metric mode is determined to be hardware metric; when vmode value is 2, the metric mode is determined to be attempting hardware metric; when vmode value is 3, the metric mode is determined to be software metric; and when vmode value is 4, the metric mode is determined to be attempting software metric.
[0038] In another embodiment, before kernel booting, it is also necessary to determine whether the file to be measured needs to be measured. That is, the measurement mode also includes no measurement, which corresponds to a vmode value of 0. When the vmode value is determined to be 0, the file to be measured is not measured, and the kernel is directly loaded and started. When the vmode value is any value other than 0 to 4, it is an invalid mode, and the boot will fail.
[0039] Reference Figure 2 In another embodiment, when the measurement mode is hardware measurement or software measurement, step S6, which measures the file to be measured based on the corresponding measurement mode to load the boot kernel, includes the following steps: S11. Obtain the baseline summary value of the measured file; S12. Obtain the current summary value of the measured file; S13. Determine whether the current digest value is the same as the baseline digest value; S14. If the current digest value is the same as the baseline digest value, then load the boot kernel; S15. If the current digest value is different from the baseline digest value, then determine that the kernel startup has failed and output the error audit log.
[0040] Specifically, when the measurement mode is determined to be hardware or software measurement, a baseline digest value is obtained for the file being measured. Each file being measured has a corresponding baseline digest value, which is a preset fixed value, i.e., a reliable value. When measuring the current file being measured, the current digest value of the current file being measured is obtained. Then, it is determined whether the current digest value is the same as the baseline digest value, thereby determining whether the file being measured is a valid file.
[0041] If the current digest value is the same as the baseline digest value, it proves that the file being measured is a valid file, indicating that the measurement is successful, and the system can load and start the kernel. If the current digest value is different from the baseline digest value, it proves that the file being measured is an invalid file, indicating that the measurement has failed, and the kernel startup has failed. At this time, an error audit log is generated and output.
[0042] In other words, when the measurement mode is determined to be hardware or software measurement, the measured file must be successfully measured for the kernel to boot successfully; otherwise, booting will fail, thus improving kernel boot security. It's important to understand that when there are multiple measured files, the kernel can only boot normally if all measured files are successfully measured. If any measured file fails to be measured, the measurement stops, and booting fails. Outputting error audit logs allows users to easily find the cause of errors and perform corresponding modifications. The error audit log includes the measurement result, time, file path, etc. When a measurement fails, the error audit log can be stored on an encrypted card for easy retrieval.
[0043] Reference Figure 3 In another embodiment, when the measurement mode is either attempting hardware measurement or attempting software measurement, step S6, which measures the file to be measured based on the corresponding measurement mode to load the boot kernel, includes the following steps: S21. Obtain the current summary value of the measured file; S22. Determine whether the current digest value is the same as the baseline digest value; S23. If the current digest value is the same as the baseline digest value, then load the boot kernel; S24. If the current digest value is different from the baseline digest value, continue loading the startup kernel and output the error audit log.
[0044] Specifically, when the measurement mode is determined to be either hardware measurement or software measurement, and the current file being measured is being measured, the current digest value of the current file being measured is obtained. Then, it is determined whether the current digest value is the same as the baseline digest value, thereby determining whether the file being measured is a valid file.
[0045] If the current digest value is the same as the baseline digest value, it proves that the file being measured is a valid file, indicating that the measurement is successful and the system can load and start the kernel. If the current digest value is different from the baseline digest value, it proves that the file being measured is an invalid file, indicating that the measurement has failed, but the kernel still starts successfully and generates and outputs an error audit log.
[0046] In other words, when the measurement mode is determined to be either hardware measurement or software measurement, the measured file must be able to boot successfully by the kernel regardless of whether the measurement is successful or not. Outputting error audit logs also helps users find the cause of errors and facilitates corresponding modifications. The error audit log includes the measurement result, time, file path, etc. When a measurement fails, the error audit log can be stored on an encrypted card or directly saved to the system for easy retrieval.
[0047] It is important to understand that when booting the same system, regardless of whether hardware metrics, software metrics, or attempts to use either, the summary value of the metric file will be the same during a single measurement process, assuming the metric file and configuration list remain unchanged.
[0048] Reference Figure 4 To improve the security of the acquired parameters, another embodiment further includes the following steps: S31. Obtain the cryptographic algorithm type based on environment variables; S32. Obtain the current digest value based on the cryptographic algorithm type.
[0049] The cryptographic algorithm types include: Chinese national cryptographic algorithms, MD5, SHA1, and SHA256. When a measurement is required, the GURB bootloader obtains the corresponding cryptographic algorithm type based on environment variables, calculates the current digest value using the appropriate algorithm, and improves the security of digest value acquisition. This, in turn, improves the accuracy of the measurement and ultimately enhances the security of successful kernel booting.
[0050] Reference Figure 5 When measurement is required, in order to further improve the security of kernel startup, the configuration list needs to be verified. Therefore, in another embodiment, before step S5, i.e., obtaining the file to be measured, the following is also included: S41. Obtain the configuration list; S42. Obtain the baseline verification value of the configuration list; S43. Obtain the current verification value of the configuration list based on the cryptographic algorithm type; S44. Determine whether the current check value is equal to the baseline check value; S45. If the current verification value is equal to the baseline verification value, then read the measured file from the configuration list; S46. If the current check value is not equal to the baseline check value, the measured file in the configuration list will not be read.
[0051] Specifically, the process involves retrieving a configuration list. Each configuration list corresponds to a file to be measured, and each list must contain both a kernel file and an initrd file. Configuration lists without both kernel and initrd files are invalid, and the verification process will fail. In other words, the file to be measured must include both a kernel file and an initrd file. A configuration list is a configuration file containing information about all the measurement files. This file ends with a checksum to verify its validity.
[0052] Each configuration list ends with a checksum, which is obtained by calculating using the corresponding cryptographic algorithm. This checksum helps to ensure the security of the configuration list and the file being measured as much as possible.
[0053] During the verification process, the baseline verification value of the configuration list is first obtained. The baseline verification value is a pre-stored trusted value. Then, the current verification value of the configuration list is obtained according to the cryptographic algorithm type. The single signature verification value is compared with the baseline verification value to determine whether the two are equal, thereby determining whether the configuration list is invalid.
[0054] If the current checksum equals the baseline checksum, it proves that the configuration list is valid and has not been modified without authorization. In this case, we can continue to read the files to be measured in the configuration list. If the current checksum does not equal the baseline checksum, it proves that the configuration list is invalid. The configuration list has most likely been modified without authorization, which means that the files to be measured in the configuration list are invalid. Therefore, we do not need to read the files to be measured in the configuration list, thereby further improving the security of the measurement and improving work efficiency.
[0055] In another embodiment, the configuration list can also be an encrypted list, with the specific encryption algorithm hidden. Modifications to this file are made using software commands, and a password is required for the modification.
[0056] Reference Figure 6 When it is necessary to modify the measurement mode or cryptographic algorithm type, in order to improve the security of the modification, in another embodiment, after step S6, i.e., measuring the file to be measured based on the corresponding measurement mode to load the boot kernel, the following is also included: S51. Obtain the verification password; S52. Determine whether the verification password is the same as the preset password; S53. If the verification password is the same as the preset password, then enter the preset interface; S54. Preset measurement mode and cryptographic algorithm type based on preset interface; S55. If the verification password is different from the preset password, the preset interface will not be entered.
[0057] Specifically, after the system kernel successfully boots into the system, when it is necessary to modify the measurement mode and password algorithm type, the system first obtains the verification password. Then, it checks whether the verification password is equal to the preset password, which is the same as the preset password. This determines whether the measurement mode and password algorithm type can be modified.
[0058] If the verification password is the same as the preset password, the user can enter the preset interface and modify the measurement mode and password algorithm type by operating the content of the preset interface. If the verification password is different from the preset password, the user will not enter the preset interface and therefore cannot modify the measurement mode and password algorithm type, thus improving the security of modifying the measurement mode and password algorithm type.
[0059] Reference Figure 7 In another embodiment, after step S6, i.e., measuring the file to be measured based on the corresponding measurement mode to load the boot kernel, the method further includes: S61. Obtain the setup password; S62. Determine whether the set password is equal to the preset verification password; S63. If the password is set to be equal to the verification password, then the summary value of the measured file is modified and replaced. S64. If the set password is not equal to the verification password, the summary value of the measured file will not be modified or replaced.
[0060] Specifically, after the kernel boots into the system and needs to modify the file being measured, it first obtains the setup password, which is the entered setup password. Then, it checks whether the setup password is equal to the preset verification password, which is a pre-stored verification password. By checking whether the setup password is equal to the preset verification password, it can determine whether the modification to the file being measured is unauthorized.
[0061] If the password is set to equal the verification password, it proves that the modification of the measured file is authorized. At this time, the digest value of the measured file is modified and replaced, that is, the modified measured file replaces the original measured file. The digest value of the modified measured file is used as the new baseline value. When the system performs the next kernel boot, the new baseline digest value is used as trusted data and updated to the end of the measured file.
[0062] If the password set is not equal to the verification password, it proves that the modification to the file being measured was unauthorized. In this case, the digest value of the file being measured is not modified or replaced; that is, the digest value of the file being measured remains unchanged, i.e., the baseline digest value remains unchanged. In another embodiment, after the configuration list is modified, a new baseline verification value is obtained as trusted data and updated to the end of the file.
[0063] Therefore, by employing the methods described above, the security and accuracy of measuring the file being measured can be further improved, thereby enhancing the overall system security. Similarly, in another embodiment, when modifying or replacing the configuration list, the modification or replacement method is the same as that used for modifying or replacing the file being measured, which can improve the security of verifying the configuration list.
[0064] The implementation principle of a method for measuring system kernel boot integrity according to an embodiment of this application is as follows: First, the system environment variables are determined. After determining the system environment variables, the measurement mode is obtained based on the environment variables. Then, the current parameters of the measurement mode are obtained. Based on the current parameters and a preset parameter mode list, which includes different measurement modes and their corresponding measurement mode values, a matching hardware mode or software mode can be obtained. Next, the file to be measured is obtained, and then the file to be measured is measured according to the corresponding measurement mode, thereby loading and starting the kernel. The method can select either a software mode or a hardware mode based on different measurement mode values, thus meeting the needs of kernel integrity measurement in different scenarios as much as possible.
[0065] This application also discloses a system for measuring the integrity of system kernel boot, which can achieve the same technical effect as the method for measuring the integrity of system kernel boot described above.
[0066] Reference Figure 8 Systems that measure kernel boot integrity include: Variable determination module 1 is used to determine the system's environment variables; The mode acquisition module 2 is used to acquire the measurement mode based on environmental variables. The measurement mode includes hardware mode and software mode. Parameter acquisition module 3 is used to acquire the current parameters of the measurement mode; The mode determination module 4 is used to obtain the matching hardware mode or software mode based on the current parameters and the preset parameter mode list. The parameter mode list includes different measurement modes and corresponding parameters. File acquisition module 5 is used to acquire the file being measured; Measurement control module 6 is used to measure the file being measured based on the corresponding measurement mode in order to load and start the kernel.
[0067] Specifically, after the variable determination module 1 determines the system's environment variables, it sends the determined environment variables to the connected mode acquisition module 2. Then, the mode acquisition module 2 obtains the measurement mode based on the environment variables, where the measurement mode includes hardware mode and software mode.
[0068] The mode acquisition module 2 sends the measurement mode to the parameter acquisition module 3 connected to it. The parameter acquisition module 3 acquires the current parameters of the measurement mode and sends them to the mode determination module 4 connected to it. The mode determination module 4 obtains the matching hardware mode and software mode based on the current parameters and a preset parameter mode list, and sends them to the measurement control module 6 connected to it. The parameter mode list includes different measurement modes and their corresponding parameters.
[0069] Next, file acquisition module 5 acquires the file to be measured and sends it to the connected measurement control module 6. Finally, measurement control module 6 measures the file according to the corresponding measurement mode to load and start the kernel. This allows for the selection of software or hardware mode based on different parameters, thereby meeting the needs of kernel integrity measurement in different scenarios as much as possible.
[0070] The above are all preferred embodiments of this application, and are not intended to limit the scope of protection of this application. Therefore, all equivalent changes made in accordance with the structure, shape and principle of this application should be covered within the scope of protection of this application.
Claims
1. A method for measuring the integrity of system kernel boot, characterized in that, The GRUB bootloader, which runs after the system powers on, includes: Determine the system's environment variables; The GRUB bootloader obtains the measurement mode based on the environment variables. The measurement modes include no measurement mode, hardware mode, and software mode. The hardware mode includes hardware measurement and attempted hardware measurement, and the software mode includes software measurement and attempted software measurement. The GRUB bootloader obtains the current parameters of the metric mode; The current parameter is matched with a preset parameter mode list to obtain a matching measurement mode. The parameter mode list includes different measurement modes and corresponding measurement mode values. Among them, the measurement mode value corresponding to the no measurement mode is 0, the measurement mode value corresponding to the hardware measurement is 1, the measurement mode value corresponding to the attempted hardware measurement is 2, the measurement mode value corresponding to the software measurement is 3, and the measurement mode value corresponding to the attempted software measurement is 4. Obtain the file being measured; The measured file is measured based on the corresponding measurement mode in order to load and start the kernel; Wherein, when the measurement mode is the attempted hardware measurement or the attempted software measurement, the step of measuring the measured file based on the corresponding measurement mode to load the boot kernel includes: obtaining the current digest value of the measured file; determining whether the current digest value is the same as the baseline digest value; if the current digest value is the same as the baseline digest value, then loading the boot kernel; if the current digest value is not the same as the baseline digest value, then continuing to load the boot kernel and outputting error audit records; When the measurement mode is either hardware measurement or software measurement, the step of measuring the measured file based on the corresponding measurement mode to load and start the kernel includes: obtaining a baseline digest value of the measured file; obtaining a current digest value of the measured file; determining whether the current digest value is the same as the baseline digest value; if the current digest value is the same as the baseline digest value, then loading and starting the kernel; if the current digest value is not the same as the baseline digest value, then determining that the kernel startup has failed and outputting an error audit record. After measuring the file to be measured based on the corresponding measurement mode to load and start the kernel, the method further includes: obtaining a verification password; determining whether the verification password is the same as a preset password; if the verification password is the same as the preset password, then entering a preset interface; presetting the measurement mode and password algorithm type based on the preset interface; if the verification password is different from the preset password, then not entering the preset interface.
2. The method according to claim 1, characterized in that, Also includes: The password algorithm type is obtained based on the aforementioned environment variables; The current digest value is obtained based on the cryptographic algorithm type.
3. The method according to claim 2, characterized in that, The cryptographic algorithm types include: Chinese national cryptographic algorithms, MD5 algorithms, SHA1 algorithms, and SHA256 algorithms.
4. The method according to claim 2, characterized in that, The process includes the following steps before obtaining the measured file: Get the configuration list; Obtain the baseline verification value of the configuration list; Obtain the current verification value of the configuration list based on the cryptographic algorithm type; Determine whether the current check value is equal to the baseline check value; If the current verification value is equal to the baseline verification value, then read the measured file from the configuration list; If the current verification value is not equal to the baseline verification value, then the measured file in the configuration list will not be read.
5. The method according to claim 1, characterized in that, After measuring the file based on the corresponding measurement mode to load and start the kernel, the process further includes: Get the setup password; Determine whether the set password is equal to the preset verification password; If the set password is equal to the verification password, then the digest value of the measured file is modified and replaced; If the set password is not equal to the verification password, the digest value of the measured file will not be modified or replaced.
6. A system for measuring the integrity of system kernel boot, characterized in that, A method for performing a system kernel boot integrity measurement as described in any one of claims 1 to 5, comprising: The variable determination module (1) is used to determine the system's environment variables; The mode acquisition module (2) is used to acquire the measurement mode based on the environmental variables, the measurement mode including hardware mode and software mode; The parameter acquisition module (3) is used to acquire the current parameters of the measurement mode; The mode determination module (4) is used to obtain a matching measurement mode based on the current parameters and a preset parameter mode list, wherein the parameter mode list includes different measurement modes and corresponding measurement mode values; The file acquisition module (5) is used to acquire the file being measured; The measurement control module (6) is used to measure the measured file based on the corresponding measurement mode in order to load the startup kernel.
Citation Information
Patent Citations
Dynamic measurement method of trusted computing platform based on double-system structure
CN110309659A
