A container security execution method, device and storage medium

By introducing a master and sub-monitoring mechanism based on SGX into Docker containers, the problems of uncontrolled container image integrity and resource usage are solved, achieving full-process security management and isolation, and reducing hardware costs.

CN114662092BActive Publication Date: 2025-12-16INSPUR SUZHOU INTELLIGENT TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210425621.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-04-22
Publication Date
2025-12-16
Estimated Expiration
2042-04-22

AI Technical Summary

Technical Problem

Existing technologies lack end-to-end security protection in Docker containers, especially during image download, storage, and operation, where integrity attacks are risky, resource usage is uncontrolled, computing resources are squeezed out, and hardware costs are high.

Method used

The system employs a master and sub-monitoring mechanism based on SGX to manage the entire container system. Through measures such as integrity measurement, encrypted storage, and resource restrictions, it ensures the integrity and secure startup of container images, limits inter-container communication, and monitors resource usage and process behavior.

Benefits of technology

It enables end-to-end security management of container systems, prevents image tampering and resource hogging, improves isolation and security between containers, and reduces hardware costs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114662092B_ABST
    Figure CN114662092B_ABST
Patent Text Reader

Abstract

The application provides a container security execution method, device and storage medium, wherein the method comprises the following steps: establishing a main monitoring and a plurality of sub-monitorings based on an SGX, and managing a container through the main monitoring and the plurality of sub-monitorings; in response to the first start of a container system, performing integrity measurement on a structural file of the container system, calculating an integrity measurement value of the structural file of the container system, and saving the integrity measurement value as an integrity measurement base value of the container system to the main monitoring. The application solves the problem that containers in a same Network Namespace can access each other, solves the isolation problem between containers, limits the access ability of other containers to a runtime container by setting a container network whitelist, and prevents malicious attack behaviors of untrusted containers. The application solves the integrity and legality verification of a container runtime code segment and a stack function return address, and prevents problems such as tampering of the container runtime code segment and overflow of the stack function return address.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application belongs to the field of computer, and particularly relates to a container security execution method, device and storage medium. BACKGROUND

[0002] With the rapid development of Internet technology and big data, cloud computing technology has become the mainstream computing method. More and more enterprises and users choose cloud computing as the primary computing and storage method. Among them, virtual machine and container are two main virtual machine technologies in cloud computing. The container technology is a lightweight virtualization solution, and multiple containers share an operating system kernel. The container includes its dependent system environment and the application to be deployed, and the size of the container is generally only tens to hundreds of MB. In the container technology, the Docker container is more popular among enterprises. The Docker container has the advantages of faster interaction and deployment, more efficient resource utilization, easier expansion and migration, and simpler update management. Docker can package programs and related dependent files into a portable container, which can be published in any environment.

[0003] With the rapid development of Docker, its security problems have attracted widespread attention. Generally, Docker shares a Linux kernel, so that the container is subject to escape attacks. Docker images may be tampered with and stolen during downloading and storage; and Docker containers may be subject to integrity attacks such as program tampering and injection during running.

[0004] The prior art solution only protects a certain link in the whole process of Docker. The security of the Docker image is protected, and the integrity of the container image is verified, but there is a lack of comparison and verification of the integrity value of the official website, and a lack of encrypted storage function. The use of resources by the container is limited by Cgroup, but there is a lack of overall planning, which may cause excessive use of computing, memory and disk resources by a certain application, thereby occupying the resources of other applications in the shared host and making them unable to normally provide services. At the same time, the existing technology measures the integrity of the runtime program, generally assisted by TPM, which requires an increase in hardware cost. SUMMARY

[0005] To solve the above problems, the present application provides a container security execution method, which comprises:

[0006] Establishing a main monitoring and multiple sub-monitorings based on SGX, and managing the container through the main monitoring and multiple sub-monitorings;

[0007] In response to the first start of the container system, the structural file of the container system is subjected to integrity measurement, the integrity measurement value of the structural file of the container system is calculated, and the integrity measurement value is saved as the integrity measurement base value of the container system to the main monitor.

[0008] In some embodiments of the application, the management of the container by the main monitor and the plurality of sub-monitors comprises:

[0009] The main monitor creates a container image management tree, a container application tree and a sub-monitor registration tree according to the container system.

[0010] In some embodiments of the application, the method further comprises:

[0011] In response to the non-first start of the container system, the main monitor obtains the structural file of the container system, subjects the obtained structural file to integrity measurement and calculates the corresponding integrity measurement value, and performs consistency verification on the calculated integrity measurement value and the integrity measurement base value of the container system in the main monitor, and allows the container system to run in response to the passing of the verification.

[0012] In some embodiments of the application, the method further comprises:

[0013] The image integrity measurement value is obtained from the image repository, and the image integrity measurement value is saved as the image measurement base value to the image management tree;

[0014] The corresponding image is downloaded from the image repository, and the integrity measurement value of the image is calculated by the sub-monitor or the main monitor, and the calculated integrity measurement value is subjected to consistency verification with the integrity measurement value contained in the image and the image measurement base value in the image management tree;

[0015] In response to the passing of the consistency verification, the main monitor generates a derived key according to the container features, encrypts the image by the derived key and saves it to the local.

[0016] In some embodiments of the application, the method further comprises:

[0017] The main monitor creates a sub-monitor, the main monitor authenticates the sub-monitor through the remote attestation mechanism of SGX, adds the ID and attestation information of the sub-monitor to the sub-monitor registration tree, and adds the ID of the sub-monitor to the container application tree;

[0018] The sub-monitor obtains the integrity measurement value of the image of the corresponding container from the main monitor, and writes the integrity measurement base value of the image of the container into the container information structure of the sub-monitor;

[0019] The sub-monitoring requests the main monitoring to decrypt the image of the container, and calculates the integrity measurement value of the decrypted image, and performs consistency check with the integrity measurement base value written in the sub-monitoring container information structure and the integrity measurement value contained in the image;

[0020] In response to the consistency check passing, the sub-monitoring manages the startup of the container.

[0021] In some embodiments of the present application, the sub-monitoring manages the startup of the container, comprising:

[0022] The sub-monitoring creates a startup rule black and white list according to the preset configuration parameters of the container, monitors the startup parameters passed when the container system starts the container, and matches and verifies the startup parameters with the rules in the startup rule black and white list;

[0023] In response to the verification matching being successful, the sub-monitoring creates the resource limitation information of the container and writes it into the container information structure; and

[0024] The sub-monitoring creates a communication rule black and white list according to the security requirements of the container, and limits the network communication of the container through the communication rule black and white list.

[0025] In some embodiments of the present application, the method further comprises:

[0026] In response to the container running, the sub-monitoring manages the communication of the application process and the container process in the container through the communication rule black and white list;

[0027] The sub-monitoring manages the resource access behavior of the container through the resource limitation information in the container information structure.

[0028] In some embodiments of the present application, the method further comprises:

[0029] The sub-monitoring calculates the integrity measurement of the file loaded by the container process and saves the calculation result as the integrity measurement base value in the container information structure of the sub-monitoring;

[0030] In response to the container running, the sub-monitoring monitors the file loaded by the process when the container runs and calculates the integrity measurement value, and performs consistency check with the integrity measurement base value in the container information structure of the sub-monitoring;

[0031] In response to the consistency check passing, the container is allowed to run; and

[0032] The sub-monitoring creation process function filter filters the return addresses of all process functions of the container, and stops the process of the container or the container in response to an exception of the process function return address.

[0033] at least one processor; and

[0034] The memory stores computer instructions executable on the processor, and the instructions, when executed by the processor, implement the steps of the method of any one of the above embodiments.

[0035] In another aspect of the present application, a computer readable storage medium is provided, which stores a computer program, and the computer program, when executed by a processor, implements the steps of the method of any one of the above embodiments.

[0036] The present application provides a container security execution method. The method solves the whole process management and protection method of container system startup, image management, container startup, and container running. The monitoring program of the whole process management and protection process of the container is placed in the enclave of SGX, and the whole process monitoring security is realized. Before the container system starts, the problems of attack and tampering of the container executable file, key configuration file, static link library, and dynamic link library are solved. The container image download integrity problem is solved, and protection measures such as container image download integrity verification, encrypted storage, and startup time integrity verification are implemented. The problem that containers in the same Network Namespace can access each other is solved, and the isolation problem between containers is solved. By setting a container network whitelist, the access ability of other containers to the running container is limited, and the malicious attack behavior of untrusted containers is prevented. The integrity and legality of the container runtime code segment and the stack function return address are verified, and the problems of tampering of the container runtime code segment and overflow of the stack function return address are prevented. BRIEF DESCRIPTION OF DRAWINGS

[0037] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the drawings needed in the embodiment or prior art description will be briefly introduced below. Obviously, the drawings in the following description are only some embodiments of the present application, and those skilled in the art can obtain other drawings according to these drawings without creative labor.

[0038] Figure 1 A flowchart of a container security execution method provided by an embodiment of the present application is provided.

[0039] Figure 2An embodiment schematic diagram of a container security execution method provided by an embodiment of the present application is provided;

[0040] Figure 3 An embodiment schematic diagram of a mirror management tree of a container security execution method provided by an embodiment of the present application is provided;

[0041] Figure 4 An embodiment structural schematic diagram of a computer device provided by an embodiment of the present application is provided;

[0042] Figure 5 An embodiment structural schematic diagram of a computer readable storage medium provided by an embodiment of the present application is provided. DETAILED DESCRIPTION

[0043] In order to make the purpose, technical scheme and advantages of the present application more clear, the embodiments of the present application are further described in detail below, and reference is made to the accompanying drawings.

[0044] As Figure 1 shown, the present application provides a container security execution method, comprising:

[0045] Step S1, establishing a main monitoring and a plurality of sub-monitorings based on SGX, and managing containers through the main monitoring and the plurality of sub-monitorings;

[0046] Step S2, in response to the first start of a container system, performing integrity measurement on a structural file of the container system, calculating an integrity measurement value of the structural file of the container system, and saving the integrity measurement value as an integrity measurement base value of the container system to the main monitoring.

[0047] In the present application, the present application provides a container full-process security execution method based on SGX, a plurality of monitoring modules are established for the container system to monitor the safe operation of the container. With the help of Intel's SGX (Software Guard Extensions) technology, a main monitoring for monitoring the whole container system and a sub-monitoring for a specific container in the container system are realized. The main monitoring and the sub-monitoring are both realized with the help of Intel's SGX technology, and the SGX is a new extension of Intel architecture, which adds a new instruction set and a memory access mechanism to the original architecture. These extensions allow the application program to realize a "container" called enclave, which divides a protected area in the address space of the application program, and provides confidentiality and integrity protection for the code and data in the enclave "container", and is immune to the damage of malicious software with special privileges.

[0048] The structural relationship between the main monitoring and the sub-monitoring is as Figure 2 shown, Figure 2Application 1 and Application 2 refer to containers with special purposes, Monitoring 1 and Monitoring 2 are two sub-monitors corresponding to the Application 1 container and the Application 2 container respectively, and the main monitor is the main monitor corresponding to the entire container system. The main monitor and the sub-monitor are two sets of software systems completely isolated at the software level of the container system, that is, they can be independently run, and the main monitor and the sub-monitor are independently run outside the container system, which means that the main monitor and the sub-monitor based on the SGX technology of the present application can be flexibly applied in various container technologies, such as docker, CoreOSrkt, Mesos, lxc, etc. The embodiment of the present application takes the common docker container as an example for explanation and description.

[0049] In some embodiments of the present application, the management of the container by the main monitor and the plurality of sub-monitors includes:

[0050] The main monitor creates a container image management tree, a container application tree and a sub-monitor registration tree according to the container system.

[0051] In this embodiment, the main monitor corresponds to the entire container system, and the main monitor creates a container image management tree, a container application tree and a sub-monitor registration tree for the monitored container system.

[0052] Specifically, referring to Figure 3 , Figure 3 The structure of the image management tree established in one embodiment of the present application is shown, and the leaf nodes of the image management tree correspond to a container image. As shown in the figure, image 1, image 2, image n-1 and image n. The main monitor establishes the image management tree according to all the images of the container system, and the image management tree is associated with the hash value, for example, Hash1 in the figure is the hash value of the image metadata and the integrity measurement value of the image in image 1, and Hash2 is the hash value of the image metadata and the integrity measurement value of the image in image 2. Hash(1, 2) is obtained by hashing the combined Hash1 and Hash2 of image 1 and image 2. The consistency of the key data of the container system is maintained according to the above relationship. That is, Hash1 to Hashn at the bottom layer are determined by the content of the image, and once the content of any image is changed, the structure of the entire image management tree will be changed. That is, the container in the container system may be modified.

[0053] Correspondingly, the container application tree and the sub-monitor registration tree are similar in structure to the image management tree, except that the contents of the leaf nodes are not the same.

[0054] It should be noted that the above three tree structures are only used for management, and are not tree storage structures for storing and querying data in computers, Figure 3The hash of each root node in the tree structure in the container changes with the number of containers in the container.

[0055] In some embodiments of the present application, the method further comprises:

[0056] In response to the container system being started for the first time, the main monitor obtains the structural file of the container system, performs integrity measurement on the obtained structural file and calculates the corresponding integrity measurement value, and performs consistency verification on the calculated integrity measurement value and the integrity measurement base value of the container system in the main monitor, and allows the container system to run in response to the verification passing.

[0057] In this embodiment, the Docker container system is taken as an example. Before the Docker system is started, a trusted execution environment corresponding to the container engine (the main monitor developed based on the SGX technology) is created, which is referred to as the main monitor.

[0058] Further, the main monitor creates a Docker image management tree, a Docker container application tree, and a sub-monitor registration tree. If the Docker system is started for the first time, the main monitor performs integrity measurement on the executable files and key configuration files, static link libraries, and dynamic link libraries of the Docker system by using the Ocall interface, and dynamically saves the integrity measurement value as a measurement base value in the main monitor.

[0059] Further, the main monitor encrypts the integrity measurement value of the Docker system by using its own sealed key, and seals it in an external storage area.

[0060] In addition, if the Docker system is not started for the first time, the main monitor performs integrity measurement on the executable files and key configuration files, static link libraries, and dynamic link libraries of the Docker system by using the Ocall interface, and compares the integrity measurement value with the measurement base value. If they are the same, the Docker system is started, otherwise the Docker system is prohibited from being started.

[0061] In some embodiments of the present application, the main monitor encrypts the Docker image management tree, the Docker container application tree, and the sub-monitor registration tree by using its own sealed key in real time, and seals them in an external storage area, so as to realize persistent storage.

[0062] In some embodiments of the present application, the integrity measurement value refers to a unique trusted value calculated by performing hash operation on specific data content, such as the commonly used MD5.

[0063] In some embodiments of the present application, the method further comprises:

[0064] obtaining an image integrity metric value from the image repository and saving the image integrity metric value as a base value of the image metric to the image management tree;

[0065] downloading a corresponding image from the image repository and calculating an integrity metric value of the image through sub-monitoring or main monitoring, and performing consistency checking on the calculated integrity metric value, the integrity metric value contained in the image and the base value of the image metric in the image management tree;

[0066] in response to passing of the consistency checking, the main monitoring generates a derived key according to the container features, encrypts the image through the derived key and saves it to the local.

[0067] In the embodiment, when obtaining a Docker image, first, an image integrity metric value is obtained from the image repository as a base value of the metric, and the image metadata and the integrity metric value are added to the Docker image management tree of the main monitoring.

[0068] It should be noted that the so-called obtaining an image integrity metric value from the image repository means obtaining by manual input or through some trusted way.

[0069] Further, the corresponding image is downloaded from the image repository through Docker. Then the main monitoring performs integrity metric on the image, and compares it with the integrity metric base value of the image (the above-mentioned manually obtained or obtained through a trusted way), and the integrity metric value contained in the image (the MD5 value contained in the image). If they are not the same, it means that the image has been tampered with in the process of downloading, transmission or storage. If they are the same, the Docker converts the image into a graph through the image management driver, and then encrypts and stores it in the local.

[0070] In some embodiments of the application, the encryption key of the image converted into a graph is derived from the root key of the main monitoring, and the encryption key is added to the Docker image management tree.

[0071] In some embodiments of the application, the method further comprises:

[0072] The main monitoring creates a sub-monitoring, the main monitoring authenticates the sub-monitoring through the remote attestation mechanism of SGX, and adds the ID and attestation information of the sub-monitoring to the sub-monitoring registration tree, and adds the ID of the sub-monitoring to the container application tree;

[0073] The sub-monitoring obtains the integrity metric value of the image of the corresponding container from the main monitoring, and writes the integrity metric base value of the image of the container into the container information structure of the sub-monitoring;

[0074] The sub-monitoring requests the main monitoring to decrypt the image of the container, and calculates the integrity measurement value of the decrypted image, and performs consistency check with the integrity measurement base value written in the sub-monitoring container information structure and the integrity measurement value contained in the image;

[0075] In response to the consistency check passing, the sub-monitoring manages the start of the container.

[0076] In the embodiment, when the Docker creates the container, the main monitoring starts a command for creating the sub-monitoring, and creates a sub-monitoring. The mutual proof of the main monitoring and the sub-monitoring is realized by using the remote proof function of intel SGX, and the id and proof information of the sub-monitoring X are written to the Docker container application tree of the main monitoring. Meanwhile, the sub-monitoring is registered on the sub-monitoring registration tree, that is, the id and proof information of the sub-monitoring are added to the sub-monitoring registration tree.

[0077] After the registration succeeds, the sub-monitoring obtains the measurement base value of the container image from the main monitoring, and writes the measurement base value into the container information structure of the sub-monitoring. The sub-monitoring requests the main monitoring to decrypt the image, and performs integrity measurement on the image, and simultaneously compares the integrity measurement base value of the image, the integrity measurement value contained in the image, and if they are not the same, it is proved that the image is tampered in the process of downloading, transmission or storage. If they are the same, the container image is safe, and the image can be loaded according to the start process of the Docker container.

[0078] In some embodiments of the application, the sub-monitoring manages the start of the container, comprising:

[0079] The sub-monitoring creates a start rule black and white list according to the preset configuration parameters of the container, monitors the start parameters transmitted when the container system starts the container, and matches and verifies the start parameters with the rules in the start rule black and white list;

[0080] In response to the verification matching success, the sub-monitoring creates the resource limit information of the container and writes it into the container information structure; and

[0081] The sub-monitoring creates a communication rule black and white list according to the security requirements of the container, and limits the network communication of the container through the communication rule black and white list.

[0082] Further, in the present embodiment, the child monitor creates a container startup rule blacklist and whitelist when the Docker loads the image or before the image is loaded, and writes them into the container information structure. The child monitor judges whether the startup parameters passed by the Docker Client are legal. If they are in accordance with the startup rule blacklist and whitelist, the startup is successful, and if they are not legal, the startup fails. If it is successful, the child monitor creates container runtime resource limit information and writes it into the container information structure. At the same time, the container communication rule is created, and the communication access whitelist container id is registered in the child monitor, and the default communication operation is performed (i.e., the container can only access the host operating system as shown in FIG. 1). Even if two containers are in the same network namespace, they cannot communicate if the id is not allowed. Figure 2

[0083] After the container is successfully started, the container id is written into the Docker container application tree of the master monitor, so that the container id and the id of the child monitor form a mapping relationship.

[0084] In some embodiments of the present application, the child monitor encrypts the container information structure using its own sealing key in real time, seals it in an external storage area, and realizes persistent storage.

[0085] In some embodiments of the present application, the method further comprises:

[0086] In response to the container running, the child monitor manages the communication of the application process and the container process in the container through the communication rule blacklist and whitelist;

[0087] The child monitor manages the resource access behavior of the container through the resource limit information in the container information structure.

[0088] In some embodiments of the present application, when the container is normally running, the child monitor monitors the container communication network in real time and compares it with the container communication rule (communication rule blacklist and whitelist). If the communication behavior is not in the whitelist of the container communication rule, the communication behavior is prohibited, and the isolation of the container network is improved.

[0089] In addition, the child monitor monitors the resource usage of the container in real time and compares it with the resource limit information in the container information structure. If the actual resource usage of the container exceeds the resource limit in the container information structure, the resource information used by the container is adjusted, and if it exceeds the resource limit for a long time, the container is stopped.

[0090] In some embodiments of the present application, the method further comprises:

[0091] ​The sub-monitor performs integrity measurement on files loaded by the container process and saves the result as a base value of integrity measurement in a container information structure of the sub-monitor;

[0092] The sub-monitor performs monitoring on files loaded by the container runtime process and performs integrity measurement to obtain an integrity measurement value, and performs consistency check with the base value of integrity measurement in the container information structure of the sub-monitor;

[0093] If the consistency check passes, the container is allowed to run; and

[0094] The sub-monitor creates a process function filter to filter return addresses of all process functions of the container, and stops the process of the container or the container in response to an abnormal return address of the process function. In this embodiment, before the container process is loaded, the sub-monitor monitors files required by the container process during loading, and then performs integrity measurement. If the process is run for the first time, the sub-monitor stores the measurement result as a base value in the container information structure. If the process is not run for the first time, the sub-monitor performs integrity measurement on the process, and compares the result with the corresponding base value of integrity measurement in the container information structure. If the values are different, it indicates that there is a possibility that the related files of the process are tampered during runtime of the container, and the container is stopped for processing. If the values are the same, it indicates that the integrity of the related files of the process is not damaged, and the process can be trusted and controlled, and the process is allowed to continue running; otherwise, the process is monitored by the monitoring module.

[0095] In some embodiments of the present application, the sub-monitor also measures return addresses of process functions in a stack. Specifically, the sub-monitor creates a Bloom filter of return addresses of process functions in the stack. The length of the Bloom filter and the Hash function are reasonably set according to stack process functions in the container program. When a stack function is called, the return address of the function is stored in the Bloom filter. When the address of the function is returned, if the address of the function exists in the Bloom filter, it indicates that the return address is correct, and the execution continues.

[0096] As shown in Figure 4 Another aspect of the present application provides a computer device, comprising:

[0097] at least one processor 21; and

[0098] a memory 22, the memory 22 storing computer instructions 23 executable on the processor 21, the instructions 23 being executed by the processor 21 to implement steps of the method of any one of the above embodiments.

[0099] As shown in Figure 4As shown, still another aspect of the present application also proposes a computer readable storage medium 401, which stores a computer program 402, the computer program 402 is executed by a processor to implement the steps of the method in any one of the above-mentioned embodiments.

[0100] The present application proposes a container security execution method. The method solves the whole process management and protection method of container system startup, image management, container startup, container running, etc. The monitoring program of the whole process management and protection process of the container is placed in the enclave of SGX, and the monitoring security of the whole process is realized. Before the container system starts, the problems of attack and tampering of the container executable file and key configuration file, static link library and dynamic link library are solved. The container image download integrity problem is solved, and protection measures such as container image download integrity verification, encrypted storage, and startup time integrity verification are implemented. The problem that containers in the same Network Namespace can access each other is solved, and the isolation problem between containers is solved. By setting a container network whitelist, the access ability of other containers to the running container is limited, and the malicious attack behavior of untrusted containers is prevented. The integrity and legality of the container runtime code segment and the stack function return address are verified, and problems such as tampering of the container runtime code segment and overflow of the stack function return address are prevented.

[0101] The above is the exemplary embodiment disclosed by the present application, but it should be noted that various changes and modifications can be made without departing from the scope of the embodiments disclosed by the present application defined by the claims. The functions, steps and / or actions of the method claims described herein need not be performed in any particular order. Furthermore, although the elements of the embodiments disclosed by the present application can be described or claimed in individual form, they can also be understood as plural unless explicitly limited to singular.

[0102] It should be understood that, as used herein, the singular forms "a", "an" and "the" are intended to include plural forms as well, unless the context clearly indicates otherwise. It will be further understood that the terms "comprises", "comprising", "includes" and / or "including", as used herein, specify the presence of stated features, integers, steps, operations, elements, and / or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and / or groups thereof.

[0103] The above-mentioned embodiment number of the embodiments disclosed by the present application is only for description, and does not represent the advantages and disadvantages of the embodiments.

[0104] The steps of a method or algorithm described in connection with the present disclosure can be embodied directly in hardware, in a software module executed by a processor, or in a combination of the two. A software module can reside in RAM memory, flash memory, ROM memory, EPROM memory, EEPROM memory, registers, hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art. An exemplary storage medium is coupled to the processor such that the processor can read information from, and write information to, the storage medium. In the alternative, the storage medium can be integral to the processor. The processor and the storage medium can reside in an ASIC. The ASIC can reside in a user terminal. In the alternative, the processor and the storage medium can reside as discrete components in a user terminal. Those skilled in the art will appreciate that the steps of the above-described embodiments can be carried out by a computer- implemented data processing apparatus, a programmed processor, or a computer containing programmed instructions executed by such a processor.

[0105] Those skilled in the art will understand that the steps of the above-described embodiments are merely illustrative and not intended to limit the scope of the embodiments of the present application (including claims) to these examples; the above-described embodiments or technical features among different embodiments can also be combined, and there are many other variations of the different aspects of the embodiments of the present application as described above; for the sake of brevity, they are not provided in detail. Therefore, any omission, modification, equivalent replacement, improvement, etc. made within the spirit and principle of the embodiments of the present application shall be included in the scope of protection of the embodiments of the present application.

Claims

1. A container safety execution method, characterized in that, include: A main monitor and multiple sub-monitors are established based on SGX, and the containers are managed through the main monitor and multiple sub-monitors; In response to the first startup of the container system, the integrity of the structured files of the container system is measured, the integrity metric value of the structured files of the container system is calculated, and the integrity metric value is saved as the integrity metric base value of the container system to the main monitor. The main monitor creates a container image management tree, a container application tree, and a sub-monitor registration tree based on the container system. The image management tree uses container images as leaf nodes and determines the hash value of the upper-level nodes using the image metadata and integrity metric values ​​in the container images. The leaf nodes of the container application tree are used to store the container ID and the sub-monitor ID, and the hash value of the upper-level node is determined sequentially based on the content in the leaf node. The leaf nodes of the sub-monitor registration tree are used to store the sub-monitor ID and the proof information of the sub-monitor's authentication, and the hash value of the upper-level node is determined sequentially based on the content in the leaf nodes.

2. The method according to claim 1, characterized in that, Also includes: In response to the container system not being started for the first time, the main monitoring system obtains the structured files of the container system, performs integrity measurement on the obtained structured files and calculates the corresponding integrity measurement value, and performs a consistency check between the calculated integrity measurement value and the integrity measurement base value of the container system in the main monitoring system. If the check passes, the container system is allowed to run.

3. The method according to claim 1, characterized in that, Also includes: Retrieve image integrity metrics from the image repository and save the image integrity metrics as image metric base values ​​to the container image management tree; Download the corresponding image from the image repository, calculate the integrity metric value of the image through sub-monitoring or main monitoring, and perform consistency verification between the calculated integrity metric value and the integrity metric value contained in the image and the image metric base value in the container image management tree; In response to the successful consistency check, the main monitor generates a derived key based on the container characteristics, encrypts the image using the derived key, and saves it locally.

4. The method according to claim 1, characterized in that, Also includes: The main monitor creates a sub-monitor, authenticates with the sub-monitor through the SGX remote authentication mechanism, adds the sub-monitor's ID and authentication information to the sub-monitor registration tree, and adds the sub-monitor's ID to the container application tree. The sub-monitor obtains the integrity metric value of the corresponding container image from the main monitor and writes the integrity metric base value of the container image into the container information structure of the sub-monitor. The sub-monitor requests the main monitor to decrypt the container image, calculate the integrity metric value of the decrypted image, and perform a consistency check with the integrity metric base value written in the sub-monitor's container information structure and the integrity metric value contained in the image. In response to the successful consistency check, the startup of the container is managed by the sub-monitor.

5. The method according to claim 4, characterized in that, The startup of the container is managed by the sub-monitor, including: The sub-monitor creates a blacklist and whitelist of startup rules based on the preset configuration parameters of the container, monitors the startup parameters passed when the container system starts the container, and matches and verifies the startup parameters with the rules in the blacklist and whitelist of startup rules; In response to the successful verification match, the sub-monitor creates the container's resource limit information and writes it into the container information structure; and The sub-monitor creates a communication rule blacklist or whitelist based on the container's security requirements, and restricts the container's network communication through the communication rule blacklist or whitelist.

6. The method according to claim 5, characterized in that, Also includes: In response to the detection that the container is running, the sub-monitor manages the communication of the application processes in the container and the container processes through the communication rule blacklist and whitelist; The sub-monitor manages the resource access behavior of the container through the resource restriction information in the container information structure.

7. The method according to claim 1, characterized in that, Also includes: The sub-monitor performs integrity measurement calculations on the files loaded by the container process and uses the calculation results as the integrity measurement base value, saving them into the container information structure of the sub-monitor. In response to the container running, the sub-monitor monitors the files loaded by the container runtime process and calculates the integrity metric value to obtain the integrity metric value, and performs a consistency check with the integrity metric base value in the container information structure of the sub-monitor. If the consistency check passes, the container is allowed to run; as well as The sub-monitor creates a process function filter to filter the return addresses of all process functions of the container. If an abnormal return address of a process function occurs, the process of the container or the container itself is stopped.

8. A computer device, characterized in that, include: At least one processor; as well as A memory storing computer instructions executable on the processor, which, when executed by the processor, implement the steps of the method according to any one of claims 1-7.

9. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1-7.

Citation Information

Patent Citations

  • Security reinforcement method for credible container based on Docker

    CN105069353A

  • Container safety protection method and electronic equipment

    CN113110912A