Virtual machine management method, storage medium, electronic equipment and program product
By using mirror files for data checksum encryption during the entire life cycle of a virtual machine, combined with the trusted execution environment and the modules of a non-secure environment to work together, the problem of large performance losses in virtual machine management technology is solved, and the virtual machine is realized High performance and safety balance.
Patent Information
- Application Number
- CN202410915646.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-09
- Publication Date
- 2024-11-01
AI Technical Summary
When existing virtual machine management technologies ensure security, memory encryption and isolation mechanisms lead to large performance losses, making it difficult to find a balance between performance and security.
By using mirror files for data checksum encryption throughout the life cycle of the virtual machine, processing virtual hard disk data layered, and using modules in a trusted execution environment and non-secure environment to work together to achieve secure startup and operation of the virtual machine, reducing the number of times the user needs to be restored by using the modules of the trusted execution environment and the system to work together. Performance loss.
On the premise of ensuring the trusted security of the entire life cycle of the virtual machine, the overall performance of the virtual machine is improved, the performance loss is reduced, and the data verification efficiency is improved through the layered processing of mirror files, so as to achieve the rational use of virtual machine memory resources.
Smart Images

Figure CN118885255A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of network security technology, and in particular to a virtual machine management method, storage medium, electronic device and program product. Background Art
[0002] Hyper-converged architecture is a cluster architecture that integrates virtualization and distributed storage. Virtualization divides the resources of physical servers into smaller and more flexible virtual machines to provide external services. The distributed storage system manages the hard disks in all physical servers in the cluster in a unified manner and provides storage capabilities for virtualization, such as the ability to provide virtual hard disks for virtual machines. At present, confidential virtual machine technology that relies on a trusted execution environment uses hardware-level security isolation and encryption at the CPU level to create an encrypted trust domain, in which three technologies can be implemented to ensure security. However, although this method can ensure the security of virtual machine operation, the memory encryption and isolation mechanism will bring a certain degree of performance loss and a large performance overhead.
[0003] Therefore, how to provide a technical solution for a virtual machine management method with better performance has become a technical problem that needs to be solved urgently. Summary of the invention
[0004] The purpose of some embodiments of the present application is to provide a method, storage medium, electronic device and program product for virtual machine management. Through the technical solutions of the embodiments of the present application, the overall performance of the virtual machine operation can be improved and the loss can be reduced under the premise of ensuring the trustworthiness and security of the virtual machine operation throughout its entire life cycle.
[0005] In a first aspect, some embodiments of the present application provide a method for virtual machine management, including: in the process of creating a virtual machine in a first operating environment, obtaining an image file corresponding to a virtual hard disk; after verifying the startup process of the virtual machine, starting the virtual machine; after confirming that the program to be executed has passed the verification, the virtual machine runs the program to be executed and writes the running data into the image file; wherein, when the virtual machine is shut down, the file verification value corresponding to the image file is used to update to the second operating environment, so as to verify during the startup process to confirm that the data has not been tampered with.
[0006] Some embodiments of the present application create an image file corresponding to a virtual hard disk in a first operating environment, verify the startup process of the virtual machine and then start the virtual machine. After the program to be executed has been verified, the virtual machine can run the related program to be executed and write the running data to the image file for subsequent verification to ensure that the data related to the virtual machine has not been tampered with, ensure the trusted security of the virtual machine throughout its entire life cycle, and perform different processing through different operating environments to improve the overall performance of the virtual machine operation and reduce losses.
[0007] In some embodiments, the image file includes: an initial read-write layer and an initial read-only layer; the method also includes: when the data volume of the initial read-write layer does not reach a preset threshold, when the virtual machine is shut down, calculating the data in the initial read-write layer and the initial read-only layer to obtain the file verification value; when the data volume of the initial read-write layer reaches a preset threshold, when the virtual machine is shut down, creating a target read-write layer and a to-be-merged layer, wherein the to-be-merged layer stores the data of the initial read-write layer; merging the to-be-merged layer with the data in the initial read-only layer to obtain a target read-only layer; and obtaining the file verification value by calculating the data in the target read-write layer and the target read-only layer.
[0008] Some embodiments of the present application can improve data verification efficiency and achieve reasonable use of virtual machine memory resources by layering the structure in the image file.
[0009] In some embodiments, obtaining the image file corresponding to the virtual hard disk includes: creating the image file and generating key data related to the image file, wherein the key data is synchronized to the second operating environment storage, and the key data includes: an access key and a data encryption key.
[0010] Some embodiments of the present application can achieve effective writing and secure storage of data by creating image files and related key data.
[0011] In some embodiments, the verification of the startup process of the virtual machine includes: calculating the verification value of the executable program to be verified, and comparing it with the corresponding target verification value in the process whitelist table to confirm that the executable program has passed the verification; confirming that the data in the image file has passed the verification; obtaining the key data, and using the access key to mount the image file to the virtual machine; decrypting the data read from the virtual hard disk by the data encryption key to obtain decrypted data.
[0012] Some embodiments of the present application complete the startup of the virtual machine by verifying the executable program, verifying the data in the image file, and decrypting the data, which has high security and provides support for subsequent operations.
[0013] In some embodiments, confirming that the data in the image file has passed the verification includes: obtaining the image file information to be verified in the startup command of the virtual machine; confirming that the result of the verification calculation of the image file information to be verified is consistent with the file verification value, then the image file verification has passed.
[0014] Some embodiments of the present application compare the verification calculation result of the image file information to be verified with the file verification value to confirm whether the verification passes, thereby preventing the image file information from being tampered with.
[0015] In some embodiments, the confirmation that the program to be executed has passed the verification includes: obtaining a process whitelist table from the second operating environment; confirming that the program to be executed is in the process whitelist table, and the verification value of the program to be executed is consistent with a pre-stored verification value, then the program to be executed has passed the verification.
[0016] Some embodiments of the present application can ensure the safe operation of the virtual machine by verifying the program to be executed through the process whitelist table.
[0017] In some embodiments, the process whitelist table is pre-stored in the second operating environment, and the process whitelist table contains all programs allowed to run by the virtual machine; one program corresponds to one pre-stored check value.
[0018] Some embodiments of the present application can enable the virtual machine to run programs that are allowed to run by pre-storing a whitelist in the second operating environment, with higher security.
[0019] In a second aspect, some embodiments of the present application provide a device for virtual machine management, comprising: a creation module, configured to obtain an image file corresponding to a virtual hard disk during the process of creating a virtual machine in a first operating environment; a startup module, configured to start the virtual machine after verifying the startup process of the virtual machine; an execution module, configured to confirm that the virtual machine runs the program to be executed after the verification of the program to be executed has passed, and write the running data into the image file; wherein, when the virtual machine is shut down, the file verification value corresponding to the image file is used to update to the second operating environment, so as to verify during the startup process to confirm that the data has not been tampered with.
[0020] In a third aspect, some embodiments of the present application provide a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, can implement the method described in any embodiment of the first aspect.
[0021] In a fourth aspect, some embodiments of the present application provide an electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor can implement a method as described in any embodiment of the first aspect when executing the program.
[0022] In a fifth aspect, some embodiments of the present application provide a computer program product, wherein the computer program product comprises a computer program, wherein the computer program, when executed by a processor, can implement the method described in any embodiment of the first aspect. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] In order to more clearly illustrate the technical solutions of some embodiments of the present application, the drawings required for use in some embodiments of the present application will be briefly introduced below. It should be understood that the following drawings only show some embodiments of the present application and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.
[0024] Figure 1 A system diagram of virtual machine management provided for some embodiments of the present application;
[0025] Figure 2 One of the flow charts of the method for virtual machine management provided in some embodiments of the present application;
[0026] Figure 3 An image file structure diagram provided for some embodiments of the present application;
[0027] Figure 4 A second flowchart of a method for virtual machine management provided in some embodiments of the present application;
[0028] Figure 5 A block diagram of a virtual machine management device provided in some embodiments of the present application;
[0029] Figure 6 A schematic diagram of an electronic device is provided for some embodiments of the present application. DETAILED DESCRIPTION
[0030] The technical solutions in some embodiments of the present application will be described below in conjunction with the drawings in some embodiments of the present application.
[0031] It should be noted that similar reference numerals and letters represent similar items in the following drawings, so once an item is defined in one drawing, it does not need to be further defined and explained in subsequent drawings. At the same time, in the description of this application, the terms "first", "second", etc. are only used to distinguish the description and cannot be understood as indicating or implying relative importance.
[0032] In the related technology, Trusted Execution Environment (TEE) refers to a security architecture feature provided by processor hardware, which can create and maintain an independent security area. The code and data running in this area are strictly isolated and protected, and the information stored in it can remain safe even if the system operating system or management software is maliciously attacked or tampered with. TEE is widely used in scenarios such as mobile devices, servers, and IoT devices. Technologies such as ARM TrustZone, Intel Software Guard Extensions (SGX), and AMD SecureEncrypted Virtualization (SEV) are typical trusted execution environment implementations. Current virtual machines rely on trusted execution environments when running. However, the memory encryption and isolation mechanisms used in existing technologies may cause certain performance losses, which will become performance bottlenecks for computing-intensive applications. Moreover, not all applications can seamlessly adapt to and utilize confidential virtual machine technology. Sometimes, existing applications may need to be reconstructed or modified to ensure that the advantages of confidential computing are properly utilized, which will bring huge application transformation costs.
[0033] In view of this, some embodiments of the present application provide a method for virtual machine management, in which from the perspective of the operating system running on the physical server, the virtual machine is a process, such as a qemu process. In order to protect the security of the virtual machine, it is divided into two parts: the outside and the inside of the virtual machine. The external operating environment (as a specific example of the first operating environment) is the operating system of the physical server where the virtual machine process is located; the internal operating environment (as a specific example of the second operating environment) is the operating environment of the operating system installed inside the virtual machine. The present application divides the internal structure of the physical server into a secure environment (that is, an internal operating environment) and a non-secure environment (that is, an external operating environment). The secure environment needs to rely on a trusted execution environment TEE, and the non-secure environment is an ordinary server operating system environment. Relevant data is read and calculated through modules in the secure environment and the non-secure environment to improve the security and performance of the virtual machine operation.
[0034] The following is combined with Figure 1 The overall composition structure of the virtual machine management system provided by some embodiments of the present application is exemplified.
[0035] like Figure 1As shown, some embodiments of the present application provide a system diagram of virtual machine management, in which the virtual machine management system (or hyper-converged architecture) includes a physical server and a distributed storage system. The physical server is divided into: a secure environment (as a specific example of the second operating environment) and a non-secure environment (as a specific example of the first operating environment). The non-secure environment includes: a secure and trusted module, a virtual machine management module, a virtual machine, a virtual hard disk protection module, and a process access module. The secure environment includes: a trusted agent module, an image verification module, a process whitelist module, a key module, and a hardware TEE for secure communication. Among them, the distributed storage system is used to store image files related to the virtual hard disk in the virtual machine.
[0036] In order to build a trustworthy and reliable operating foundation for the virtual machine, the two environments need to be initialized first.
[0037] Specifically, the five modules in the secure environment are started first. Among them, the key module is used to record the protection key, data encryption key and key information temporarily generated in the non-secure environment related to the virtual hard disk. The process whitelist module is used to record the executable program verification information that the virtual machine is allowed to run for each process access module. The image verification module is used to record the file verification value of the image file. When the virtual machine starts to mount the virtual hard disk, it is necessary to verify whether the virtual hard disk data has been tampered with. The trusted agent module is used to securely transmit relevant information. Virtual machines are allowed to migrate within the cluster, so reliable and secure transmission capabilities need to be established between physical servers in the cluster to transmit information such as image files, processes (i.e. executable programs), and keys between physical machines. After the four modules in the secure environment are started, the administrator writes the process whitelist table and key data of the three modules in the non-secure environment. Whether in a physical server or in a virtual machine, the process startup is controlled by the process access module. The process access module relies on the process whitelist module in the secure environment. The core of this module is the process whitelist table.
[0038] As a specific example, the process whitelist table is shown in Table 1:
[0039] Table 1
[0040]
[0041] The following is an explanation of each column of data in Table 1.
[0042] Access module ID: Both the physical server operating system and the virtual machine operating system only run one process access module; the access module ID uses the physical server number or the virtual machine number in the hyper-converged cluster according to the operating environment. Executable program path: The process is started by an executable program file. The path of the allowed executable program file in the operating system is recorded here. Checksum: The Md5 checksum of the executable program file to prevent tampering or replacement. Number of starts: The total number of processes started by the executable program. Permissions: With what permissions, user group or user to start the process.
[0043] After the virtual machine is shut down, you need to ensure that the data on the virtual hard disk (i.e., the image file) remains unchanged when you start it up next time. Figure 1 To improve the performance of the hyper-converged system, the distributed storage system runs in a non-secure environment. Therefore, the virtual hard disk protection module needs to calculate the file checksum of the image file when the virtual machine is shut down. When the virtual machine is started again, it is necessary to calculate the checksum of the current image file and compare it with the file checksum of the image file stored when it was shut down. Among them, the file checksum is calculated by the virtual hard disk protection module and recorded by the image checksum module of the secure environment. The form of the image checksum is shown in Table 2:
[0044] Table 2
[0045]
[0046] The image file may include a read-write layer, a read-only layer, and a layer to be merged generated under specific conditions.
[0047] The following describes the startup of related modules in a non-secure environment.
[0048] Specifically, the secure and trusted module in the non-secure environment is started when the physical server operating system is started. After the secure environment is initialized, it establishes a connection with the four modules in the secure environment. The secure and trusted module can obtain its own access rights (i.e., the process whitelist table) from the process whitelist module in the secure environment. If it is determined that the executable program is allowed to be accessed, the verification value of its own module is obtained from the key module and compared with the verification value recalculated by itself.
[0049] In one implementation, the verification value may be calculated using the MD5 (Message-Digest Algorithm) information digest algorithm: first, the MD5 value of the current executable program file content is calculated; the calculated MD5 is added to the executable program version information to calculate a secondary MD5 as the verification value.
[0050] After confirming that the security and trustworthy module has passed the verification through the above method, the necessary modules are initialized: the virtual machine management module, the process access module and the virtual hard disk protection module.
[0051] After completing the initialization of the secure environment and the non-secure environment in the above manner, the four main processes of creating, starting, running and shutting down the virtual machine can be carried out. Through the mutual cooperation between the modules in the above secure environment and the non-secure environment, the overall operating performance of the virtual machine can be improved under the premise of trustworthiness and reliability.
[0052] The following is combined with Figure 1 and attached Figure 2 The implementation process of virtual machine management (i.e., full life cycle management of virtual machine creation, startup, operation, and shutdown) provided by some embodiments of the present application is exemplified.
[0053] Please see attached Figure 2 , Figure 2 A flow chart of a method for virtual machine management is provided for some embodiments of the present application. The method for virtual machine management may include:
[0054] S210, in the process of creating a virtual machine in the first operating environment, obtaining an image file corresponding to the virtual hard disk.
[0055] For example, in some embodiments of the present application, the process of creating a virtual machine in a non-secure environment involves the creation of a virtual hard disk. Figure 1 The virtual hard disk in the provided hyper-converged architecture is provided by the distributed storage system. The virtual machine management module calls the distributed storage system interface to obtain an image file corresponding to the virtual hard disk. If the image file of the virtual hard disk already exists, it can be directly obtained from the distributed storage system; if the virtual hard disk is created for the first time, the corresponding image file can be created.
[0056] Specifically, in some embodiments of the present application, S210 may include: creating the image file, and generating key data related to the image file, wherein the key data is synchronized to the second operating environment for storage, and the key data includes: an access key and a data encryption key.
[0057] For example, in some embodiments of the present application, after the image file is created, the virtual hard disk protection module generates an access key and a data encryption key for the generated image file. Afterwards, the trusted agent module of the secure environment can synchronize the access key and the data encryption key to other modules in the cluster (e.g., the key module).
[0058] However, the image file corresponding to the virtual hard disk is usually large, usually tens of GB to hundreds of GB. If such a large file is to be verified later, the image file needs to be read once and calculated by the CPU, which consumes a lot of resources.
[0059] Therefore, in some embodiments of the present application, the image file includes: an initial read-write layer and an initial read-only layer; the virtual machine management method may also include: when the data volume of the initial read-write layer does not reach a preset threshold, when the virtual machine is shut down, calculating the data in the initial read-write layer and the initial read-only layer to obtain the file check value; when the data volume of the initial read-write layer reaches a preset threshold, when the virtual machine is shut down, creating a target read-write layer and a to-be-merged layer, wherein the to-be-merged layer stores the data of the initial read-write layer; merging the to-be-merged layer with the data in the initial read-only layer to obtain a target read-only layer; and obtaining the file check value by calculating the data in the target read-write layer and the target read-only layer.
[0060] For example, in some embodiments of the present application, Figure 3 When the virtual machine is running normally, the image file corresponding to the virtual hard disk is divided into two layers: a read-write layer and a read-only layer (i.e. Figure 3 The two boxes in the first column on the left are the initial read-write layer and the initial read-only layer. The read-write layer receives the write data of the process executed in the virtual machine (as a specific example of running data). When reading data, it starts from the read-write layer. If the read-write layer is empty, it reads from the read-only layer, thus forming an IO chain. When there is data in the upper layer (i.e., the read-write layer), it covers the data in the lower layer (i.e., the read-only layer).
[0061] When the amount of data in the read / write layer increases and reaches a preset threshold (for example, usually set to 8GB, 16GB, or 32GB), dynamic creation is adopted Figure 3 The layer to be merged and the new read-write layer in the second column (as a specific example of the target read-write layer, i.e. Figure 3 The permission of the layer to be merged is read-only. The number of files on the IO chain increases from two to three, and the read-write logic remains unchanged. The data in the layer to be merged will be combined with the data in the read-only layer and written to the new read-only layer (as a specific example of the target read-only layer, i.e. Figure 3 ), and calculate the file checksum of the new read-only layer and the read-write layer of this column (at this time, the read-write layer is empty). During the merging process, the read request still reads data according to the existing IO chain. After the merge is completed, the IO chain is modified, and the original layers to be merged and the read-only layer will be deleted. It can be understood that the number of layers to be merged can be generated as needed, and this application does not make specific limitations here.
[0062] From the structure of the above image file, it can be seen that the present application uses a method in which virtual machine images can be layered and superimposed, combined with the fact that the amount of new data written to the virtual hard disk of most virtual machines is not large, so that only incremental data (i.e., data in the new read-only layer) is verified to reduce the difficulty of verification.
[0063] S220, after the startup process of the virtual machine is verified and passed, the virtual machine is started.
[0064] For example, in some embodiments of the present application, after completing the above-mentioned creation operation, the administrator starts the virtual machine in the designated physical server, and after the virtual machine management module receives the start command, it verifies the start process to achieve safe startup of the virtual machine.
[0065] In some embodiments of the present application, S220 may include:
[0066] S221, calculating the verification value to be verified of the executable program, and comparing it with the corresponding target verification value in the process whitelist table, to confirm that the executable program has passed the verification.
[0067] For example, in some embodiments of the present application, the virtual machine startup actually starts the qemu process, so it is necessary to verify the virtualized executable program (such as qemu-system-x86), and the virtual machine management module obtains the target verification value of the virtualized executable program from the process whitelist module. After the calculated verification value of the executable program at startup is compared with the target verification value for consistency, it is determined whether the virtual machine is allowed to start. If they are consistent, it is confirmed that the current executable program has passed the verification and meets the condition for virtual machine startup.
[0068] S222, confirming that the data in the image file has passed verification.
[0069] For example, in some embodiments of the present application, in order to prevent data from being tampered with, it is necessary to verify the virtual hard disk data, that is, to verify the data in the corresponding image file.
[0070] In some embodiments of the present application, S222 may include: obtaining the image file information to be verified in the startup command of the virtual machine; confirming that the result of the verification calculation of the image file information to be verified is consistent with the file verification value, then the image file verification passes.
[0071] For example, in some embodiments of the present application, the image file information corresponding to the image file contained in the startup command is parsed (as a specific example of the image file information to be verified), and the verification values of each layer in the image file are obtained from the image verification module in the security environment (corresponding to Table 1). The layering of the image file is as follows: Figure 2 As shown in . The virtual hard disk protection module only verifies whether the image file data has been modified during the period from the last shutdown to the current startup. Specifically, the result of the verification calculation of the image file information to be verified is compared with the file verification value stored in the image verification module for consistency, and the verification is determined to be passed if they are consistent.
[0072] S223, obtaining the key data, and using the access key to mount the image file to the virtual machine; decrypting the data read from the virtual hard disk using the data encryption key to obtain decrypted data.
[0073] For example, in some embodiments of the present application, after the image file is verified, the access key and data encryption key of the image file are obtained from the key module through the secure and trusted module. The image file is mounted to the virtual machine using the access key through the virtual hard disk protection module. When the virtual machine is started (that is, the Qemu process is started), the data encryption key will be obtained from the virtual machine management module, data will be read from the virtual hard disk, and the decrypted data will be obtained by decrypting the data encryption key. For example, in the process of virtual startup, it is necessary to read data from the virtual hard disk (for example, loading the operating system). In order to ensure data security, the virtual hard disk data is encrypted, and the encrypted key is placed in the key module of the secure environment. It is necessary to obtain this data encryption key to decrypt the data read from the virtual hard disk. At this point, the process of secure startup of the virtual machine ends. Among them, the encryption method of the virtual hard disk data can be symmetric encryption or asymmetric encryption; the decrypted data can be an operating system or other basic data related to the operation of the virtual machine, which is not specifically limited in this application.
[0074] S230, after confirming that the program to be executed has passed the verification, the virtual machine runs the program to be executed and writes the running data into the image file; wherein, when the virtual machine is shut down, the file verification value corresponding to the image file is used to update to the second operating environment, so as to verify during the startup process and confirm that the data has not been tampered with.
[0075] For example, in some embodiments of the present application, after the virtual machine is started, it enters the running state. In order to build a secure and reliable internal environment of the virtual machine, it is necessary to control all processes running inside the virtual machine (as a specific example of a program to be executed), that is, it is necessary to verify and confirm that the process has passed, then allow the virtual machine to execute the relevant process, and give the running data of the process in the virtual machine to the image file.
[0076] In some embodiments of the present application, S230 may include: obtaining a process whitelist table from the second operating environment; confirming that the program to be executed is in the process whitelist table, and the check value of the program to be executed is consistent with the pre-stored check value, then the program to be executed passes the check. Wherein, the process whitelist table is pre-stored in the second operating environment, and the process whitelist table contains all programs allowed to run by the virtual machine; one program corresponds to one pre-stored check value.
[0077] For example, in some embodiments of the present application, since the virtual machine cannot directly communicate with the process whitelist module in the secure environment, it is necessary to use the process admission module in the non-secure environment of the physical server. Figure 1 The virtual serial port in the virtual machine is used to establish a communication mechanism, and the process access module obtains the process whitelist information in the process whitelist module of the virtual machine (as a specific example of the process whitelist table). In the virtual machine operating system, the HooK technology is used to check whether the process (that is, the program to be executed) is in the process whitelist table and whether the executable program check value matches before the process is started. The process startup of executable program files outside the process whitelist table and those that have been tampered with is not allowed. For example, it can be confirmed whether the program to be executed is in the process whitelist table. If it exists, the check value of the program to be executed is calculated, and the calculated check value is compared with the pre-stored check value corresponding to the program to be executed in the process whitelist table for consistency. If they are consistent, the program to be executed passes the check and the virtual machine can execute it.
[0078] In other words, once the program to be executed in the process whitelist is running, it is no different from running on a normal server, so there will be no additional performance loss. Since the physical server is controlled by the process access module, only processes (or programs) that are allowed to run by the administrator can be run in the physical server operating system, and the program is verified before running. If it is tampered with, it will not be able to run. The external running environment of the virtual machine process is reliable. Since there is also a process access module inside the virtual machine, only programs that are allowed to run by the administrator can be run inside the virtual machine, and they can run after verification, so the internal environment of the virtual machine is also reliable.
[0079] After the virtual machine is finished running, when the virtual machine is shut down, the Qemu process exits, and the virtual machine will no longer mount the image file in the distributed storage system. The image file is handed over to the virtual hard disk protection module for protection. During this protection period, if there is a layer to be merged in the image file, the layer to be merged is merged with the read-only layer, and then the file checksum value of the merged new read-only layer and read-write layer is calculated. If there is no layer to be merged, the checksum value of the read-write layer is calculated as the file checksum value. Finally, the newly calculated file checksum value is updated to the image checksum module, that is, the content of Table 2 is updated. After the merge and update are completed, the virtual hard disk protection module can release the image file.
[0080] The following is combined with Figure 1 and attached Figure 4 The specific process of virtual machine management provided by some embodiments of the present application is exemplified.
[0081] Please see attached Figure 4 , Figure 4 A flow chart of a method for virtual machine management is provided for some embodiments of the present application.
[0082] The above process is explained below as an example.
[0083] S401, during the virtual machine creation process, the distributed storage system interface is called through the virtual machine management module to obtain the image file corresponding to the virtual hard disk.
[0084] S402, the virtual hard disk protection module generates an access key and a data encryption key for the image file, and synchronizes them to the key module through the trusted agent module.
[0085] S403, obtaining the check value to be verified of the executable program, the virtual machine management module obtains the target check value of the executable program from the process whitelist module, and confirms that the check value to be verified is consistent with the target check value, and then passes the verification.
[0086] S404, obtaining the image file information to be verified in the startup command of the virtual machine; and obtaining the file verification value of the pre-stored image file from the image verification module.
[0087] S405: Confirm that the verification value of the image file information to be verified is consistent with the file verification value, and then pass the verification.
[0088] S406, obtaining the access key and data encryption key of the image file through the security and trusted module.
[0089] S407, using the access key to mount the image file to the virtual machine; decrypting the data read from the virtual hard disk using the data encryption key to obtain decrypted data, and completing the startup of the virtual machine.
[0090] S408, obtaining the program to be executed by the virtual machine; obtaining the process whitelist table in the process whitelist module through the process admission module.
[0091] S409, confirming that the program to be executed is in the process whitelist table, and confirming that the check value of the program to be executed is consistent with the pre-stored check value corresponding to the program in the process whitelist table.
[0092] S410, the virtual machine runs the program to be executed and sends the related running program to the image file; the image file reads and writes the running data.
[0093] S411, when the virtual machine is shut down, the mounted image file is unmounted; the virtual hard disk protection module performs a checksum operation on the image file to obtain an updated file checksum value.
[0094] Among them, the updated file verification value is stored in the image verification module. When the virtual machine is restarted later, it can be verified whether the data has been tampered with during the period from shutdown to startup to ensure that the virtual machine runs in a trusted and secure environment.
[0095] It should be noted that the specific implementation process of S401 to S411 can refer to the method embodiment provided above, and in order to avoid repetition, the detailed description is appropriately omitted here.
[0096] Through some of the above embodiments of the present application, it can be seen that a secure environment is built based on the hardware-based trusted execution environment TEE, and a non-secure environment is built based on a general physical server. The modules in the secure environment and the modules in the non-secure environment work together to build a trusted and reliable operating environment for virtual machines. The image file dynamic layering technology is used to reduce the overhead required for image file verification, reduce the virtual machine startup time, and speed up the calculation of image file verification values. Figure 1 The hyper-converged architecture provided ensures the reliability of the virtual machine throughout its life cycle, preventing the image data from being tampered with at any time. Under the premise of ensuring the reliability of the virtual machine, the performance degradation caused by the security mechanism is reduced. The reliable operating environment does not require the modification of the application, reducing the development cost.
[0097] Please refer to Figure 5 , Figure 5 The block diagram of the composition of the virtual machine management device provided by some embodiments of the present application is shown. It should be understood that the virtual machine management device corresponds to the above method embodiment and can execute each step involved in the above method embodiment. The specific functions of the virtual machine management device can be found in the description above. To avoid repetition, the detailed description is appropriately omitted here.
[0098] Figure 5 The virtual machine management device includes at least one software function module that can be stored in the memory in the form of software or firmware or solidified in the virtual machine management device, and the virtual machine management device includes: a creation module 510, configured to obtain an image file corresponding to a virtual hard disk during the process of creating a virtual machine in a first operating environment; a startup module 520, configured to start the virtual machine after verifying the startup process of the virtual machine; an execution module 530, configured to confirm that the virtual machine runs the program to be executed after the verification of the program to be executed has passed, and write the running data into the image file; wherein, when the virtual machine is shut down, the file check value corresponding to the image file is used to update to the second operating environment, so as to verify during the startup process to confirm that the data has not been tampered with.
[0099] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process of the device described above can refer to the corresponding process in the aforementioned method, and will not be described in detail here.
[0100] Some embodiments of the present application further provide a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, can implement the operations of the method corresponding to any of the above methods provided in the above embodiments.
[0101] Some embodiments of the present application further provide a computer program product, which includes a computer program, wherein when the computer program is executed by a processor, it can implement the operations corresponding to any of the above methods provided in the above embodiments.
[0102] like Figure 6 As shown, some embodiments of the present application provide an electronic device 600, which includes: a memory 610, a processor 620, and a computer program stored in the memory 610 and executable on the processor 620, wherein the processor 620 can implement a method as described in any of the above embodiments when reading the program from the memory 610 through a bus 630 and executing the program.
[0103] Processor 620 can process digital signals and can include various computing structures, such as complex instruction set computer structure, reduced instruction set computer structure, or a structure that implements a combination of multiple instruction sets. In some examples, processor 620 can be a microprocessor.
[0104] The memory 610 may be used to store instructions executed by the processor 620 or data related to the execution of instructions. These instructions and / or data may include codes for implementing some or all functions of one or more modules described in the embodiments of the present application. The processor 620 of the disclosed embodiment may be used to execute instructions in the memory 610 to implement the method shown above. The memory 610 includes a dynamic random access memory, a static random access memory, a flash memory, an optical memory, or other memory known to those skilled in the art.
[0105] The above description is only an embodiment of the present application and is not intended to limit the scope of protection of the present application. For those skilled in the art, the present application may have various changes and variations. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present application should be included in the scope of protection of the present application. It should be noted that similar reference numerals and letters represent similar items in the following drawings, so once an item is defined in one drawing, it does not need to be further defined and explained in the subsequent drawings.
[0106] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art who is familiar with the present technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
[0107] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the presence of other identical elements in the process, method, article or device including the elements.
Claims
1. A method for virtual machine management, characterized in that: include: In the process of creating a virtual machine in the first operating environment, obtaining an image file corresponding to the virtual hard disk; After the startup process of the virtual machine is verified and passed, the virtual machine is started; After confirming that the program to be executed has passed the verification, the virtual machine runs the program to be executed and writes the running data into the image file; When the virtual machine is shut down, the file checksum corresponding to the image file is used to update the second operating environment, so as to verify during the startup process to confirm that the data has not been tampered with.
2. The method according to claim 1, characterized in that The image file includes: an initial read-write layer and an initial read-only layer; the method further includes: When the amount of data in the initial read-write layer does not reach a preset threshold, when the virtual machine is shut down, the data in the initial read-write layer and the initial read-only layer are calculated to obtain the file check value; When the amount of data in the initial read-write layer reaches a preset threshold, when the virtual machine is shut down, a target read-write layer and a layer to be merged are created, wherein the layer to be merged stores the data of the initial read-write layer; Merging the data in the layer to be merged and the initial read-only layer to obtain a target read-only layer; The file check value is obtained by calculating the data in the target read-write layer and the target read-only layer.
3. The method according to claim 1 or 2, characterized in that The step of obtaining the image file corresponding to the virtual hard disk includes: The image file is created, and key data related to the image file is generated, wherein the key data is synchronized to the second operating environment for storage, and the key data includes: an access key and a data encryption key.
4. The method according to claim 3, characterized in that The checking of the startup process of the virtual machine includes: Calculate the check value to be checked of the executable program, and compare it with the corresponding target check value in the process whitelist table to confirm that the executable program has passed the check; Confirm that the data in the image file has passed verification; Obtain the key data, and use the access key to mount the image file to the virtual machine; The data read from the virtual hard disk is decrypted using the data encryption key to obtain decrypted data.
5. The method according to claim 4, characterized in that The confirming that the data in the image file has passed the verification includes: Obtaining the image file information to be verified in the startup command of the virtual machine; If it is confirmed that the result of the verification calculation of the image file information to be verified is consistent with the file verification value, the image file verification passes.
6. The method according to claim 1 or 2, characterized in that: The confirmation that the program to be executed has passed the verification includes: Obtain a process whitelist table from the second operating environment; If it is confirmed that the program to be executed is in the process whitelist table and the verification value of the program to be executed is consistent with the pre-stored verification value, then the verification of the program to be executed passes.
7. The method according to claim 6, characterized in that The process whitelist table is pre-stored in the second operating environment, and the process whitelist table contains all programs that the virtual machine is allowed to run; one program corresponds to one pre-stored check value.
8. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, wherein the computer program executes the method according to any one of claims 1 to 7 when executed by a processor.
9. An electronic device, characterized in that: The method comprises a memory, a processor, and a computer program stored in the memory and running on the processor, wherein the computer program executes the method according to any one of claims 1 to 7 when being run by the processor.
10. A computer program product, characterized in that The computer program product comprises a computer program, wherein the computer program executes the method according to any one of claims 1 to 7 when executed by a processor.
