Container safe operation method, storage medium, electronic equipment and program product

By performing double-layer verification of container images and programs to be executed, using the trusted execution environment and file verification value mechanism, the problem of file tampering security in container environment is solved, and containers with high security and low maintenance complexity are achieved run.

CN118885256APending Publication Date: 2024-11-01BEIJING TOPSEC NETWORK SECURITY TECH +2
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410915647.0
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

Technical Problem

The prior art is difficult to effectively ensure the tamper-proof security of files in container environments. Manually set file protection strategies are poor in flexibility and difficult to maintain, resulting in the inability to effectively guarantee security.

Method used

By verifying the container image, it is ensured that it has not been tampered with, and performing a two-layer verification of the execution program to ensure its security, and using a trusted execution environment and file verification value mechanism to achieve the safe operation of the container.

Benefits of technology

It improves the security of the container environment, reduces manual maintenance costs, improves overall operating performance, and is suitable for complex container cloud cluster environments.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118885256A_ABST
    Figure CN118885256A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of network security, and particularly provides a container security operation method, a storage medium, electronic equipment and a program product.The method can comprise the steps that verification of a container mirror image corresponding to a to-be-started container is confirmed to be passed, and the container is started; associated information of a to-be-executed program is obtained, and the associated information comprises the container to which the to-be-executed program belongs, a process program path, a process check value and a starting permission identifier; and verifying the to-be-executed program through the associated information, and controlling the container to run the to-be-executed program after confirming that the to-be-executed program passes the verification. Some embodiments of the invention can ensure the safety of container operation and improve the overall performance.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of network security technology, and in particular to a method for secure operation of a container, a storage medium, an electronic device, and a program product. Background Art

[0002] Kubernetes (abbreviated as K8s) is an open source container orchestration system for automating the deployment, expansion, and management of containerized applications. Among them, a container image is a layered software package that contains everything needed to run a certain software, including code, runtime, libraries, environment variables, and configuration files.

[0003] In order to ensure the security of the container environment and prevent the tampering of files under the container. At present, the file modification request initiated by the process is obtained; according to the relevant information in the request, the container instance identifier corresponding to the container instance to which the process belongs is calculated; through the container instance identifier, the file protection policy corresponding to the container instance is found; according to the file protection policy and the file path, it is determined whether to prevent the process from modifying the file to be modified. However, the file protection policy is set manually, and it can only protect specific files. It has poor flexibility, is difficult to maintain manually, and security cannot be effectively guaranteed.

[0004] Therefore, how to provide a technical solution for a method of running a container with higher security has become a technical problem that needs to be solved urgently. Summary of the invention

[0005] The purpose of some embodiments of the present application is to provide a method, storage medium, electronic device and program product for the safe operation of a container. The technical solutions of the embodiments of the present application can ensure the security of the container environment, improve the overall operating performance and reduce manual maintenance costs.

[0006] In a first aspect, some embodiments of the present application provide a method for secure operation of a container, including: confirming that a container image corresponding to a container to be started has passed verification, and starting the container; obtaining associated information of a program to be executed, wherein the associated information includes: the container to which the program to be executed belongs, the process program path, the process verification value, and the startup permission identifier; verifying the program to be executed through the associated information, and after confirming that the program to be executed has passed the verification, controlling the container to run the program to be executed.

[0007] In some embodiments of the present application, after the container image is verified and the container is started, the container is run only after the program to be executed is verified and passed, which can ensure the security of the container environment, improve the overall operating performance, and reduce manual maintenance costs.

[0008] In some embodiments, the confirmation that the container image corresponding to the container to be started has passed verification includes: determining that the container image exists in a trusted image table; calculating the target file in the read container image to obtain a value to be verified; and determining that the value to be verified is the same as the corresponding image verification value in the trusted image table, then the container image has passed verification.

[0009] Some embodiments of the present application compare the container image with the trusted image table and verify related files to confirm that the container image has not been tampered with, thereby improving security.

[0010] In some embodiments, before confirming that the container image corresponding to the container to be started has passed verification, the method also includes: calculating all current-level verification files under the directory structure corresponding to the newly added container image to generate a total container verification value, wherein the directory structure includes multiple levels of directories, each level of the directory includes a current-level verification file, and the current-level verification file includes the image verification value of all files under each level of the directory; packaging the newly added container image to obtain a target container image; registering the target container image, and updating it to the trusted image table.

[0011] Some embodiments of the present application calculate relevant check values ​​for files under a newly added container image, package them, and register them to obtain a target container image, which is updated to a trusted image table to provide support for subsequent container image security verification.

[0012] In some embodiments, the method further includes: when a file with a preset mark is opened within a process running in the container, when the container is abnormal, the original physical server to which the container belongs is abnormal, or a preset function is called, calculating the check value of the file and updating it to the current level check file corresponding to the file, and removing the preset mark; when the abnormalities of the container and the physical server are recovered and the preset function cannot be called, scanning all current level check files, and recalculating the check values ​​of files containing the preset mark.

[0013] Some embodiments of the present application provide support for container image security verification by updating the verification values ​​of files related to the container image.

[0014] In some embodiments, before calculating all current-level verification files under the directory structure corresponding to the newly added container image to generate the total container verification value, the method also includes: downloading the original container image and setting the original container image to a protection state; traversing and calculating all files in the original directory in the original container image to obtain the newly added container image and the directory structure.

[0015] Some embodiments of the present application obtain a newly added container image and a directory structure by protecting the downloaded original container image and performing related calculations, so that a trusted image table with higher security can be obtained later.

[0016] In some embodiments, verifying the program to be executed through the associated information to confirm that the program to be executed passes the verification includes: determining that the associated information is the same as content in a trusted program table, then the program to be executed passes the verification, wherein the trusted program table contains related programs that allow the container to run.

[0017] Some embodiments of the present application verify the program to be executed by comparing the associated information of the program to be executed with the trusted program table to ensure the security of the running program to prevent tampering.

[0018] In some embodiments, the method further includes: when the container is scheduled from the original physical server to which it belongs to to a target physical server for execution, after obtaining a remote certificate of the original physical server, the container image is sent from the original physical server to the target physical server.

[0019] Some embodiments of the present application can implement the scheduling of containers between different physical servers through remote attestation, saving time costs and improving overall performance.

[0020] In a second aspect, some embodiments of the present application provide a device for safe operation of a container, comprising: a startup verification module, configured to confirm that the container image corresponding to the container to be started has passed the verification, and start the container; an acquisition module, configured to obtain associated information of a program to be executed, wherein the associated information includes: the container to which the program to be executed belongs, the process program path, the process verification value and the startup permission identifier; an operation module, configured to verify the program to be executed through the associated information, and after confirming that the program to be executed has passed the verification, control the container to run the program to be executed.

[0021] 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.

[0022] 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.

[0023] 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

[0024] 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.

[0025] Figure 1 A system architecture diagram for secure operation of containers provided in some embodiments of the present application;

[0026] Figure 2 One of the flow charts of the method for safe operation of a container provided in some embodiments of the present application;

[0027] Figure 3 A schematic diagram of a directory structure provided for some embodiments of the present application;

[0028] Figure 4 A diagram showing the structure of the .ck_record file contents provided for some embodiments of the present application;

[0029] Figure 5 A diagram of a scheduling architecture for secure operation of containers provided in some embodiments of the present application;

[0030] Figure 6 A second flowchart of a method for secure operation of a container provided in some embodiments of the present application;

[0031] Figure 7 A block diagram of the apparatus for safe operation of a container provided in some embodiments of the present application;

[0032] Figure 8 A schematic diagram of an electronic device is provided for some embodiments of the present application. DETAILED DESCRIPTION

[0033] 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.

[0034] 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.

[0035] In the related technologies, the design goal of Kubernetes is to provide a platform that allows developers to define the deployment and services of applications in a declarative way, and the platform is responsible for managing the life cycle of these applications in an efficient and predictable way. Among them, once the container image is built, it is read-only, and any change to the image will create a new image. In addition, the container image adopts a layered structure and is cut into multiple smaller, reusable layers. Each layer contains the files and configuration information required to form the entire image, and these layers are stacked together in a certain order to form a complete image. Trusted execution environment technology is commonly used in container operation. Trusted Execution Environment (TEE) refers to a security architecture feature provided by processor hardware. It can create and maintain an independent security area. The code and data running in this area are strictly isolated and protected. Even if the system operating system or management software is maliciously attacked or tampered with, the information stored in it can remain safe. TEE is widely used in scenarios such as mobile devices, servers, and IoT devices. For example, technologies such as ARM TrustZone, Intel Software Guard Extensions (SGX), and AMD Secure Encrypted Virtualization (SEV) are typical trusted execution environment implementations.

[0036] At present, in order to prevent files from being tampered with in a container environment, a specific file protection strategy is used to process related files to improve the accuracy of file anti-tampering detection in a multi-container instance environment. However, this solution needs to intercept and process each write request for file IO, which will greatly reduce the write performance of the file. Setting a protection strategy for files can only prevent the process specified by the strategy from modifying specific files, which has poor flexibility. The more files that need to be protected, the more complex the strategy, and the more difficult it is to maintain manually. It can be seen from the above-mentioned related technologies that in the prior art, each modification request for a file is monitored, and the performance loss increases with the number of files and processes. The configuration strategy brought about by the protection strategy based on files and processes is relatively complex. The file protection strategy is not suitable for complex container cloud cluster environments, and its security needs to be improved.

[0037] In view of this, some embodiments of the present application provide a method for safe operation of a container, which can first perform a security check on the container image, start the container after the check passes, then check the program to be executed, and execute the program to be executed by the container under the condition that safety is met. Through the double-layer check of the container image and the program to be executed, the safety of the container running in the environment can be ensured, the overall operating performance is not affected, the maintenance complexity is low, and the cost is saved.

[0038] The container cloud platform is a cluster system (usually a Kubernetes cluster) composed of multiple physical servers. The container runs on the physical servers in the cluster and can be freely scheduled within the cluster. The operating environment of the container is provided by the physical server, so it is easy to tamper with the container image and invade the container in the physical server operating system. Therefore, in order to ensure the security of the container's operating environment, this application implements the safe operation of the container in the cluster based on the trusted execution environment, and the data and operating environment are not tampered with.

[0039] The following is combined with Figure 1 The overall composition structure of the system architecture for secure operation of containers provided by some embodiments of the present application is exemplified.

[0040] like Figure 1 As shown, some embodiments of the present application provide a system architecture diagram for secure operation of containers, and the system architecture for secure operation of containers divides the physical server into a secure environment and a non-secure environment. Among them, the secure environment is based on the trusted execution environment TEE hardware implementation; the non-secure environment is the normal operating system operating environment of the physical server. In a non-secure environment, the container cloud platform uses kubelet to manage containers. Applications (i.e., programs to be executed, that is, processes) run in containers.

[0041] In practical applications, the security of the container environment needs to focus on the security of the container image and the container operating environment. The container image needs to be protected from being tampered with or injected with malicious code. The security of the container operating environment needs to prevent the container from being invaded during the running process. Figure 1 It can be seen that in order to ensure security in a secure environment, a trusted agent module, a process control module and an image verification module are provided inside. The insecure environment includes a container environment protection module and an image protection kernel module. Specifically, the image verification module can record registered trusted container images (that is, the trusted image table), and only registered images can create containers. The process control module can record programs that are allowed to be started in an insecure environment of the local physical server. The trusted agent module is responsible for remote attestation between the secure environments of the container cluster and realizes container scheduling. The image protection kernel module can be implemented through eBPF technology, acting between the kernel-state VFS and the layered file system, and interacting with the user-state process (that is, Figure 1 The container environment protection module can realize the overall control of container image verification, packaging, registration and other related processes of the container running process.

[0042] It is understandable that a cluster may contain multiple physical servers. Figure 1 This article will use a physical server in the example to illustrate.

[0043] The following is combined with Figure 1 and attached Figure 2 The implementation process of secure operation of containers provided by some embodiments of the present application is exemplified.

[0044] Please see attached Figure 2 , Figure 2 A flow chart of a method for secure operation of a container provided for some embodiments of the present application, the method for secure operation of a container may include:

[0045] S210, confirming that the container image corresponding to the container to be started has passed verification, and starting the container.

[0046] For example, in some embodiments of the present application, in a non-secure environment of a physical server, in order to ensure the security of the container image, only trusted container images are allowed to be used to create containers. Therefore, the container image needs to be security checked first before the container can be started.

[0047] In some embodiments of the present application, before executing S210, the method for secure operation of the container may include: downloading the original container image and setting the original container image to a protection state; traversing and calculating all files in the original directory in the original container image to obtain the newly added container image and the directory structure.

[0048] For example, in some embodiments of the present application, after kubelet completes downloading the original container image, the image protection kernel module sets the original container image to a protected state, that is, other programs except the container environment protection module are not allowed to read or write the container image content. The image protection kernel module notifies the container environment protection module to add a new container image, and scans the original container image to obtain the directory structure of the new container image.

[0049] In some embodiments of the present application, before executing S210, the method for safe operation of the container may include: calculating all current-level verification files under the directory structure corresponding to the newly added container image to generate a total container verification value, wherein the directory structure includes multiple directories, each directory includes a current-level verification file, and the current-level verification file includes the image verification value of all files under each directory; packaging the newly added container image to obtain a target container image; registering the target container image, and updating it to the trusted image table.

[0050] Specifically, the container environment protection module needs to generate the verification value of the original container image when scanning the original container image for the first time. The verification value of the original container image can be calculated using common verification algorithms such as MD5, SHA1, and CRC32. The directory structure after the calculation is completed is as follows Figure 3 As shown, before scanning each level of directory, a .ck_record file is generated in the directory of this level (as a specific example of the verification file of this level), and then the image verification values ​​of all files in the directory of this level are calculated and temporarily recorded in the .ck_record file. After the calculation of all directories is completed, the .ck_record file needs to be calculated twice to obtain the total verification value of the container.

[0051] The following is combined with Figure 3 and attached Figure 4 The .ck_record file content structure diagram is shown in the figure, and the specific process of obtaining the total checksum value of the container is exemplified.

[0052] ① The container environment protection module scans all files in the directory at this level and writes the file name, checksum value and timestamp of the calculation and check completion into the [files] section of the .ck_record file.

[0053] ② Enter each subdirectory of the current directory one by one, repeat step ①, and calculate the checksum of the file until all directories have been scanned and calculated in step ①.

[0054] ③ Use depth-first traversal of all directories to Figure 3 For example, the traversal order is directory 1-1-1, directory 1-1, directory 1, directory 2-1, directory 2, and root directory.

[0055] ④ First traverse to directory 1-1-1 and start calculating the validation value in [summary], that is, concatenate the verification values ​​in all [directories] and [files] and perform a secondary calculation to obtain the value, and record the update time in updated.

[0056] ⑤Then traverse to directory 1-1. Because the checksum of directory 1-1-1 has been calculated, the validation in the .ck_record file of directory 1-1-1 is recorded in [directories] in the .ck_record file of directory 1-1. The checksum and update time of directory 1-1-1 are recorded in [directories].

[0057] ⑥ Calculate the root directory step by step according to the traversal order of ③, repeat ④ and ⑤ to complete the entire calculation process. The final calculated root directory checksum value is the total container checksum value.

[0058] After the above calculation, compared with the original container image, all directories of the newly added container image have added .ck_record files. After that, the newly added container image is packaged to generate the target container image, and registered with the image verification module in the secure environment. After the registration is completed, it becomes a trusted container image, which is updated to the trusted image table managed by the image verification module. Among them, the trusted image table includes: Image ID: UUID of the newly packaged target container image, kubelet uses this ID to create the corresponding container; original image name: the name of the original image in the image warehouse. Image verification value: the content of the validation field in the .ck_record file. Update time: the content of the updated field in the .ck_record file.

[0059] After the above registration is completed, delete the original container image and rename the newly packaged target container image to the original image name to complete the image replacement. When creating subsequent containers, use the image name. When creating a container, before actually reading the container image data, the container environment protection module needs to verify whether the container image specified for startup is in the trusted image table, and only allows the use of images in the table.

[0060] Since the container image needs to be quickly verified when the container is started. If you need to check whether the container image has been modified when the container is started, it may take several minutes or even tens of minutes to scan the entire image (the duration depends on the size of the container image and the disk IO performance). However, the long time consumption is unacceptable for containers, so another method is needed to quickly verify whether the container image has been tampered with. Considering that the container image is a layered structure, only the top layer is a read-write layer, and the layers below are read-only, but this read-only is only guaranteed at the file system level. If the file system is bypassed, the read-only restriction is invalid.

[0061] In order to improve the verification efficiency of the container image, in some embodiments of the present application, S210 may include: determining that the container image exists in a trusted image table; calculating the target file in the read container image to obtain a value to be verified; determining that the value to be verified is the same as the corresponding image verification value in the trusted image table, and then the container image verification passes.

[0062] For example, in some embodiments of the present application, when the container is started (i.e., during the process of starting the container), it is checked whether the content of the container image has been tampered with, and the file post-verification technology is used, that is, when a certain file in the container image is read for the first time (as a specific example of the target file), the file is verified. Specifically, the image protection kernel module intercepts the file opening action, taking the Linux operating system as an example, that is, the system's call function open is intercepted. If the open object is a directory, no operation is performed; if it is a file, the file's verification value is calculated. After that, it is compared with the file verification value (i.e., the image verification value) recorded in the .ck_record file of the current directory to which the file belongs. If they are the same, the open function returns normally and the verification passes, otherwise reading and writing the file is prohibited.

[0063] In some embodiments of the present application, the method for safe operation of a container may include: when a file with a preset mark is opened within the process running the container, when the container is abnormal, the original physical server to which the container belongs is abnormal, or a preset function is called, calculating the check value of the file and updating it to the current level check file corresponding to the file, and removing the preset mark; when the abnormalities of the container and the physical server are recovered and the preset function cannot be called, scanning all current level check files, and recalculating the check values ​​of files containing the preset mark.

[0064] For example, in some embodiments of the present application, when a process in a container opens a file, the open is called with a writable parameter, and the container environment protection module records these files. Figure 4 The last dirty flag on the right side of the equal sign of file2 in [files] in the container environment protection module will verify the recorded files and use the above-mentioned Figure 3 and Figure 4The corresponding calculation method updates the relevant .ck_record file. Specifically, when the process actively calls the close function, the checksum of the file is directly calculated, and then the checksum and update time of the file in the .ck_record file are updated, and the dirty flag is removed. If the process or container crashes and the physical server recovers after a crash, the process cannot actively call the close function. The crash event will trigger the container environment protection module to scan all .ck_record files in the container image and recalculate the files marked as dirty.

[0065] After completing the above verification, after the container in the physical server is started, as long as the processes running inside and outside the container obtain access rights, they can tamper with the contents of the container image, which brings hidden dangers to the container operating environment. In order to prevent malicious programs from invading and tampering with the container contents from inside and outside the container, the present application also proposes a trusted program access method, and the process control module records a trusted program table. Among them, the trusted program table includes: container ID: a unique ID generated when the container is created, or -1 indicates that it is a process in the host machine; program path: the path of the program executable file in the container or host machine; program checksum: the md5 value of the program executable file; physical server ID: the container cloud is a cluster system, and the trusted program table is the physical server where the container / process is running. Permission ID: the user group and user specified when starting the program, such as gid:uid.

[0066] The container environment protection module and kubelet cooperate with each other to only allow programs in the trusted program table in the process control module to run in the non-secure environment of the physical server. For example, the cooperation with process No. 1 in the container (for example, the executable program specified when the container is created) only allows programs in the trusted program table in the process control module to run in the container in the non-secure environment. The trusted program table is manually authorized and maintained by the administrator. Unauthorized programs cannot be started in a non-secure environment. Only reasonable and legal authorizations need to be manually guaranteed. Malicious programs are allowed to run, and no files in the container environment can be tampered with. Alternatively, the trusted program table can be automatically monitored and maintained by related applications. By detecting whether there are malicious programs, tampering prevention is achieved to avoid the running of malicious programs.

[0067] The following is an example of the verification process of the program to be executed.

[0068] S220, obtaining association information of the program to be executed, wherein the association information includes: the container to which the program to be executed belongs, a process program path, a process check value, and a start permission identifier.

[0069] For example, in some embodiments of the present application, starting a process in a non-secure environment of a physical server or starting a process inside a container essentially creates a process in a non-secure environment of a physical server. The container environment protection module intercepts the process creation function through eBPF (as a specific example of a program to be executed) and obtains the following associated information: the container to which the current process belongs (it can also be directly running on the physical server), the program path to start the process, calculate its md5 checksum (as a specific example of a process checksum) and the startup permission ID (as a specific example of a startup permission identifier). The above-mentioned associated information is passed to the process control module for judgment and verification.

[0070] S230: Verify the program to be executed by using the associated information, and after confirming that the program to be executed passes the verification, control the container to run the program to be executed.

[0071] For example, in some embodiments of the present application, the process control module queries and compares a trusted program table in a storage executable environment based on the associated information to confirm whether the process is allowed to start.

[0072] In some embodiments of the present application, S230 may include: if it is determined that the association information is the same as the content in the trusted program table, then the program to be executed passes the verification, wherein the trusted program table contains related programs that allow the container to run.

[0073] For example, in some embodiments of the present application, if the associated information exists in the trusted program table, the process is executed, otherwise it is not executed.

[0074] It should be noted that the trusted image table and the trusted program table mentioned above can be set according to the actual application scenario, and the embodiment of the present application does not make any specific limitation here.

[0075] In some embodiments of the present application, the method for secure operation of a container may include: when the container is scheduled from the original physical server to which it belongs to to a target physical server for operation, after obtaining remote proof of the original physical server, the container image is sent from the original physical server to the target physical server.

[0076] For example, in some embodiments of the present application, the container cloud is a cluster system, and the container can be managed and scheduled to any physical server in the cluster. Due to the technical content provided in the present application, it is necessary to verify the container image, add verification files, repackage, etc. When the container is scheduled to run on another physical server, such as Figure 5As shown in the figure, the startup time is still relatively slow. In order to avoid the time-consuming scanning and computing packaging, the container environment protection module completes the remote attestation to the original physical server through the trusted proxy module of the local security environment, and Figure 5 The container image A (i.e., process 1, the container image that has been verified and packaged) of the physical server A in the target server ( Figure 5 The physical server B) does not need to download the original container image from the image repository, thus avoiding the time-consuming stage.

[0077] The following is combined with Figure 6 The specific process of safe operation of the container provided by some embodiments of the present application is exemplified.

[0078] Please see attached Figure 6 , Figure 6 A flow chart of a method for secure operation of a container provided for some embodiments of the present application.

[0079] The above process is explained below as an example.

[0080] S601, download the original container image, and set the original container image to a protected state.

[0081] S602: Traverse and calculate all files in the original directory in the original container image to obtain a new container image and directory structure.

[0082] S603: Calculate all the current-level verification files under the directory structure corresponding to the newly added container image to generate a total container verification value.

[0083] S604: Package the newly added container image to obtain a target container image.

[0084] S605: Register the target container image and update it to the trusted image table.

[0085] S606, determine that the container image exists in the trusted image table, confirm that the to-be-verified value of the read target file is the same as the corresponding image verification value in the trusted image table, and start the container.

[0086] S607, obtaining the associated information of the program to be executed.

[0087] S608: If it is determined that the associated information is the same as the content in the trusted program table, the program to be executed passes the verification.

[0088] S609: The container runs the program to be executed.

[0089] It is understandable that in the above process of checking the container image and the program to be executed, if the check fails, there is a risk of tampering, and the subsequent related operations are stopped at this time to ensure the security of the running container environment. Specifically, the specific implementation process of S601 to S609 can refer to the method embodiment provided above, and the detailed description is appropriately omitted here to avoid repetition.

[0090] Through some of the above embodiments of the present application, it can be seen that the present application establishes a set of trusted container operating environment in a common physical server operating environment. The security of the container image is guaranteed during the container life cycle, and the container image file is effectively prevented from being tampered with. The anti-tampering mechanism is applicable to the entire container cluster and does not affect the scheduling function of the container cloud. It is both time-saving and safe, and the overall operating performance is high.

[0091] Please refer to Figure 7 , Figure 7 The block diagram of the components of the device for safe operation of a container provided by some embodiments of the present application is shown. It should be understood that the device for safe operation of a container corresponds to the above method embodiment and can execute each step involved in the above method embodiment. The specific functions of the device for safe operation of a container can be found in the description above. To avoid repetition, the detailed description is appropriately omitted here.

[0092] Figure 7 The device for safe operation of a container includes at least one software function module that can be stored in a memory in the form of software or firmware or solidified in the device for safe operation of a container, and the device for safe operation of a container includes: a startup verification module 710, configured to confirm that the container image corresponding to the container to be started has passed the verification and start the container; an acquisition module 720, configured to obtain the associated information of the program to be executed, wherein the associated information includes: the container to which the program to be executed belongs, the process program path, the process verification value and the startup permission identifier; an operation module 730, configured to verify the program to be executed through the associated information, and after confirming that the program to be executed has passed the verification, control the container to run the program to be executed.

[0093] In some embodiments of the present application, the verification module 710 is started and configured to determine whether the container image exists in the trusted image table; calculate the target file in the read container image to obtain a value to be verified; and determine that the value to be verified is the same as the corresponding image verification value in the trusted image table, then the container image verification passes.

[0094] In some embodiments of the present application, before starting the verification module 710, the device for safe operation of the container also includes: an update registration module (not shown in the figure) is configured to: calculate all current-level verification files under the directory structure corresponding to the newly added container image to generate a total container verification value, wherein the directory structure includes multiple directories, each directory includes a current-level verification file, and the current-level verification file includes the image verification value of all files under each directory; package the newly added container image to obtain a target container image; register the target container image, and update it to the trusted image table.

[0095] In some embodiments of the present application, the update registration module (not shown in the figure) is configured to: download the original container image and set the original container image to a protected state; traverse and calculate all files in the original directory in the original container image to obtain the newly added container image and the directory structure.

[0096] In some embodiments of the present application, the device for safe operation of the container also includes: an exception handling module (not shown in the figure), which is configured to: when a file with a preset mark is opened within the process running the container, when the container is abnormal, the original physical server to which the container belongs is abnormal, or a preset function is called, calculate the check value of the file, and update it to the current level check file corresponding to the file, and remove the preset mark; when the abnormality of the container and the physical server is recovered and the preset function cannot be called, scan all current level check files, and recalculate the check value of the file containing the preset mark.

[0097] In some embodiments of the present application, the running module 730 is configured to determine that if the associated information is the same as the content in the trusted program table, then the program to be executed passes the verification, wherein the trusted program table contains related programs that allow the container to run.

[0098] In some embodiments of the present application, the device for secure operation of the container also includes: a scheduling module (not shown in the figure), which is configured to: when the container is scheduled from the original physical server to which it belongs to to the target physical server for operation, after obtaining the remote certificate of the original physical server, send the container image from the original physical server to the target physical server.

[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 8 As shown, some embodiments of the present application provide an electronic device 800, which includes: a memory 810, a processor 820, and a computer program stored in the memory 810 and executable on the processor 820, wherein the processor 820 can implement a method as described in any of the above embodiments when reading the program from the memory 810 through a bus 830 and executing the program.

[0103] Processor 820 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 820 can be a microprocessor.

[0104] The memory 810 may be used to store instructions executed by the processor 820 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 820 of the disclosed embodiment may be used to execute instructions in the memory 810 to implement the method shown above. The memory 810 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 existence of other identical elements in the process, method, article or device including the elements.

Claims

1. A method for safe operation of a container, characterized in that: include: Confirm that the container image corresponding to the container to be started has passed verification, and start the container; Acquire the associated information of the program to be executed, wherein the associated information includes: the container to which the program to be executed belongs, the process program path, the process check value and the start permission identifier; The program to be executed is verified by using the associated information, and after confirming that the program to be executed passes the verification, the container is controlled to run the program to be executed.

2. The method according to claim 1, characterized in that The step of confirming that the container image corresponding to the container to be started has passed verification includes: Determining that the container image exists in a trusted image table; Calculate the target file in the read container image to obtain a value to be verified; If it is determined that the value to be verified is the same as the corresponding image verification value in the trusted image table, then the container image verification passes.

3. The method according to claim 2, characterized in that Before confirming that the container image corresponding to the to-be-started container has passed verification, the method further includes: Calculate all current-level verification files under the directory structure corresponding to the newly added container image to generate a total container verification value, wherein the directory structure includes multiple levels of directories, each level of the directory includes a current-level verification file, and the current-level verification file includes the image verification values ​​of all files under each level of the directory; Packaging the newly added container image to obtain a target container image; Register the target container image and update it to the trusted image table.

4. The method according to claim 3, characterized in that The method further comprises: When a file with a preset mark is opened in a process running in the container, when the container is abnormal, the original physical server to which the container belongs is abnormal, or a preset function is called, a checksum value of the file is calculated and updated to the current level checksum file corresponding to the file, and the preset mark is removed; When the abnormal recovery of the container and the physical server fails and the preset function cannot be called, all verification files at this level are scanned, and the verification values ​​of the files containing the preset mark are recalculated.

5. The method according to any one of claims 3 to 4, characterized in that: Before calculating all the current-level verification files under the directory structure corresponding to the newly added container image to generate the total container verification value, the method further includes: Downloading the original container image and setting the original container image to a protected state; All files in the original directory in the original container image are traversed and calculated to obtain the newly added container image and the directory structure.

6. The method according to any one of claims 1 to 4, characterized in that The verifying the program to be executed by using the associated information to confirm that the program to be executed passes the verification includes: If it is determined that the association information is the same as the content in the trusted program table, then the program to be executed passes the verification, wherein the trusted program table contains related programs that allow the container to run.

7. The method according to any one of claims 1 to 4, characterized in that The method further comprises: When the container is dispatched from the original physical server to which it belongs to to the target physical server for operation, after obtaining the remote certificate of the original physical server, the container image is sent from the original physical server to the target physical server.

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.