A verification method and system for application container image layer measurement list
By constructing the container image layer metric list of the Merkle tree, the problems of privacy leakage and low verification efficiency in remote trustworthy certification of container images are solved, and efficient image layer integrity verification is achieved.
Patent Information
- Application Number
- CN202210761993.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-06-30
- Publication Date
- 2024-10-01
- Estimated Expiration
- 2042-06-30
AI Technical Summary
There are problems of privacy leakage and low verification efficiency in the remote trusted certification process of existing container images.
By constructing a container image layer metric list based on the Merkle tree, a verification request containing the metric aggregation value of the image platform and the hash value of each image layer is generated, and the encryption information signed by the identity certification private key and the identity certification certificate are used for verification, reducing remote Information leakage of the image warehouse basic platform and image files improves verification efficiency.
During the remote certification process, information leakage is reduced, verification efficiency is improved, and the integrity and credibility of the container image layer are ensured.
Smart Images

Figure CN115146310B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of information processing technology, and in particular to a method and system for verifying an application container image layer list. Background Art
[0002] As a standard software unit, a container packages the code and the corresponding dependent files, so that the application can be quickly, reliably and conveniently transferred from one computing environment to another and run directly in the new computing environment. Like other virtualization technologies, container technology is also a general term. The current container technologies include Docker, Rocket, LXC and Warden. Docker container technology has unified the container encapsulation standard and has become the current mainstream container technology.
[0003] The read-only container image layer and the readable and writable container image layer constitute the corresponding container instance. The trusted container image is the basis for implementing the trusted container instance of the working node. The development and deployment of containerized application services rely on the basic container images in the remote warehouse. In order to implement highly secure containerized application services, the credibility and integrity of the basic container images must first be remotely verified. However, the current trusted remote attestation scheme for container images has problems such as privacy leakage and low verification efficiency. Summary of the invention
[0004] In view of the above problems, the present invention provides a method and system for verifying the metric list of application container images, which solves the problems of privacy leakage and low verification efficiency in the trusted remote attestation process of container images.
[0005] In order to achieve the above object, the present invention provides the following technical solutions:
[0006] A method for verifying a metric list of an application container image layer, comprising:
[0007] In response to receiving a request message for downloading a container image sent by a client, parsing the request message to determine a target container image;
[0008] Generate a verification request corresponding to the target container image;
[0009] In response to sending the verification request to a container image remote repository, receiving a first data set sent by the container image remote repository, the first data set including first encrypted information, an identity certificate, and a container image layer measurement list, wherein the first encrypted information is information for signing a calculation result of a top hash value of a Merkle tree corresponding to the target container image and a random number by an identity certificate private key; the container image layer measurement list is a measurement list constructed based on a Merkle tree, and the container image layer measurement list includes a measurement aggregation value of an image platform and an image layer hash value of each container image;
[0010] Based on the first data set, re-hashing the Merkle tree to obtain a top hash value, and performing a hash calculation using a random number and the top hash value to obtain a calculation result;
[0011] If the calculation result is the same as the top hash value in the first data set, it is determined that the container image layer metric list in the first data set is complete;
[0012] If the measurement result of the container image layer measurement list is the same as the hash value in the target database, it is determined that the image layer of the target container image is complete, so that the verification of the target container image is passed.
[0013] Optionally, the method further comprises:
[0014] Add a trusted computing platform module to the container image remote repository where the container image is stored to achieve measurement protection of the container image and system;
[0015] A trusted verification module for the container image is added to the container server, so as to trigger a remote verification mechanism for the container image through the trusted verification module and generate a verification request corresponding to the target container.
[0016] Optionally, the method further comprises:
[0017] In response to the host where the container image remote warehouse is located being started, the configuration information is measured by the trusted computing platform module to calculate a measurement aggregation value of the image platform;
[0018] The image layer of the container image remote warehouse is hashed by the trusted computing platform module to obtain the image layer hash value of each container image, and the image hash value of each container image is filled into the metric list of the Merkle tree corresponding to the container image.
[0019] Optionally, the method further comprises:
[0020] According to the number of container images in the container image remote repository, determine the number of hash subtree branches corresponding to the Merkle tree, so that each container image corresponds to a hash subtree;
[0021] Determine a metric aggregation value of the image platform based on configuration information of the image platform, and store the metric aggregation value in a container image layer metric list, so that the metric aggregation value constitutes a leaf node of the Merkle tree;
[0022] Parse the dependency information of the container image layer and determine the ownership information of the container image;
[0023] Based on the attribution information, the image layer hash value of each container image is filled into the corresponding container image metric list subtree to obtain a container image layer metric list.
[0024] Optionally, the method further comprises:
[0025] Calculate the hash value of the path node of the Merkle tree according to the rehashing to obtain the top hash value of the uppermost layer corresponding to the Merkle tree;
[0026] The top hash value is stored in a target register.
[0027] Optionally, the method further comprises:
[0028] Generate a platform identity key pair through the trusted computing platform module of the container image remote repository;
[0029] Collect the platform information and identity public key of the image platform, and sign the identity public key with the endorsement key private key;
[0030] The signed public key and endorsement certificate are encrypted and sent to a trusted third party.
[0031] Optionally, the identity certificate in the first data set is sent to the container image repository by the trusted third party after verifying the endorsement certificate.
[0032] Optionally, the method further comprises:
[0033] If the measurement result of the container image layer measurement list is different from the hash value in the target database, the position of the modified leaf node is determined based on comparing the hash value of the subtree of the Merkle tree.
[0034] Optionally, the rehashing calculation based on the first data set according to the Merkle tree to obtain a top hash value, and performing a hash calculation using a random number and the top hash value to obtain a calculation result includes:
[0035] In response to receiving the first data set, verifying the identity certificate in the first data set;
[0036] If the verification is successful, the top hash value is re-calculated according to the Merkle tree, and a hash calculation is performed using a random number and the top hash value to obtain a calculation result.
[0037] A verification system for an application container image layer metric list, comprising:
[0038] A parsing unit, configured to, in response to receiving a request message for downloading a container image sent by a client, parse the request message and determine a target container image;
[0039] A generating unit, configured to generate a verification request corresponding to the target container image;
[0040] A receiving unit, configured to receive, in response to sending the verification request to a container image remote repository, a first data set sent by the container image remote repository, the first data set comprising first encrypted information, an identity certificate, and a container image layer measurement list, wherein the first encrypted information is information for signing a calculation result of a top hash value of a Merkle tree corresponding to the target container image and a random number by an identity certificate private key; the container image layer measurement list is a measurement list constructed based on a Merkle tree, and the container image layer measurement list comprises a measurement aggregation value of an image platform and an image layer hash value of each container image;
[0041] A calculation unit, configured to obtain a top hash value by rehashing the Merkle tree based on the first data set, and perform a hash calculation using a random number and the top hash value to obtain a calculation result;
[0042] A first determining unit, configured to determine that the container image layer metric list in the first data set is complete if the calculation result is the same as the top hash value in the first data set;
[0043] The second determination unit is configured to determine that the image layer of the target container image is complete if the measurement result of the container image layer measurement list is the same as the hash value in the target database, so as to pass the verification of the target container image.
[0044] Compared with the prior art, the present invention provides a verification method and system for applying a container image layer measurement list, wherein the container server can generate a verification request corresponding to the target container image requested to be downloaded by the client; after sending it to the container image remote repository, the first data set sent by the container image remote repository is received, the first data set includes the first encrypted information, the identity certificate and the container image layer measurement list, the container image layer measurement list is a measurement list constructed based on the Merkle tree, and the container image layer measurement list includes the measurement aggregation value of the image platform and the image layer hash value of each container image; determine whether the container image layer measurement list in the first data set is complete; if the measurement result of the container image layer measurement list is the same as the hash value in the target database, determine that the image layer of the target container image is complete. By constructing a container image layer measurement list based on the Merkle tree for the container image, the information leakage of the remote image repository basic platform and the image file is reduced during the remote certification process, and the verification efficiency is improved. BRIEF DESCRIPTION OF THE DRAWINGS
[0045] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying creative work.
[0046] Figure 1 A flowchart of a method for verifying an application container image layer metric list provided by an embodiment of the present invention;
[0047] Figure 2 An application system interaction diagram provided by an embodiment of the present invention;
[0048] Figure 3 A schematic diagram of an application scenario provided by an embodiment of the present invention;
[0049] Figure 4 A schematic diagram of a container image layer metric list provided in an embodiment of the present invention;
[0050] Figure 5 A schematic diagram of the structure of a Merkle tree provided in an embodiment of the present invention;
[0051] Figure 6 A schematic diagram of the structure of a system for verifying an application container image layer metric list provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0052] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0053] The terms "first" and "second" and the like in the specification and claims of the present invention and the above drawings are used to distinguish different objects, rather than to describe a specific order. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device including a series of steps or units is not limited to the listed steps or units, but may include steps or units that are not listed.
[0054] In an embodiment of the present invention, a verification method for an application container image layer measurement list is provided. The method reduces information leakage of a remote image repository basic platform and image files during the remote certification stage by constructing a container image layer measurement list based on a Merkle tree for the container image layer, thereby improving verification efficiency.
[0055] See also Figure 1 , is a flow chart of a method for verifying an application container image layer metric list provided by an embodiment of the present invention, the method may include the following steps:
[0056] S101: In response to receiving request information for downloading a container image sent by a client, the request information is parsed to obtain a target container image.
[0057] For the convenience of description, the container technology in the embodiments of the present invention refers to the Docker container technology, wherein the container image described is a Docker container image, that is, a container image based on the Docker technology. The client refers to the Docker client, and the user can send a request message (such as a request instruction) to download the container image through the Docker client. After receiving the request message, the Docker server will parse it to obtain the target container image corresponding to the request message, that is, the target container image requested to be downloaded by the user.
[0058] Container images are obtained from public or private image repositories. Container instances are generated from container images. Only by implementing highly secure and reliable container images can the corresponding container instances be guaranteed to be secure. Among them, the trustworthiness of container images is the basis of the security of container instances. Therefore, it is necessary to verify the trustworthiness and integrity of the target container image.
[0059] S102: Generate a verification request corresponding to the target container image.
[0060] After determining the target container image that the client needs to download, the Docker server adjusts the target container image in the container image remote repository, that is, generates a verification request corresponding to the target container image.
[0061] S103: In response to sending the verification request to a container image remote repository, receiving a first data set sent by the container image remote repository.
[0062] After the server sends the verification request to the container image remote repository, the container image remote repository, as the challenged party, needs to provide information corresponding to the target container image to verify the integrity and credibility of the target image based on the information.
[0063] The first data set is the information corresponding to the target container image provided by the container image remote repository. Specifically, it includes the first encrypted information, the identity certificate and the container image layer measurement list, wherein the first encrypted information is the information signed by the identity certificate private key on the top hash value of the Merkle tree corresponding to the target container image and the calculation result of the random number; the container image layer measurement list is a measurement list constructed based on the Merkle tree, and the container image layer measurement list includes the measurement aggregation value of the image platform and the image layer hash value of each container image.
[0064] S104. Based on the first data set, re-hash the Merkle tree to obtain a top hash value, and perform a hash calculation using a random number and the top hash value to obtain a calculation result.
[0065] S105: If the calculation result is the same as the top hash value in the first data set, it is determined that the container image layer metric list in the first data set is complete.
[0066] S106: If the measurement result of the container image layer measurement list is the same as the hash value in the target database, it is determined that the image layer of the target container image is complete, so that the verification of the target container image is passed.
[0067] In one embodiment, a platform identity key pair is generated by a trusted computing platform module of a container image remote repository; the platform information and identity public key of the image platform are collected, and the identity public key is signed by an endorsement key private key; the signed public key and endorsement certificate are encrypted and sent to a trusted third party.
[0068] Correspondingly, the identity certificate in the first data set is sent to the container image repository by the trusted third party after verifying the endorsement certificate.
[0069] Furthermore, if the measurement result of the container image layer measurement list is different from the hash value in the target database, the position of the modified leaf node is determined based on comparing the hash value of the subtree of the Merkle tree.
[0070] In one embodiment, the rehashing calculation based on the first data set according to the Merkle tree to obtain a top hash value, and performing a hash calculation using a random number and the top hash value to obtain a calculation result includes:
[0071] In response to receiving the first data set, verifying the identity certificate in the first data set;
[0072] If the verification is successful, the top hash value is re-calculated according to the Merkle tree, and a hash calculation is performed using a random number and the top hash value to obtain a calculation result.
[0073] See also Figure 2 , which is an application system interaction diagram provided in an embodiment of the present application. Among them, the application system includes a trusted third party, a server as a challenger, and a Docker container image repository as the challenged. The container image remote repository generates a platform identity authentication (Attestation Identity Key, AIK) key pair through TPM (Trusted Platform Module, trusted platform module), and then collects relevant platform information and AIK keys, and uses the endorsement key (Endorsement Key, EK) private key to sign the AIK public key, together with the EK certificate provided by the TPM manufacturer, and is sent to the trusted third party after being encrypted with the session key. The trusted third party verifies the validity of the EK certificate and the compliance of the platform information. After the verification is passed, the trusted third party uses its own signature key to sign the AIK public key and sends the AIK certificate to the container image remote repository.
[0074] The server encrypts the generated random number nonce and the complete verification request for the target container image to the container image remote repository. After the container image remote repository receives and decrypts the verification request, it calls the trusted software protocol stack to read the PCR. 15 value (the hash value at the top of the Merkle tree), and PCR 15 Hash calculation is performed with the random number nonce, and the result is signed with the AIK private key. It is encrypted together with the AIK certificate and the image layer measurement list and sent to the server.
[0075] After decryption, the server verifies the validity, legality, and authenticity of the AIK certificate and obtains the verification result. If the certificate is authentic and valid, the challenger re-hashes the Merkle tree to obtain the ToP Hash (top hash value), and performs a Hash calculation with the nonce (random number) value to compare the PCR 15 result.
[0076] If the results are the same, the container image layer measurement list is complete, and the integrity of the image layer can be determined by comparing the measurement results with the Hash value of the target database (such as a fingerprint database); if the results are different, the container image layer measurement list has been tampered with, and the location of the modified leaf node can be determined by comparing the Hash results of the subtrees.
[0077] It can be seen that during remote attestation, it is not necessary to send the measurement results of other files of the platform to be verified. The container measurement list contains the container image layer measurement information. When verifying the integrity of the image layer measurement, all leaf node result values are not required, only the path node and the ToP Hash value signed by the TPM are required.
[0078] See also Figure 3 , is a schematic diagram of an application scenario provided by an embodiment of the present application, wherein a Docker client is connected to a Docker server through an intermediate interface, and the Docker client can generate request information for downloading a container image and send it to the Docker server. The Docker server can drive each Docker container. The Docker server plays the role of a challenger, and can generate a verification request for the corresponding target container, and send it to the Docker container image library, so that the Docker container image library plays the role of a challenged, and provides relevant information of the target container image to verify the credibility and integrity of the target container image.
[0079] In order to implement the container remote attestation architecture designed for Docker containers, it is necessary to add a challenge function module to the Docker container server, that is, a function that can initiate a challenge to the integrity of the image in the remote repository of the container image to verify it. The method also includes:
[0080] Add a trusted computing platform module to the container image remote repository where the container image is stored to achieve measurement protection of the container image and system;
[0081] A trusted verification module for the container image is added to the container server, so as to trigger a remote verification mechanism for the container image through the trusted verification module and generate a verification request corresponding to the target container.
[0082] Specifically, a TPM is added to the remote repository of container images where container images are stored to measure and protect the container images and the system. A trusted verification module for container images is added to the Docker server of the container architecture to assume the role of a challenger so as to generate a verification request corresponding to the target container. When a user sends an instruction to download a container image to the Docker server through the Docker client, the Docker server receives and parses the command, triggering a remote verification mechanism for the container image to verify the credibility and integrity of the container image before obtaining it.
[0083] Furthermore, the trusted measurement of the container image repository can be completed based on the trusted platform module, that is, the method further includes:
[0084] In response to the host where the container image remote warehouse is located being started, the configuration information is measured by the trusted computing platform module to calculate a measurement aggregation value of the image platform;
[0085] The image layer of the container image remote warehouse is hashed by the trusted computing platform module to obtain the image layer hash value of each container image, and the image hash value of each container image is filled into the metric list of the Merkle tree corresponding to the container image.
[0086] Specifically, the host of the container image remote repository can be embedded with a trusted platform module to complete the initial trusted measurement configuration. After the host where the image repository is located is started, the trusted measurement root in the TPM completes the trust measurement of the hardware, BIOS, and operating system, and the hash aggregation value is expanded by the formula boot_aggregate=Hash(...Hash(Hash(PCR0||PCR1)...)PCR7...) to calculate the measurement aggregation value boot_aggregate of the image platform. Among them, PCR refers to the platform configuration register (PCR), which is one of the components of the trusted platform module and is responsible for storing measurement values (i.e., hash values). By operating the TPM to complete the hash calculation of the image layer of the image repository, the hash values of all image layers are obtained, and then the hash values of each image layer are filled into the measurement list based on the Merkle tree.
[0087] In an embodiment of the present invention, a method for constructing a container image layer metric list is also provided. The method may include the following steps:
[0088] According to the number of container images in the container image remote repository, determine the number of hash subtree branches corresponding to the Merkle tree, so that each container image corresponds to a hash subtree;
[0089] Determine a metric aggregation value of the image platform based on configuration information of the image platform, and store the metric aggregation value in a container image layer metric list, so that the metric aggregation value constitutes a leaf node of the Merkle tree;
[0090] Parse the dependency information of the container image layer and determine the ownership information of the container image;
[0091] Based on the attribution information, the image layer hash value of each container image is filled into the corresponding container image metric list subtree to obtain a container image layer metric list.
[0092] For details, see Figure 4 , which is a schematic diagram of a container image layer measurement list provided in an embodiment of the present application. The corresponding hash subtree branches are designed according to the number of container images in the remote image repository system, and each container image corresponds to a hash subtree. Since the underlying system platform of the container image repository is the security foundation of the upper-level container image, it is necessary to continue the system trust chain, configure the platform measurement information for each image subtree, and put the measurement aggregation value boot_aggregate value of the image platform into the container image measurement list to form the leaf node of the Merkle tree, see Figure 5 , is a schematic diagram of the structure of a Merkle tree provided in an embodiment of the present application. The image parser parses the container image layer dependency information. Except for ToPHash, the first layer from top to bottom is the container image subtree. The first layer path node is a multi-fork structure, that is, A1~A m Each subtree contains a complete container image layer and platform information aggregation value. Assume that image A1 contains n layers of images. Except for the first layer, each path node in the lower layer can only contain 1 or 2 child nodes. Leaf node L0 is the platform information metric value boot_aggregate, L1~L n The image layer hash value of the A1 image.
[0093] Further, the hash values of the path nodes of the Merkle tree are calculated according to the rehashing to obtain the top hash value of the uppermost layer corresponding to the Merkle tree; and the top hash value is stored in the target register.
[0094] That is, by rehashing the path node hash value of the Merkle hash tree, the top-level ToP Hash value is obtained, and the result is placed in the corresponding register PCR 15 middle.
[0095] In the embodiment of the present invention, the measurement verification method based on the Integrity Measurement Architecture (IMA) needs to traverse all target files that meet the measurement strategy each time. The measurement list is bloated and huge, and it is impossible to quickly and effectively locate the specific image layer that is attacked and how many image layers are damaged. The container image layer measurement list designed based on the Merkle tree discards the measurement information that is irrelevant to the challenger's verification request, and recombines it based on an unbalanced binary tree. Figure 5 When checking whether the value of C1 is complete, it is only necessary to obtain the complete and true B2 and C2, or C2, L0, and A1 to verify.
[0096] Merkle trees of different heights can be constructed according to different container images and the number of container image layers, with strong adaptability. When there are many container images and images, the unbalanced Merkle tree can be transformed to construct a B+ tree; when there are fewer container images and images, and higher security and privacy requirements are required, a balanced binary Merkle tree can be constructed.
[0097] By extension PCR 15 The ToP Hash result is stored, which is tamper-proof. Considering the credibility of the image repository platform infrastructure system, the aggregation value boot_aggregate of PCR0-PCR7 is added to the container image subtree when constructing the container image metric list.
[0098] In an embodiment of the present invention, a verification system for an application container image layer metric list is also provided. Figure 6 ,include:
[0099] The parsing unit 10 is used to parse the request information for downloading the container image sent by the client in response to the request information, and determine the target container image;
[0100] A generating unit 20, configured to generate a verification request corresponding to the target container image;
[0101] A receiving unit 30 is configured to receive, in response to sending the verification request to a container image remote repository, a first data set sent by the container image remote repository, the first data set including first encrypted information, an identity certificate, and a container image layer measurement list, wherein the first encrypted information is information in which a calculation result of a top hash value of a Merkle tree corresponding to the target container image and a random number is signed by an identity certificate private key; the container image layer measurement list is a measurement list constructed based on a Merkle tree, and the container image layer measurement list includes a measurement aggregation value of an image platform and an image layer hash value of each container image;
[0102] A calculation unit 40 is used to obtain a top hash value by re-hashing the Merkle tree based on the first data set, and perform a hash calculation using a random number and the top hash value to obtain a calculation result;
[0103] A first determining unit 50 is configured to determine that the container image layer metric list in the first data set is complete if the calculation result is the same as the top hash value in the first data set;
[0104] The second determination unit 60 is configured to determine that the image layer of the target container image is complete if the measurement result of the container image layer measurement list is the same as the hash value in the target database, so as to pass the verification of the target container image.
[0105] In one embodiment, the device further comprises:
[0106] A first adding unit is used to add a trusted computing platform module to a container image remote warehouse storing container images, so as to implement measurement protection of container images and systems;
[0107] The second adding unit is used to add a trusted verification module for the container image to the container server, so as to trigger a remote verification mechanism for the container image through the trusted verification module and generate a verification request corresponding to the target container.
[0108] In one embodiment, the device further comprises:
[0109] An aggregate value calculation unit, configured to measure the configuration information through the trusted computing platform module in response to the host where the container image remote repository is located being started, and calculate a measurement aggregate value of the image platform;
[0110] The hash value calculation unit is used to perform hash calculation on the image layer of the container image remote warehouse through the trusted computing platform module to obtain the image layer hash value of each container image, and fill the image hash value of each container image into the measurement list of the Merkle tree corresponding to the container image.
[0111] In one embodiment, the apparatus further comprises a metric list construction unit, configured to:
[0112] According to the number of container images in the container image remote repository, determine the number of hash subtree branches corresponding to the Merkle tree, so that each container image corresponds to a hash subtree;
[0113] Determine a metric aggregation value of the image platform based on configuration information of the image platform, and store the metric aggregation value in a container image layer metric list, so that the metric aggregation value constitutes a leaf node of the Merkle tree;
[0114] Parse the dependency information of the container image layer and determine the ownership information of the container image;
[0115] Based on the attribution information, the image layer hash value of each container image is filled into the corresponding container image metric list subtree to obtain a container image layer metric list.
[0116] Optionally, the device further comprises:
[0117] A recalculation unit, configured to calculate the hash values of the path nodes of the Merkle tree according to the rehashing, and obtain the top hash value of the uppermost layer corresponding to the Merkle tree;
[0118] A storage unit is configured to store the top hash value in a target register.
[0119] Furthermore, the device also includes:
[0120] A key generation unit, used to generate a platform identity key pair through a trusted computing platform module of a container image remote repository;
[0121] A collection unit, used to collect platform information and identity public key of the image platform, and sign the identity public key by using an endorsement key private key;
[0122] The sending unit is used to encrypt the signed public key and endorsement certificate and send them to a trusted third party.
[0123] Optionally, the identity certificate in the first data set is sent to the container image repository by the trusted third party after verifying the endorsement certificate.
[0124] In one embodiment, the device further comprises:
[0125] The third determining unit is configured to determine the position of the modified leaf node based on comparing the hash value of the subtree of the Merkle tree if the measurement result of the container image layer measurement list is different from the hash value in the target database.
[0126] Furthermore, the computing unit is specifically used for:
[0127] In response to receiving the first data set, verifying the identity certificate in the first data set;
[0128] If the verification is successful, the top hash value is re-calculated according to the Merkle tree, and a hash calculation is performed using a random number and the top hash value to obtain a calculation result.
[0129] In this specification, each embodiment is described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the embodiments can be referred to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part.
[0130] The above description of the disclosed embodiments enables one skilled in the art to implement or use the present invention. Various modifications to these embodiments will be apparent to one skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present invention. Therefore, the present invention will not be limited to the embodiments shown herein, but rather to the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A method for verifying a metric list of an application container image layer, characterized in that: include: In response to receiving a request message for downloading a container image sent by a client, parsing the request message to determine a target container image; Generate a verification request corresponding to the target container image; In response to sending the verification request to a container image remote repository, receiving a first data set sent by the container image remote repository, the first data set including first encrypted information, an identity certificate, and a container image layer measurement list, wherein the first encrypted information is information for signing a calculation result of a top hash value of a Merkle tree corresponding to the target container image and a random number by an identity certificate private key; the container image layer measurement list is a measurement list constructed based on a Merkle tree, and the container image layer measurement list includes a measurement aggregation value of an image platform and an image layer hash value of each container image; Based on the first data set, re-hashing the Merkle tree to obtain a top hash value, and performing a hash calculation using a random number and the top hash value to obtain a calculation result; If the calculation result is the same as the top hash value in the first data set, it is determined that the container image layer metric list in the first data set is complete; If the measurement result of the container image layer measurement list is the same as the hash value in the target database, it is determined that the image layer of the target container image is complete, so that the verification of the target container image is passed.
2. The method according to claim 1, characterized in that The method further comprises: Add a trusted computing platform module to the container image remote repository where the container image is stored to achieve measurement protection of the container image and system; A trusted verification module for the container image is added to the container server, so as to trigger a remote verification mechanism for the container image through the trusted verification module and generate a verification request corresponding to the target container.
3. The method according to claim 2, characterized in that The method further comprises: In response to the host where the container image remote warehouse is located being started, the configuration information is measured by the trusted computing platform module to calculate a measurement aggregation value of the image platform; The image layer of the container image remote warehouse is hashed by the trusted computing platform module to obtain the image layer hash value of each container image, and the image hash value of each container image is filled into the metric list of the Merkle tree corresponding to the container image.
4. The method according to claim 1, characterized in that: The method further comprises: According to the number of container images in the container image remote repository, determine the number of hash subtree branches corresponding to the Merkle tree, so that each container image corresponds to a hash subtree; Determine a metric aggregation value of the image platform based on configuration information of the image platform, and store the metric aggregation value in a container image layer metric list, so that the metric aggregation value constitutes a leaf node of the Merkle tree; Parse the dependency information of the container image layer and determine the ownership information of the container image; Based on the attribution information, the image layer hash value of each container image is filled into the corresponding container image metric list subtree to obtain a container image layer metric list.
5. The method according to claim 4, characterized in that The method further comprises: Calculate the hash value of the path node of the Merkle tree according to the rehashing to obtain the top hash value of the uppermost layer corresponding to the Merkle tree; The top hash value is stored in a target register.
6. The method according to claim 2, characterized in that The method further comprises: Generate a platform identity key pair through the trusted computing platform module of the container image remote repository; Collect the platform information and identity public key of the image platform, and sign the identity public key with the endorsement key private key; The signed public key and endorsement certificate are encrypted and sent to a trusted third party.
7. The method according to claim 6, characterized in that The identity certificate in the first data set is sent to the container image repository by the trusted third party after the endorsement certificate is verified.
8. The method according to claim 1, characterized in that: The method further comprises: If the measurement result of the container image layer measurement list is different from the hash value in the target database, the position of the modified leaf node is determined based on comparing the hash value of the subtree of the Merkle tree.
9. The method according to claim 1, characterized in that: The method of rehashing the first data set according to the Merkle tree to obtain a top hash value, and performing a hash calculation using a random number and the top hash value to obtain a calculation result includes: In response to receiving the first data set, verifying the identity certificate in the first data set; If the verification is successful, the top hash value is re-calculated according to the Merkle tree, and a hash calculation is performed using a random number and the top hash value to obtain a calculation result.
10. A verification system for an application container image layer metric list, characterized in that: include: A parsing unit, configured to, in response to receiving a request message for downloading a container image sent by a client, parse the request message and determine a target container image; A generating unit, configured to generate a verification request corresponding to the target container image; A receiving unit, configured to receive, in response to sending the verification request to a container image remote repository, a first data set sent by the container image remote repository, the first data set comprising first encrypted information, an identity certificate, and a container image layer measurement list, wherein the first encrypted information is information for signing a calculation result of a top hash value of a Merkle tree corresponding to the target container image and a random number by an identity certificate private key; the container image layer measurement list is a measurement list constructed based on a Merkle tree, and the container image layer measurement list comprises a measurement aggregation value of an image platform and an image layer hash value of each container image; A calculation unit, configured to obtain a top hash value by rehashing the Merkle tree based on the first data set, and perform a hash calculation using a random number and the top hash value to obtain a calculation result; A first determining unit, configured to determine that the container image layer metric list in the first data set is complete if the calculation result is the same as the top hash value in the first data set; The second determination unit is configured to determine that the image layer of the target container image is complete if the measurement result of the container image layer measurement list is the same as the hash value in the target database, so as to pass the verification of the target container image.
