Access control method, device, equipment and readable storage medium
By using the first proxy container in the container management system to obtain and analyze the target domain name of the access request, and combining the access permission control data for forwarding control, the problem of inaccurate access control caused by IP address changes is solved, and the security and accuracy of the system are improved. sex.
Patent Information
- Application Number
- CN202210584577.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-05-26
- Publication Date
- 2024-09-06
- Estimated Expiration
- 2042-05-26
AI Technical Summary
In the container management system, when access control is performed by detecting the IP address of the access request, the access request cannot be accurately determined because the IP address changes frequently, resulting in the inability to achieve accurate access control.
In the container management system, the first proxy container obtains the target domain name in the access request, analyzes the domain name type, obtains access permission control data, and performs forwarding control to ensure accurate interception and restriction of access requests.
It achieves the accuracy and security of access control to the container management system, prevents illegal access between containers and external networks, and improves system security.
Smart Images

Figure CN115001780B
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to an access control method, an access control device, a computer device, and a computer-readable storage medium. Background Art
[0002] A container management system is a distributed container orchestration engine used to manage containerized workloads and services to achieve automated deployment, expansion, and management of containerized applications. Currently, in container management systems, the method of detecting the Internet Protocol (IP) address of the access request at the request receiving end is used to determine whether to intercept the access request. However, the IP addresses corresponding to the access items indicated by most access requests are usually changing and floating, and the IP address of the access request may not be identified. In this way, it is impossible to accurately determine whether to intercept the access request, that is, it is impossible to accurately implement access control. Summary of the invention
[0003] The present application provides an access control method, apparatus, device and readable storage medium, which can accurately implement access control based on domain names.
[0004] In a first aspect, the present application provides an access control method, which is applied to a first proxy container in a container management system, wherein the container management system includes at least one container group, each container group is mounted with a corresponding proxy container, the first proxy container is a proxy container corresponding to the first container group, and the first container group is any one of the at least one container group, the method comprising:
[0005] Obtaining an access request of any container in the first container group, wherein the access request includes a target domain name;
[0006] Determine the project type accessed by any of the above containers according to the above target domain name, and obtain access permission control data of the above first container group;
[0007] The access request is forwarded and controlled according to the project type and the access permission control data.
[0008] In a second aspect, the present application provides an access control device, which is applied to a first proxy container in a container management system, wherein the container management system includes at least one container group, each container group is mounted with a corresponding proxy container, the first proxy container is a proxy container corresponding to the first container group, and the first container group is any one of the at least one container group, the device includes:
[0009] An acquisition module, configured to acquire an access request of any container in the first container group, wherein the access request includes a target domain name;
[0010] A processing module, configured to determine the type of project accessed by any of the above containers according to the above target domain name, and obtain access permission control data of the above first container group;
[0011] The control module is used to control the forwarding of the access request according to the project type and the access permission control data.
[0012] In a third aspect, the present application provides a computer device, comprising: a processor, a storage device and a communication interface, wherein the processor, the communication interface and the storage device are interconnected, wherein the storage device stores an executable program code, and the processor is used to call the executable program code to implement the access control method.
[0013] In a fourth aspect, the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, wherein the computer program includes program instructions, and wherein the program instructions are executed by a processor to implement the access control method as described above.
[0014] In a fifth aspect, the present application provides a computer program product, which includes a computer program or computer instructions, and the computer program or computer instructions are executed by a processor to implement the above-mentioned access control method.
[0015] The present application first obtains the target domain name carried by the access request through the first proxy container, and determines the type of project accessed by any container by analyzing the target domain name. Since the access permission control data indicates the objects that any container included in the first container group is allowed to access when performing an access operation, the first proxy container restricts the access to any container at the access initiation end according to the project type and the access permission control data, thereby realizing access control and improving the security of the container management system. In addition, the access permission control data corresponding to different project types are different. By determining the type of project accessed by any container and then performing the corresponding forwarding control operation, since the domain name of the access object is generally relatively fixed, the domain name accessed by the request sending end is detected at the request sending end to determine whether to intercept the access request, which can achieve accurate interception of the access request, thereby achieving accurate access control. In addition, when a container initiates an access request, the present application performs access control based on the domain name it accesses. Compared with access restriction based on the IP address of the access request at the access receiving end, the present application can not only restrict the access rights between containers in the container management network, but also restrict the access of containers in the container management network to the external network environment, thereby avoiding the situation where data is arbitrarily pulled from the external network environment due to security attacks on the container, ensuring the environmental security of the container management network, and thus improving the security of the container management system. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0017] Figure 1 is a schematic diagram of an architecture of an access control system provided by an exemplary embodiment of the present application;
[0018] Figure 2 It is a flowchart of an access control method provided by an exemplary embodiment of the present application;
[0019] Figure 3 is a flowchart of another access control method provided by an exemplary embodiment of the present application;
[0020] Figure 4 is a schematic block diagram of an access control device provided by an exemplary embodiment of the present application;
[0021] Figure 5 It is a schematic block diagram of a computer device provided by an exemplary embodiment of the present application. DETAILED DESCRIPTION
[0022] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0023] It should be noted that the descriptions of "first", "second", etc. involved in the embodiments of the present application are only for descriptive purposes and cannot be understood as indicating or implying their relative importance or implicitly indicating the number of the indicated technical features. Therefore, the technical features defined as "first" or "second" may explicitly or implicitly include at least one of the features.
[0024] It can be understood that in the specific implementation of this application, relevant data such as target domain names and authorized project lists are involved. When the above embodiments of this application are applied to specific products or technologies, the collection, use and processing of relevant data need to comply with relevant laws, regulations and standards of relevant countries and regions.
[0025] For ease of understanding, some nouns appearing in this application are explained below.
[0026] Kubernetes (k8s) is a distributed container orchestration engine used to manage containerized workloads and services to achieve automated deployment, expansion and management of containerized applications. It is a container orchestration platform. Kubernetes builds a container scheduling service based on Docker (a lightweight virtualization technology).
[0027] A Pod is a container group that is deployed on a single node and contains one or more containers. All containers in the same container group share the same Internet Protocol address (IP address), inter-process communication (IPC), host name, and other resources.
[0028] A sidecar container is a container that runs together with the main container in a Pod, extending and enhancing the functionality of the current container without changing it.
[0029] Labels are key-value pairs on Kubernetes objects (such as Pods). Labels are intended to specify identifying properties of objects that are meaningful and relevant to users. Labels can be attached to objects (Nodes, Pods, Services, etc.) when they are created. Any number of labels can be added to a resource object. The same label can be added to any number of resource objects and can be added and modified at any time. Each object can define a set of key / value labels, and each key is unique to a given object.
[0030] Pod is the basic building block of Kubernetes applications. Kubernetes manages Pods, which encapsulate containers. A Pod may contain one or more containers. The functionality of the current container is extended by deploying a special sidecar proxy (sidecar container, i.e. proxy container) throughout the environment, and the proxy container intercepts all network communications of the Pod and performs access control processing such as traffic management according to certain rules.
[0031] At present, in the container management system, the method of detecting the Internet Protocol address of the access request at the request receiving end is used to determine whether to intercept the access request. However, the Internet Protocol address corresponding to the access item indicated by most access requests is floating, and there will be a situation where the Internet Protocol address of the access request cannot be determined, so it is impossible to determine whether to intercept the access request. Therefore, this method cannot accurately implement access control. Based on this, the present application proposes a method of mounting a proxy container under the container group where the access request sending end is located, obtaining all the call information of the container group through the proxy container, implementing access control within the container management network, and access control of domain names outside the container management network, thereby accurately implementing access control.
[0032] In subsequent embodiments, the first proxy container will refer to the sidecar container mounted in the container group to which the access initiator belongs, and is used to control access to any container in the container group when an access operation is performed.
[0033] This application will be specifically described through the following examples.
[0034] See also Figure 1 , Figure 1 1 is a schematic diagram of an access control system provided by an exemplary embodiment of the present application. The access control system may specifically include a computer device 101, a server 102, and a container management network 103. The number of computer devices 101 may be multiple (e.g., a first computer device, a second computer device, an nth computer device, etc.). The computer device 101, the server 102, and the container management network 103 are connected via a network, such as a local area network, a wide area network, a mobile Internet, etc.
[0035] In the architecture of the present application, a container management network may include multiple container groups (e.g., container group 1, container group 2, container group n, etc.), and any container group in the container management network may include multiple business containers (e.g., container 1, container 2, container n, etc.) and proxy containers. The proxy container may perform access control on any container in the container group. By performing access control on any container at the access request initiator, the target domain name belonging to the internal project (i.e., the project in the container management network) may be controlled, and the target domain name belonging to the external project (i.e., the domain name not in the container management network) may also be controlled. Each container group may be configured in a computer device (e.g., container group 1 is configured in a first computer device; container group 2 is configured in a second computer device). Multiple computer devices 101 are respectively connected to the server 102 for data interaction. It should be noted that the number of container management networks may also be multiple, such as a first container management network and a second container management network, and multiple container management networks are respectively connected to the server 102 so that the container in the first container management network can access the container in the second container management network.
[0036] Specifically, when any container in the container group (for example, container 1 included in container group 1 in container management network 103) accesses the target domain name, the first proxy container can first determine the project type accessed by any container. If the project type is an internal project in the container management network, corresponding forwarding control processing is performed by judging whether the container group to which the target domain name belongs is in the first authorized project list; if the project type is an external project outside the container management network, corresponding forwarding control processing is performed by judging whether the target domain name is in the second authorized project list.
[0037] Specifically, assuming that container 1 in container group 1 in the container management network initiates access to container n in container group 2 (in this case, the project type accessed by container 1 is an internal project), then the proxy container in container group 1 can obtain the access request of container 1 in container group 1, and after determining that the target domain name in the access request is an internal domain name, access the target domain name based on the computer device to which container group 1 belongs. Assuming that container 1 in container group 1 in the container management network initiates access to an external domain name (for example, www.baidu.com that is not in the list of external authorized projects) (in this case, the project type accessed by container 1 is an external project), then the proxy container in container group 1 can obtain the access request of container 1 in container group 1, and after determining that the target domain name in the access request is an external domain name, forward the access request to server 102 based on the computer device to which container group 1 belongs to access the external domain name.
[0038] In the above process, any container can directly access the container corresponding to the target domain name through the proxy container of the container group to which it belongs; it can also access the computer device where the target domain name is located through the computer device to which any container belongs; it can also send an access request to the server 102 through the computer device to which any container belongs, and the server 102 forwards the above access request to the computer device where the target domain name is located to achieve access.
[0039] Any of the above containers can be configured in a terminal device, and a container on another terminal device can be accessed through the terminal device. Terminal devices are also called terminals, user equipment (UE), access terminals, user units, mobile devices, user terminals, wireless communication devices, user agents or user devices. Terminal devices can be smart home appliances, handheld devices with wireless communication functions (such as smart phones, tablet computers), computing devices such as personal computers (PCs), vehicle-mounted terminals, intelligent voice interaction devices, wearable devices or other smart devices, but are not limited to these.
[0040] Server 102 can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers. It can also be a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (CDN), as well as big data and artificial intelligence platforms.
[0041] It is understandable that the system architecture diagram described in the embodiment of the present application is to more clearly illustrate the technical solution of the embodiment of the present application, and does not constitute a limitation on the technical solution provided by the embodiment of the present application. Figure 1 The number of container management networks and servers in the present invention is only illustrative. According to the business implementation needs, any number of container management networks and servers can be configured. In addition, with the evolution of the system architecture and the emergence of new business scenarios, the technical solutions provided in the embodiments of the present application are also applicable to similar technical problems. For example, container 1, container 2, container n, etc. in this architecture can be configured in the same computer device, which can be a terminal device such as a personal computer, or a single server such as a physical server.
[0042] See also Figure 2 , which is a flowchart of an access control method provided by an exemplary embodiment of the present application, in which the method is applied to a first proxy container (such as Figure 1 Taking the proxy container in the example as an example, the method may include the following steps:
[0043] S201: Obtain an access request of any container in a first container group, where the access request includes a target domain name.
[0044] In the embodiment of the present application, the execution object of the above method is a first proxy container applied to the container management system, and the first proxy container is mounted in the first container group, and is used to perform access control on the containers in the first container group when the access operation is performed. The container management system includes at least one container group, each container group is mounted with a corresponding proxy container, the first proxy container is the proxy container corresponding to the first container group, and the first container group is any one of the at least one container group.
[0045] In one embodiment, when any container in the first container group is accessed, the first proxy container can obtain the access request of any container, and the access request includes the target domain name, that is, the target object to be accessed. Among them, the container management system can refer to the Kubernetes management system (also known as "k8s" or "kube"); the first container group can refer to the container group Pod in Kubernetes; the first proxy container can refer to the sidecar container corresponding to any container group Pod in Kubernetes.
[0046] In one embodiment, it is assumed that there are two container management networks (respectively container management network A and container management network B), each container management network includes multiple container groups (for example, each container management network includes container group 1, container group 2, container group n, etc.), and each container group in the container management network includes multiple containers (for example, container 1, container 2, container n, etc.).
[0047] S202: Determine the type of project accessed by any container according to the target domain name, and obtain access permission control data of the first container group.
[0048] In the embodiment of the present application, the first proxy container can determine the type of project accessed by any container by analyzing the target domain name. The access permission control data indicates the objects that the containers included in the first container group are allowed to access when performing access operations. The first proxy container improves the security of the container management system by restricting access to the container at the access end. Since the access permission control data corresponding to different project types is different, the accuracy of forwarding control is improved by determining the type of project accessed by the container and then performing the corresponding forwarding control operation.
[0049] The project type is used to indicate the type of object accessed by the container in the first container group. Project types include internal projects and external projects. Internal projects refer to projects in the container management system. Multiple projects deployed in the same container management system are each other's internal projects. If the project type is an internal project, it means that the object accessed by the container in the first container group is in the container management system. Assume Figure 1 Container group 1 and container group 2 in belong to the same container management system. Figure 1 Container 1 in container group 1 in Figure 1 The container group in the container group 2 in the first container group is regarded as accessing an internal project. An external project refers to a project outside the container management system. If the project type is an external project, it means that the object accessed by the container in the first container group is not in the container management system.
[0050] The above-mentioned determination of the project type accessed by any container according to the target domain name can be implemented according to the following steps A1-A4.
[0051] A1. Acquire characteristic information of the target domain name, where the characteristic information includes one or more of name information and suffix information.
[0052] A2. Determine the domain name type of the target domain name based on the feature information.
[0053] In the embodiment of the present application, the domain name type includes a short domain name and a non-short domain name, wherein the short domain name refers to the access domain name used by containers in the same container management system to communicate with each other. In order to facilitate access and identification, generally, the access domain name used by containers in the container management system to communicate with each other is shorter (i.e., contains fewer characters) and / or has certain identification properties (to reflect belonging to the same container management system), for example, the short domain name carries name information and / or suffix information that can be recognized in the same container management system. The non-short domain name refers to the access domain name used by the container of the container management system to access resources of other external systems outside the container management system.
[0054] The first proxy container can determine the domain name type corresponding to the target domain name by analyzing the characteristic information of the target domain name.
[0055] For example, the short domain name is generally the name of an internal service (referring to a service provided in the container management system) (such as easy-mock-mongodb, etc.), or <namespace>.svc.cluster.local, svc.cluster.local, cluster.local, etc. If the target domain name is a short domain name, it means that the project corresponding to the target domain name is an internal project; if the target domain name is not a short domain name (i.e., not a short domain name), it means that the project corresponding to the target domain name is an external project.
[0056] In one embodiment, the above-mentioned determination of the domain name type of the target domain name according to the characteristic information can be implemented according to the following steps A21-A23.
[0057] A21. Determine whether characteristic information of the target domain name meets preset conditions, where the preset conditions include that the name information is an internal service name and the suffix information is one or more of the preset suffixes.
[0058] In one embodiment, the internal service name may be easy-mock-mongodb, etc., and the preset suffix may be <namespace>, svc, cluster, local svc, local cluster, local, etc.
[0059] A22. If the characteristic information of the target domain name meets the preset conditions, it is determined that the domain name type of the target domain name is a short domain name.
[0060] A23. If the characteristic information of the target domain name does not meet the preset conditions, it is determined that the domain name type of the target domain name is not a short domain name.
[0061] In one embodiment, the preset condition may be that the target domain name satisfies one of the following conditions: the name information is an internal service name and the suffix information is a preset suffix; or the target domain name needs to satisfy the following conditions: the name information is an internal service name and the suffix information is a preset suffix. In actual business, a plurality of methods for determining the domain name type of the target domain name may be selected based on business conditions, thereby improving the flexibility and accuracy of determining the domain name type of the target domain name.
[0062] A3. If the domain name type of the target domain name is a short domain name, it is determined that the project type accessed by any container is an internal project.
[0063] A4. If the domain name type of the target domain name is not the short domain name, it is determined that the project type accessed by any container is an external project.
[0064] The first proxy container can quickly determine the type of project accessed by any container based on the domain name type of the target domain name, avoiding cumbersome query steps, thereby improving the efficiency of determining the project type corresponding to the target domain name, and further improving the efficiency of the first proxy container in forwarding control. In addition, the first proxy container is simple and compact, and consumes less resources than the main container. Using the first proxy container to implement access control reduces the resource consumption of the container management system.
[0065] S203: Control the forwarding of the access request according to the project type and access permission control data.
[0066] In the embodiment of the present application, the project types accessed by any container include internal projects and external projects, and the access permission control data corresponding to different project types are different. Exemplarily, if the project type accessed by any container is an internal project, then the project that the first proxy container allows any container to access is limited based on the access permission control data related to the internal project; if the project type accessed by any container is an external project, then the project that the first proxy container allows any container to access is limited based on the access permission control data related to the external project. Through the project type and access permission control data, the access request is forwarded in a targeted manner, thereby accurately implementing access control.
[0067] The specific implementation process of the above step S203 will be introduced in subsequent embodiments and will not be repeated in this embodiment.
[0068] The present application first obtains the target domain name carried by the access request through the first proxy container, and determines the type of project accessed by any container by analyzing the target domain name. Since the access permission control data indicates the objects that any container included in the first container group is allowed to access when performing an access operation, the first proxy container restricts the access to any container at the access initiation end according to the project type and the access permission control data, thereby realizing access control and improving the security of the container management system. In addition, the access permission control data corresponding to different project types are different. By determining the type of project accessed by any container, and then performing targeted forwarding control operations, since the domain name of the access object is generally relatively fixed, the domain name accessed by the request sending end is detected at the request sending end to determine whether to intercept the access request, which can achieve accurate interception of the access request, thereby achieving accurate access control. In addition, when a container initiates an access request, the present application performs access control based on the domain name it accesses. Compared with access restriction based on the IP address of the access request at the access receiving end, the present application can not only restrict the access rights between containers in the container management network, but also restrict the access of containers in the container management network to the external network environment, thereby avoiding the situation where data is arbitrarily pulled from the external network environment due to security attacks on the container, ensuring the environmental security of the container management network, and thus improving the security of the container management system.
[0069] The present application also proposes that the project type of the target domain name can be an internal project or an external project. The first proxy container can determine the domain name type corresponding to the target domain name by analyzing the characteristic information such as the name information and suffix information of the target domain name, and then further determine the project type according to the domain name type. By selecting from a variety of methods for determining the domain name type of the target domain name, the flexibility and accuracy of determining the domain name type of the target domain name are improved. The first proxy container can quickly determine the project type accessed by any container according to the domain name type of the target domain name, avoiding cumbersome query steps, thereby improving the efficiency of determining the project type corresponding to the target domain name, and further improving the efficiency of the first proxy container in forwarding control. In addition, the first proxy container is simple and compact, and consumes less resources than the main container. Using the first proxy container to implement access control reduces the resource consumption of the container management system.
[0070] See also Figure 3 , which is a flowchart of an access control method provided by an exemplary embodiment of the present application, in which the method is applied to a first proxy container (such as Figure 1 Taking the proxy container in the example as an example, the method may include the following steps:
[0071] S301: Obtain an access request of any container in a first container group, where the access request includes a target domain name.
[0072] S302: Determine the type of project accessed by any container according to the target domain name, and obtain access permission control data of the first container group.
[0073] The specific implementation of steps S301 to S302 refers to the related description of steps S201 to S202 in the above embodiment, which will not be repeated here.
[0074] In an embodiment of the present application, the access permission control data includes a first authorization item list and a second authorization item list. The first authorization item list is an authorization item list corresponding to internal items. The first authorization item list may include a list of internal items accessible to each container in the first container group. Based on the first authorization item list, the internal items accessible to any container in the first container group can be determined; the second authorization item list is an authorization item list corresponding to external items. The second authorization item list includes a list of external items accessible to each container in the first container group. Based on the second authorization item list, the external items accessible to any container in the first container group can be determined.
[0075] In an embodiment of the present application, when creating a Pod project, a container group label (Pod label) declaration will be made for the Pod that needs security control. Specifically, the label can be injected into each container in the Pod and the sidecar container (first proxy container) corresponding to the Pod in the form of an environment variable, and a label (label) is given to the Pod. Among them, the label is used to uniquely identify the Pod in the container management network. For access requests to containers in the Pod that are not security controlled, the proxy container corresponding to the Pod that is not security controlled may not impose access restrictions on the access request. The flexibility of access control by the first proxy container is improved by the above method.
[0076] For example, if app=projectA is injected into a Pod's container and the sidecar container corresponding to the Pod in the form of an environment variable, the name of the Pod in the container management network is projectA. When a container in the container group named projectA issues an access request, the sidecar container (i.e., the first proxy container) in the container group named projectA can pull the access control data of the Pod labeled projectA from the server. This access control data contains the first authorized project list corresponding to the internal project and the second authorized project list corresponding to the external project.
[0077] In one embodiment, the format and content of the first authorized project list corresponding to the internal project are as follows:
[0078]
[0079] Among them, projectB is the container group Pod named projectB in the container management network; project C is the container group Pod named projectC in the container management network; xxx is the access path. The above meaning is: the container group Pod named projectA in the container management network can access internal projects including projectB, projectC, etc. in the container management network.
[0080] In one embodiment, the format and content of the second authorization project list corresponding to the external project are as follows:
[0081]
[0082] Among them, www.baidu.com and www.goole.com are the domain names of external projects. The above meaning is: the external projects that the container group Pod named projectA in the container management network can access include www.baidu.com, www.goole.com, etc.
[0083] S303: If the project type is an internal project, determine the access permission judgment result according to the first authorized project list.
[0084] In one embodiment, the above-mentioned determination of the access authority judgment result based on the first authorization item list can be implemented according to the following steps B1-B4.
[0085] B1. Determine the query identification information corresponding to the target domain name.
[0086] B2. Determine the second container group to which the target domain name belongs from the container management system according to the query identification information.
[0087] In the embodiment of the present application, when the project type is an internal project, the first proxy container can quickly query the second container group to which the target domain name belongs from the container management system through the query identification information corresponding to the target domain name, thereby improving processing efficiency. Since all containers in the same container group share the same Internet Protocol address (IP address), inter-process communication (IPC), host name and other resources, the first proxy container directly forwards the target domain name accessed by any container through the container group to which the target domain name belongs, without the need to perform permission analysis on the container corresponding to the target domain name, thereby improving access control efficiency.
[0088] In one embodiment, the query identification information may be all or part of the internal service name carried in the target domain name. Specifically, when any container (e.g., container A) in the container group named projectA in the container management network accesses an internal project, the first proxy container (the sidecar container corresponding to the container group named projectA in the container management network) finds the field storing the label in the metadata of the service resource of the container management network according to the target domain name or the internal service name carried in the target domain name, so as to determine the container group Pod to which the domain name accessed by container A belongs.
[0089] Exemplarily, the project type of the target domain name accessed by any container in the first container group is an internal project, and the short domain name form of the internal project is easy-mock-mongodb, which is the name of an internal service. Then the first proxy container can find the corresponding metadata from the container management network according to the name of the internal service easy-mock-mongodb, and the metadata is as follows.
[0090]
[0091] The first proxy container searches for Selector:app=mongodb in the metadata, indicating that the label of the container group Pod to which the target domain name accessed by any container belongs is mongodb. The first proxy container then searches for the label mongodb to see if it is in the first authorized project list of the internal project.
[0092] B3. If the second container group is in the first authorization item list, then the access permission judgment result is determined to be authorized.
[0093] B4. If the second container group is not in the first authorization item list, the access permission judgment result is determined to be no permission.
[0094] In the embodiment of the present application, according to the access permission determination result, the first proxy container can perform corresponding forwarding control processing on the access request.
[0095] S304: If the project type is an external project, determine the access permission judgment result according to the second authorized project list.
[0096] In one embodiment, the above-mentioned determination of the access authority judgment result according to the second authorization item list can be implemented according to the following steps.
[0097] (1) If the target domain name is in the second authorization project list, the access permission judgment result is determined to be authorized.
[0098] (2) If the target domain name is not in the second authorization project list, the access permission judgment result is determined to be no permission.
[0099] In an embodiment of the present application, the second authorization project list includes the domain names of external projects that are allowed to be accessed. When the first proxy container determines that the project type corresponding to the target domain name accessed by any container is an external project, it can directly query whether the target domain name is included in the second authorization project list, and then determine the access permission judgment result.
[0100] S305: Control the forwarding of the access request based on the access permission determination result.
[0101] In one embodiment, the forwarding control of the access request according to the access permission determination result can be implemented according to the following steps C1-C2.
[0102] C1. When the access permission is determined to be authorized, the access request is forwarded.
[0103] C2. When the result of the access permission judgment is no permission, a prompt message of an access request is sent to any container, and the prompt message is used to indicate no permission to access.
[0104] In the embodiment of the present application, when the first proxy container determines that the access right judgment result corresponding to any container is authorized, the access request is forwarded to the object that any container wants to access to implement the access operation. When the first proxy container determines that the access right judgment result corresponding to any container is unauthorized, the access initiating object is prompted through prompt information that it has no permission to access, so that the access initiating object can understand the access status in time, thereby improving the user experience.
[0105] In one embodiment, when any container accesses an internal project, when the first proxy container determines that the access permission corresponding to any container is authorized, the first proxy container may forward the access request to the container that any container wants to access, so that any container directly accesses the container to be accessed; the first proxy container may also forward the access request to the container group where the container to be accessed by any container is located, so that the proxy container corresponding to the access receiving end receives the access request and allows any container to perform the access operation. It should be understood that the container to be accessed is the container corresponding to the target domain name, that is, the container in the container group found by the above-mentioned query metadata method.
[0106] In one embodiment, when any container accesses an external project, the first proxy container may perform a Domain Name System (DNS) resolution based on the target domain name to obtain an IP address accessed by any container, and forward the access request to the IP address.
[0107] The present application proposes that access permission control data includes a first authorization project list corresponding to internal projects and a second authorization project list corresponding to external projects. The first proxy container implements access control based on the project type of the target domain name and the authorization project list corresponding to the project type, thereby accurately implementing access control. The present application also proposes the specific forms of the first authorization project list and the second authorization project list. The first proxy container can quickly determine the domain name type corresponding to the target domain name by analyzing the specific forms such as the name information and suffix information of the target domain name, and then determine the project type, thereby improving the processing efficiency of access control.
[0108] The present application also proposes to declare container group labels for Pods that require security control. When any container accesses a container in a Pod that has security control set, the first proxy container restricts the access request; when any container accesses a container in a Pod that has not undergone security control, the first proxy container does not restrict the access request, thereby increasing the flexibility of the first proxy container in performing access control. The present application also proposes that when the first proxy container determines that any container has permission, it forwards the access request to the object that any container wants to access to implement the access operation. When the first proxy container determines that any container does not have permission, it prompts the access initiating object through a prompt message that it does not have permission to access, so that the access initiating object can understand the access status in a timely manner, thereby improving the user experience.
[0109] Since all containers in the same container group share multiple resources, the present application also proposes that when the project type corresponding to the target domain name is an internal project, the second container group to which the target domain name belongs is determined from the container management system through the query identification information corresponding to the target domain name, and then the target domain name accessed by any container is directly forwarded and controlled through the second container group to which the target domain name belongs, without the need to perform permission analysis on the container corresponding to the target domain name. When the project type corresponding to the target domain name is an external project, the first proxy container can directly query whether the target domain name is included in the second authorized project list, and then determine the access permission judgment result. Through the above method, the accuracy and efficiency of access control are improved.
[0110] See also Figure 4 , Figure 4 : is a schematic block diagram of an access control device provided by an embodiment of the present application. The access control device is applied to a first proxy container in a container management system, the container management system includes at least one container group, each container group is mounted with a corresponding proxy container, the first proxy container is a proxy container corresponding to the first container group, and the first container group is any one of the at least one container group; the access control device may specifically include:
[0111] The acquisition module 401 is used to acquire an access request of any container in the first container group, where the access request includes a target domain name;
[0112] The processing module 402 is used to determine the type of project accessed by any of the above containers according to the above target domain name, and obtain access permission control data of the above first container group;
[0113] The control module 403 is used to control the forwarding of the access request according to the project type and the access permission control data.
[0114] Optionally, when the processing module 402 is used to determine the type of the project accessed by any of the containers according to the target domain name, it is specifically used to:
[0115] Acquire characteristic information of the target domain name, the characteristic information including one or more of name information and suffix information;
[0116] Determine the domain name type of the target domain name according to the characteristic information;
[0117] If the domain name type of the target domain name is a short domain name, determining that the project type accessed by any of the containers is an internal project; wherein the internal project refers to a project in the container management system;
[0118] If the domain name type of the target domain name is not the short domain name, it is determined that the project type accessed by any of the containers is an external project; wherein the external project refers to a project outside the container management system.
[0119] Optionally, when the processing module 402 is used to determine the domain name type of the target domain name according to the characteristic information, it is specifically used to:
[0120] Determine whether the characteristic information of the target domain name meets preset conditions, where the preset conditions include that the name information is an internal service name and the suffix information is one or more of the preset suffixes;
[0121] If the characteristic information of the target domain name meets the preset conditions, determining that the domain name type of the target domain name is a short domain name;
[0122] If the characteristic information of the target domain name does not meet the preset condition, it is determined that the domain name type of the target domain name is not a short domain name.
[0123] Optionally, the type of project accessed by any of the above containers is one of an internal project or an external project, the above internal project refers to a project in the above container management system, and the above external project refers to a project outside the above container management system; the above access permission control data includes a first authorized project list and a second authorized project list, the above first authorized project list is an authorized project list corresponding to the above internal project, and the above second authorized project list is an authorized project list corresponding to the above external project;
[0124] When the control module 403 is used to control the forwarding of the access request according to the project type and the access permission control data, it is specifically used to:
[0125] If the above project type is an internal project, the access permission judgment result is determined according to the above first authorized project list;
[0126] If the above-mentioned project type is an external project, the access permission judgment result is determined according to the above-mentioned second authorized project list;
[0127] According to the access permission determination result, the access request is forwarded and controlled.
[0128] Optionally, when the control module 403 is used to determine the access authority determination result according to the first authorization item list, it is specifically used to:
[0129] Determine the query identification information corresponding to the target domain name;
[0130] Determine the second container group to which the target domain name belongs from the container management system according to the query identification information;
[0131] If the second container group is in the first authorization item list, determining the access permission judgment result is authorized;
[0132] If the second container group is not in the first authorization item list, the access permission determination result is determined to be no permission.
[0133] Optionally, when the control module 403 is used to determine the access authority determination result according to the second authorization item list, it is specifically used to:
[0134] If the target domain name is in the second authorization item list, the access right judgment result is determined to be authorized;
[0135] If the target domain name is not in the second authorization item list, the access permission judgment result is determined to be no permission.
[0136] Optionally, when the control module 403 is used to control the forwarding of the access request according to the access authority determination result, it is specifically used to:
[0137] When the access permission is determined to be authorized, the access request is forwarded;
[0138] When the access permission judgment result is no permission, a prompt message of the access request is sent to any of the containers, and the prompt message is used to indicate no permission to access.
[0139] It should be noted that the functions of the various functional modules of the access control device of the embodiment of the present application can be specifically implemented according to the method in the above method embodiment. The specific implementation process can refer to the relevant description of the above method embodiment, which will not be repeated here.
[0140] See also Figure 5 , Figure 5 501, storage device 502 and communication interface 503. The processor 501, storage device 502 and communication interface 503 can exchange data.
[0141] The above-mentioned storage device 502 may include a volatile memory (volatile memory), such as a random-access memory (RAM); the storage device 502 may also include a non-volatile memory (non-volatile memory), such as a flash memory, a solid-state drive (SSD), etc.; the above-mentioned storage device 502 may also include a combination of the above-mentioned types of memory.
[0142] The processor 501 may be a central processing unit (CPU). In one embodiment, the processor 501 may also be a graphics processing unit (GPU). The processor 501 may also be a combination of a CPU and a GPU. In one embodiment, the storage device 502 is used to store program instructions, which are applied to a first proxy container in a container management system. The container management system includes at least one container group, each container group is mounted with a corresponding proxy container, the first proxy container is a proxy container corresponding to the first container group, and the first container group is any one of the at least one container group. The processor 501 may call the program instructions to perform the following operations:
[0143] Obtaining an access request of any container in the first container group, wherein the access request includes a target domain name;
[0144] Determine the project type accessed by any of the above containers according to the above target domain name, and obtain access permission control data of the above first container group;
[0145] The access request is forwarded and controlled according to the project type and the access permission control data.
[0146] Optionally, when the processor 501 is used to determine the type of the project accessed by any of the containers according to the target domain name, it is specifically used to:
[0147] Acquire characteristic information of the target domain name, the characteristic information including one or more of name information and suffix information;
[0148] Determine the domain name type of the target domain name according to the characteristic information;
[0149] If the domain name type of the target domain name is a short domain name, determining that the project type accessed by any of the containers is an internal project; wherein the internal project refers to a project in the container management system;
[0150] If the domain name type of the target domain name is not the short domain name, it is determined that the project type accessed by any of the containers is an external project; wherein the external project refers to a project outside the container management system.
[0151] Optionally, when the processor 501 is used to determine the domain name type of the target domain name according to the characteristic information, it is specifically used to:
[0152] Determine whether the characteristic information of the target domain name meets preset conditions, where the preset conditions include that the name information is an internal service name and the suffix information is one or more of the preset suffixes;
[0153] If the characteristic information of the target domain name meets the preset conditions, determining that the domain name type of the target domain name is a short domain name;
[0154] If the characteristic information of the target domain name does not meet the preset condition, it is determined that the domain name type of the target domain name is not a short domain name.
[0155] Optionally, the type of project accessed by any of the above containers is one of an internal project or an external project, the above internal project refers to a project in the above container management system, and the above external project refers to a project outside the above container management system; the above access permission control data includes a first authorized project list and a second authorized project list, the above first authorized project list is an authorized project list corresponding to the above internal project, and the above second authorized project list is an authorized project list corresponding to the above external project;
[0156] When the processor 501 is used to control the forwarding of the access request according to the project type and the access permission control data, it is specifically used to:
[0157] If the above project type is an internal project, the access permission judgment result is determined according to the above first authorized project list;
[0158] If the above-mentioned project type is an external project, the access permission judgment result is determined according to the above-mentioned second authorized project list;
[0159] According to the access permission determination result, the access request is forwarded and controlled.
[0160] Optionally, when the processor 501 is used to determine the access authority determination result according to the first authorization item list, it is specifically used to:
[0161] Determine the query identification information corresponding to the target domain name;
[0162] Determine the second container group to which the target domain name belongs from the container management system according to the query identification information;
[0163] If the second container group is in the first authorization item list, determining the access permission judgment result is authorized;
[0164] If the second container group is not in the first authorization item list, the access permission determination result is determined to be no permission.
[0165] Optionally, when the processor 501 is used to determine the access authority determination result according to the second authorization item list, it is specifically used to:
[0166] If the target domain name is in the second authorization item list, the access right judgment result is determined to be authorized;
[0167] If the target domain name is not in the second authorization item list, the access permission judgment result is determined to be no permission.
[0168] Optionally, when the processor 501 is used to control the forwarding of the access request according to the access permission determination result, it is specifically used to:
[0169] When the access permission is determined to be authorized, the access request is forwarded;
[0170] When the access permission judgment result is no permission, a prompt message of the access request is sent to any of the containers, and the prompt message is used to indicate no permission to access.
[0171] In a specific implementation, the processor 501, the storage device 502, and the communication interface 503 described in the embodiments of the present application can execute the embodiments of the present application. Figure 2 or Figure 3 The implementation method described in the relevant embodiments of the access control method provided can also be implemented in the embodiments of the present application Figure 4 The implementation methods described in the relevant embodiments of the provided access control device will not be repeated here.
[0172] In the several embodiments provided in the present application, it should be understood that the disclosed methods, devices and systems can be implemented in other ways. For example, the device embodiments described above are merely schematic; for example, the division of the units is only a logical function division, and there may be other division methods in actual implementation; for example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0173] In addition, it should be pointed out here that: the embodiment of the present application also provides a computer-readable storage medium, and the computer-readable storage medium stores a computer program executed by the access control device mentioned above, and the computer program includes program instructions. When the processor executes the above program instructions, it can execute the above Figure 2 , Figure 3 The method in the corresponding embodiment, therefore, will not be repeated here. In addition, the description of the beneficial effects of the same method will not be repeated. For technical details not disclosed in the computer-readable storage medium embodiment involved in this application, please refer to the description of the method embodiment of this application. As an example, the program instructions can be deployed on a computer device, or executed on multiple computer devices located in one location, or, executed on multiple computer devices distributed in multiple locations and interconnected by a communication network, and multiple computer devices distributed in multiple locations and interconnected by a communication network can constitute a blockchain system.
[0174] According to one aspect of the present application, a computer program product or a computer program is provided, the computer program product or the computer program comprising computer instructions, the computer instructions being stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device can perform the above Figure 2 , Figure 3 The method in the corresponding embodiment will therefore not be described in detail here.
[0175] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiments can be implemented by instructing related hardware through a computer program, and the above-mentioned program can be stored in a computer-readable storage medium, and when the program is executed, it can include the processes of the embodiments of the above-mentioned methods. The above-mentioned storage medium can be a disk, an optical disk, a read-only memory (ROM) or a random access memory (RAM), etc.
[0176] The above disclosure is only part of the embodiments of the present application, which certainly cannot be used to limit the scope of rights of the present application. Ordinary technicians in this field can understand that all or part of the processes of implementing the above embodiments and making equivalent changes according to the claims of this application are still within the scope of the invention.< / namespace> < / namespace>
Claims
1. An access control method, characterized in that: A first proxy container applied to a container management system, the container management system includes at least one container group, each container group is mounted with a corresponding proxy container, the first proxy container is a proxy container corresponding to the first container group, and the first container group is any one of the at least one container group; the method includes: Obtaining an access request of any container in the first container group, where the access request includes a target domain name; Determine the type of project accessed by any one of the containers according to the target domain name, and obtain access permission control data of the first container group; forwarding control of the access request according to the project type and the access permission control data; The forwarding control of the access request according to the project type and the access permission control data includes: If the project type is an internal project of the container management system, forwarding control of the access request is performed using access permission control data on the internal project; If the project type is an external project of the container management system, the access request is forwarded and controlled using access permission control data about the external project.
2. The method according to claim 1, characterized in that The determining the type of the item accessed by any container according to the target domain name includes: Acquire characteristic information of the target domain name, where the characteristic information includes one or more of name information and suffix information; Determine the domain name type of the target domain name according to the characteristic information; If the domain name type of the target domain name is a short domain name, determining that the project type accessed by any container is an internal project; wherein the internal project refers to a project in the container management system; If the domain name type of the target domain name is not the short domain name, it is determined that the project type accessed by any container is an external project; wherein the external project refers to a project outside the container management system.
3. The method according to claim 2, characterized in that The determining the domain name type of the target domain name according to the characteristic information includes: Determine whether the characteristic information of the target domain name meets a preset condition, wherein the preset condition includes that the name information is an internal service name, and the suffix information is one or more of a preset suffix; If the characteristic information of the target domain name meets the preset condition, determining that the domain name type of the target domain name is a short domain name; If the characteristic information of the target domain name does not meet the preset condition, it is determined that the domain name type of the target domain name is not a short domain name.
4. The method according to any one of claims 1 to 3, characterized in that The type of project accessed by any container is one of an internal project and an external project, wherein the internal project refers to a project in the container management system, and the external project refers to a project outside the container management system; The access permission control data includes a first authorization item list and a second authorization item list, wherein the first authorization item list is a list of authorization items corresponding to the internal items, and the second authorization item list is a list of authorization items corresponding to the external items; The forwarding control of the access request according to the project type and the access permission control data includes: If the project type is an internal project, determining the access permission judgment result according to the first authorized project list; If the project type is an external project, determining the access permission judgment result according to the second authorized project list; The access request is forwarded and controlled according to the access permission determination result.
5. The method according to claim 4, characterized in that The step of determining the access permission judgment result according to the first authorization item list includes: Determine the query identification information corresponding to the target domain name; Determine, from the container management system according to the query identification information, a second container group to which the target domain name belongs; If the second container group is in the first authorization item list, determining that the access permission judgment result is authorized; If the second container group is not in the first authorization item list, it is determined that the access permission judgment result is no permission.
6. The method according to claim 4, characterized in that The step of determining the access permission judgment result according to the second authorization item list includes: If the target domain name is in the second authorization item list, determining that the access right judgment result is authorized; If the target domain name is not in the second authorization item list, it is determined that the access authority judgment result is no authority.
7. The method according to claim 4, characterized in that The forwarding control of the access request according to the access permission judgment result includes: When the access permission is determined to be authorized, forwarding the access request; When the access permission judgment result is no permission, a prompt message of the access request is sent to any container, and the prompt message is used to indicate no permission to access.
8. An access control device, characterized in that: A first proxy container applied to a container management system, the container management system includes at least one container group, each container group is mounted with a corresponding proxy container, the first proxy container is a proxy container corresponding to the first container group, and the first container group is any one of the at least one container group; the device includes: an acquisition module, configured to acquire an access request of any container in the first container group, wherein the access request includes a target domain name; A processing module, configured to determine the type of project accessed by any one of the containers according to the target domain name, and obtain access permission control data of the first container group; A control module, used for controlling the forwarding of the access request according to the project type and the access permission control data; Wherein, the control module is specifically used for: If the project type is an internal project of the container management system, forwarding control of the access request is performed using access permission control data on the internal project; If the project type is an external project of the container management system, the access request is forwarded and controlled using access permission control data on the external project.
9. A computer device, characterized in that: include: A processor, a storage device and a communication interface, wherein the processor, the communication interface and the storage device are connected to each other, wherein the storage device stores an executable program code, and the processor is used to call the executable program code to implement the access control method as described in any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, wherein the computer program includes program instructions, and the program instructions are executed by a processor to implement the access control method according to any one of claims 1 to 7.
