CN116781301A - Cross-namespace container security protection methods, devices, equipment and media - Google Patents
Cross-namespace container security protection methods, devices, equipment and media Download PDFInfo
- Publication number
- CN116781301A CN116781301A CN202210234155.6A CN202210234155A CN116781301A CN 116781301 A CN116781301 A CN 116781301A CN 202210234155 A CN202210234155 A CN 202210234155A CN 116781301 A CN116781301 A CN 116781301A
- Authority
- CN
- China
- Prior art keywords
- namespace
- remote
- protection
- policy
- agent
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
- 238000000034 method Methods 0.000 title claims abstract description 95
- 238000004891 communication Methods 0.000 claims abstract description 22
- 239000003795 chemical substances by application Substances 0.000 claims description 252
- 230000006870 function Effects 0.000 claims description 23
- 239000013598 vector Substances 0.000 claims description 18
- 238000004590 computer program Methods 0.000 claims description 13
- 238000012544 monitoring process Methods 0.000 claims description 12
- 238000012216 screening Methods 0.000 claims description 9
- 238000004422 calculation algorithm Methods 0.000 claims description 8
- 230000002457 bidirectional effect Effects 0.000 claims description 6
- 238000004140 cleaning Methods 0.000 claims description 6
- 238000013519 translation Methods 0.000 claims description 5
- 230000001681 protective effect Effects 0.000 claims 1
- 230000007246 mechanism Effects 0.000 abstract description 8
- 230000008569 process Effects 0.000 description 24
- 238000005516 engineering process Methods 0.000 description 16
- 238000010586 diagram Methods 0.000 description 14
- 230000002265 prevention Effects 0.000 description 5
- 238000001914 filtration Methods 0.000 description 4
- 238000002955 isolation Methods 0.000 description 4
- 238000004458 analytical method Methods 0.000 description 2
- 230000000694 effects Effects 0.000 description 2
- 239000000284 extract Substances 0.000 description 2
- 230000006872 improvement Effects 0.000 description 2
- 238000012986 modification Methods 0.000 description 2
- 230000004048 modification Effects 0.000 description 2
- 230000003287 optical effect Effects 0.000 description 2
- 230000003068 static effect Effects 0.000 description 2
- 238000006467 substitution reaction Methods 0.000 description 2
- 101100409014 Rhizobium meliloti (strain 1021) ppdK gene Proteins 0.000 description 1
- 230000005540 biological transmission Effects 0.000 description 1
- 230000015572 biosynthetic process Effects 0.000 description 1
- 238000004364 calculation method Methods 0.000 description 1
- 238000001514 detection method Methods 0.000 description 1
- 238000011161 development Methods 0.000 description 1
- 238000012423 maintenance Methods 0.000 description 1
- 238000013507 mapping Methods 0.000 description 1
- 238000013508 migration Methods 0.000 description 1
- 230000005012 migration Effects 0.000 description 1
- 230000006855 networking Effects 0.000 description 1
- 238000007781 pre-processing Methods 0.000 description 1
- 238000012545 processing Methods 0.000 description 1
- 238000003672 processing method Methods 0.000 description 1
- 238000003786 synthesis reaction Methods 0.000 description 1
- 238000012360 testing method Methods 0.000 description 1
- 238000012546 transfer Methods 0.000 description 1
Landscapes
- Data Exchanges In Wide-Area Networks (AREA)
Abstract
Description
技术领域Technical field
本发明涉及网络安全技术领域,具体涉及一种跨命名空间的容器安全防护方法、装置、设备及介质。The present invention relates to the field of network security technology, and specifically relates to a cross-namespace container security protection method, device, equipment and medium.
背景技术Background technique
在网络安全技术领域中,容器环境下的安全防护是一种端到端的访问控制方法,访问控制与网络环境是息息相关,网络环境的变化将会对其提出新的要求。In the field of network security technology, security protection in container environments is an end-to-end access control method. Access control is closely related to the network environment, and changes in the network environment will put new requirements on it.
目前广泛使用的容器安全防护方法主要是通过ingress网关对容器环境进行安全防护,以及通过云原生自带的network policy技术来实现防护。Currently, the widely used container security protection methods mainly use ingress gateways to protect the container environment, and cloud native network policy technology to achieve protection.
但由于ingress网关只能提供南北向安全服务,无法做到任意两个容器之间的东西向安全防护,而network policy技术只能提供基础的容器间的访问控制功能,只能针对传输层五元组进行访问控制,无法实现4-7层的高级安全功能,无基于内容的入侵防御、恶意代码过滤等功能。However, since the ingress gateway can only provide north-south security services and cannot provide east-west security protection between any two containers, the network policy technology can only provide basic inter-container access control functions and can only target the transport layer. Group access control cannot implement advanced security functions of layers 4 to 7, and there is no content-based intrusion prevention, malicious code filtering and other functions.
有鉴于此,亟需提供一种新的容器安全防护方法,以实现跨命名空间的东西向安全防护。In view of this, there is an urgent need to provide a new container security protection method to achieve east-west security protection across namespaces.
发明内容Contents of the invention
本发明提供一种跨命名空间的容器安全防护,用以解决跨命名空间的容器安全防护的技术问题。The present invention provides a cross-namespace container security protection to solve the technical problem of cross-namespace container security protection.
第一方面,本发明提供一种跨命名空间的容器安全防护方法,包括:In a first aspect, the present invention provides a cross-namespace container security protection method, including:
在根命名空间中部署根命名空间安全防护组件master agent;Deploy the root namespace security protection component master agent in the root namespace;
在所述master agent监听到当前网络环境节点上新建了远程命名空间的情况下,控制所述master agent在所述根命名空间中生成一个远程命名空间安全防护组件remoteagent;When the master agent detects that a remote namespace is newly created on the current network environment node, control the master agent to generate a remote namespace security protection component remoteagent in the root namespace;
将所述remote agent的运行空间切换至所述远程命名空间;Switch the running space of the remote agent to the remote namespace;
控制所述remote agent在所述远程命名空间中执行安全防护,并控制所述masteragent在所述根命名空间中执行安全防护;Control the remote agent to perform security protection in the remote namespace, and control the masteragent to perform security protection in the root namespace;
所述remote agent与所述master agent的安全防护功能一致。The security protection functions of the remote agent and the master agent are consistent.
在一个实施例中,控制所述remote agent在所述远程命名空间中执行安全防护,并控制所述master agent在所述根命名空间中执行安全防护,包括:In one embodiment, controlling the remote agent to perform security protection in the remote namespace, and controlling the master agent to perform security protection in the root namespace include:
利用系统内核中的地址转换管理工具NFQ,分别将所述远程命名空间中的数据报文引入至所述remote agent,以供所述remote agent执行对所述远程命名空间中的数据报文的安全防护;Utilize the address translation management tool NFQ in the system kernel to introduce the data packets in the remote namespace to the remote agent respectively, so that the remote agent can perform security of the data packets in the remote namespace. protection; protection
利用所述NFQ将所述根命名空间中的数据报文引入至所述master agent,以供所述master agent执行对所述根命名空间中的数据报文的安全防护。The NFQ is used to introduce the data packets in the root namespace to the master agent, so that the master agent can perform security protection on the data packets in the root namespace.
在一个实施例中,在将所述remote agent的运行空间切换至所述远程容器所对应的远程命名空间之后,还包括:In one embodiment, after switching the running space of the remote agent to the remote namespace corresponding to the remote container, the method further includes:
在所述master agent中建立一个远程过程调用客户端RPC client,并在所述remote agent中建立一个远程过程调用服务端RPC server;Establish a remote procedure call client RPC client in the master agent, and establish a remote procedure call server RPC server in the remote agent;
建立所述RPC client与所述RPC server之间的通信,以供所述remote agent将策略配置信息发送至所述master agent;Establish communication between the RPC client and the RPC server for the remote agent to send policy configuration information to the master agent;
由所述master agent将所述策略配置信息上传至管理端;The master agent uploads the policy configuration information to the management end;
所述策略配置信息包括现有防护策略的标签、report日志以及监控信息。The policy configuration information includes labels of existing protection policies, report logs, and monitoring information.
在一个实施例中,由所述master agent将所述策略配置信息上传至管理端之后,还包括:In one embodiment, after the master agent uploads the policy configuration information to the management end, it also includes:
由所述管理端根据所述策略配置信息,从策略库中匹配出公共防护策略集,并将所述公共防护策略集下发至所述master agent;The management end matches a public protection policy set from the policy library according to the policy configuration information, and delivers the public protection policy set to the master agent;
由所述master agent确定所述公共防护策略集中的各防护策略的标签与所述remote agent中现有防护策略的标签之间的交集作为公共标签;The master agent determines the intersection between the labels of each protection strategy in the public protection strategy set and the labels of the existing protection strategies in the remote agent as a public label;
由所述master agent将与所述公共标签相关的防护策略下发至所述远程命名空间。The master agent delivers the protection policy related to the public label to the remote namespace.
在一个实施例中,所述由所述管理端根据所述策略配置信息,从策略库中匹配出公共防护策略集,包括由所述管理端执行以下操作:In one embodiment, the management end matching the public protection policy set from the policy library according to the policy configuration information includes the management end performing the following operations:
基于标签匹配算法,对所述策略库中的所有防护策略进行初筛;Based on the tag matching algorithm, perform a preliminary screening of all protection strategies in the strategy library;
对通过初筛获取到的所有防护策略进行清洗,以从中筛除为空的防护策略以及与所述远程命名空间不匹配的策略;Clean all protection policies obtained through the preliminary screening to filter out empty protection policies and policies that do not match the remote namespace;
根据所述策略配置信息,对通过清洗后的所有防护策略进行交集去重,获取所述公共防护策略集。According to the policy configuration information, all the cleaned protection policies are intersected and deduplicated to obtain the public protection policy set.
在一个实施例中,所述根据所述策略配置信息,对通过清洗后的所有防护策略进行交集去重,获取所述公共防护策略集,包括:In one embodiment, performing intersection deduplication on all protection policies after cleaning according to the policy configuration information to obtain the public protection policy set includes:
计算每个所述清洗后的防护策略所对应的标签特征向量,并计算所述remoteagent的标签所对应的远端标签特征向量;Calculate the tag feature vector corresponding to each of the cleaned protection strategies, and calculate the remote tag feature vector corresponding to the remoteagent tag;
根据每个所述策略标签特征向量与所述远端标签特征向量之间的距离与预设阈值的比较结果,确定所有防护策略中的重复防护策略;Determine the duplicate protection strategy among all protection strategies based on the comparison result between the distance between each policy tag feature vector and the remote tag feature vector and the preset threshold;
从所有防护策略中筛除所述重复防护策略,获取所述公共防护策略集。Filter out the duplicate protection policies from all protection policies to obtain the public protection policy set.
在一个实施例中,由所述master agent将与所述公共标签相关的防护策略下发至所述远程命名空间,包括由所述master agent执行以下操作:In one embodiment, the master agent delivers the protection policy related to the public label to the remote namespace, including the master agent performing the following operations:
确定每个与公共标签相关的防护策略的策略模式;若所述策略模式为入站模式,则将所述防护策略的公共标签写入至dst区;若所述策略模式为出站模式,则将所述防护策略的公共标签写入至src区;若所述策略模式为双向模式,则将所述防护策略的公共标签写入至所述dst区和所述src区;Determine the policy mode of each protection policy related to the public label; if the policy mode is the inbound mode, then write the public label of the protection policy to the dst area; if the policy mode is the outbound mode, then Write the public label of the protection strategy into the src area; if the policy mode is a bidirectional mode, write the public label of the protection strategy into the dst area and the src area;
若所述防护策略的策略模式为入站模式,根据所述dst区中的标签与每个所述remote agent的标签的匹配度,确定目标远程命名空间,以供所述目标远程命名空间将所述防护策略配置到remote agent的networksACL和xRules中;If the policy mode of the protection policy is inbound mode, the target remote namespace is determined based on the matching degree between the tags in the dst area and the tags of each remote agent, so that the target remote namespace can store all Configure the above protection policy into the networksACL and xRules of the remote agent;
若所述防护策略的策略模式为出站模式,根据所述src区中的标签与每个所述remote agent的标签的匹配度,确定目标远程命名空间,以供所述目标远程命名空间将所述防护策略配置到remote agent的ApplicationACLs和xRules中;If the policy mode of the protection policy is outbound mode, determine the target remote namespace based on the matching degree between the tags in the src area and the tags of each remote agent, so that the target remote namespace can store all Configure the above protection policy into the ApplicationACLs and xRules of the remote agent;
若所述防护策略的策略模式为双向模式,根据所述dst区和所述src区中的标签与每个所述remote agent的标签的匹配度,确定目标远程命名空间,以供所述目标远程命名空间将所述防护策略配置到networksACL、ApplicationACLs以及xRules中。If the policy mode of the protection policy is a two-way mode, the target remote namespace is determined based on the matching degree between the labels in the dst area and the src area and the labels of each remote agent for the target remote agent. The namespace configures the protection policy into networksACLs, ApplicationACLs, and xRules.
第二方面,本发明提供一种跨命名空间的容器安全防护装置,包括:In a second aspect, the present invention provides a cross-namespace container security protection device, including:
组件部署单元,用于在根命名空间中部署根命名空间安全防护组件masteragent;The component deployment unit is used to deploy the root namespace security protection component masteragent in the root namespace;
监控部署单元,用于在所述master agent监听到当前网络环境节点上新建了远程命名空间的情况下,控制所述master agent在所述根命名空间中生成一个远程命名空间安全防护组件remote agent;A monitoring deployment unit is used to control the master agent to generate a remote namespace security protection component remote agent in the root namespace when the master agent detects that a new remote namespace is created on the current network environment node;
空间切换单元,用于将所述remote agent的运行空间切换至所述远程命名空间;A space switching unit, used to switch the running space of the remote agent to the remote namespace;
防护控制单元,用于控制所述remote agent在所述远程命名空间中执行安全防护,并控制所述master agent在所述根命名空间中执行安全防护;A protection control unit, used to control the remote agent to perform security protection in the remote namespace, and to control the master agent to perform security protection in the root namespace;
所述remote agent与所述master agent的安全防护功能一致。The security protection functions of the remote agent and the master agent are consistent.
第三方面,本发明提供一种电子设备,包括存储器和存储有计算机程序的存储器,所述处理器执行所述程序时实现第一方面所述跨命名空间的容器安全防护方法的步骤。In a third aspect, the present invention provides an electronic device, including a memory and a memory storing a computer program. When the processor executes the program, the steps of the cross-namespace container security protection method described in the first aspect are implemented.
第四方面,本发明提供一种处理器可读存储介质,所述处理器可读存储介质存储有计算机程序,所述计算机程序用于使所述处理器执行第一方面所述跨命名空间的容器安全防护方法的步骤。。In a fourth aspect, the present invention provides a processor-readable storage medium. The processor-readable storage medium stores a computer program. The computer program is used to cause the processor to execute the cross-namespace operation described in the first aspect. Steps for container security methods. .
本发明提供的跨命名空间的容器安全防护方法、装置、设备及介质,通过部署一个master agent,随命名空间创建自动生成remote agent,以实现在每个远程命名空间下都有一个remote agent防护组件,然后通过NFQ机制、截获对应命名空间内的容器的通信流量,能有效地实现容器环境中,不同命名空间以及命名空间内部的容器安全防护。The cross-namespace container security protection method, device, equipment and medium provided by the present invention deploy a master agent and automatically generate a remote agent with the creation of the namespace, so as to realize that there is a remote agent protection component under each remote namespace. , and then intercept the communication traffic of containers in the corresponding namespace through the NFQ mechanism, which can effectively implement container security protection in different namespaces and within the namespace in the container environment.
附图说明Description of drawings
为了更清楚地说明本发明或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作一简单地介绍,显而易见地,下面描述中的附图是本发明的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。In order to explain the present invention or the technical solutions in the prior art more clearly, the drawings needed to be used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings in the following description are of the present invention. For some embodiments of the invention, those of ordinary skill in the art can also obtain other drawings based on these drawings without exerting creative efforts.
图1是本发明提供的跨命名空间的容器安全防护方法的流程示意图之一;Figure 1 is one of the flow diagrams of the cross-namespace container security protection method provided by the present invention;
图2是本发明提供的容器环境部署场景的结构示意图;Figure 2 is a schematic structural diagram of a container environment deployment scenario provided by the present invention;
图3是本发明提供的跨命名空间的容器安全防护方法的流程示意图之二;Figure 3 is the second schematic flow chart of the cross-namespace container security protection method provided by the present invention;
图4是本发明提供的安全防护组件的工作原理示意图;Figure 4 is a schematic diagram of the working principle of the safety protection component provided by the present invention;
图5是本发明提供的远程安全防护组件建立后的安全防护的原理示意图;Figure 5 is a schematic diagram of the principle of security protection after the remote security protection component provided by the present invention is established;
图6是本发明提供的一种安全策略配置管理的流程示意图;Figure 6 is a schematic flow chart of security policy configuration management provided by the present invention;
图7是本发明提供的安全防护组件传递策略信息的流程示意图;Figure 7 is a schematic flowchart of the security protection component provided by the present invention for transmitting policy information;
图8是本发明提供的跨命名空间的容器安全防护方法的流程示意图之三;Figure 8 is the third schematic flowchart of the cross-namespace container security protection method provided by the present invention;
图9是本发明提供的跨命名空间的容器安全防护装置的结构示意图;Figure 9 is a schematic structural diagram of a cross-namespace container security protection device provided by the present invention;
图10是本发明提供的电子设备的结构示意图。Figure 10 is a schematic structural diagram of the electronic device provided by the present invention.
具体实施方式Detailed ways
为使本发明的目的、技术方案和优点更加清楚,下面将结合本发明中的附图,对本发明中的技术方案进行清楚、完整地描述,显然,所描述的实施例是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有作出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。In order to make the purpose, technical solutions and advantages of the present invention more clear, the technical solutions in the present invention will be clearly and completely described below in conjunction with the accompanying drawings of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention. , not all examples. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without making creative efforts fall within the scope of protection of the present invention.
需要说明的是,在本发明实施例的描述中,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、物品或者设备不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、物品或者设备所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括所述要素的过程、方法、物品或者设备中还存在另外的相同要素。对于本领域的普通技术人员而言,可以根据具体情况理解上述术语在本发明中的具体含义。It should be noted that in the description of the embodiments of the present invention, the terms "comprising", "comprising" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or equipment including a series of elements It includes not only those elements but also other elements not expressly listed or inherent in the process, method, article or equipment. Without further limitation, an element defined by the statement "comprises a..." does not exclude the presence of additional identical elements in a process, method, article, or apparatus that includes the stated element. For those of ordinary skill in the art, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.
本发明中的术语“第一”、“第二”等是用于区别类似的对象,而不用于描述特定的顺序或先后次序。应该理解这样使用的数据在适当情况下可以互换,以便本申请的实施例能够以除了在这里图示或描述的那些以外的顺序实施,且“第一”、“第二”等所区分的对象通常为一类,并不限定对象的个数,例如第一对象可以是一个,也可以是多个。此外,“和/或”表示所连接对象的至少其中之一,字符“/”,一般表示前后关联对象是一种“或”的关系。The terms "first", "second", etc. in the present invention are used to distinguish similar objects, but are not used to describe a specific order or sequence. It is to be understood that the figures so used are interchangeable under appropriate circumstances so that the embodiments of the present application can be practiced in orders other than those illustrated or described herein, and that "first," "second," etc. are distinguished Objects are usually of one type, and the number of objects is not limited. For example, the first object can be one or multiple. In addition, "and/or" indicates at least one of the connected objects, and the character "/" generally indicates that the related objects are in an "or" relationship.
在介绍本发明所提供的跨命名空间的容器安全防护方法、装置、设备及介质之前,先简单介绍一下本发明的所涉及的相关知识点。Before introducing the cross-namespace container security protection method, device, equipment and medium provided by the present invention, the relevant knowledge points involved in the present invention will be briefly introduced.
本发明所涉及的跨命名空间的容器安全防护,是网络安全技术领域中端到端的访问控制的一种方法,访问控制与网络环境是息息相关,网络环境的变化将会对其提出新的要求。The cross-namespace container security protection involved in the present invention is a method of end-to-end access control in the field of network security technology. Access control is closely related to the network environment, and changes in the network environment will put new requirements on it.
在传统环境中,网络环境一般来说具有以下特点:In traditional environments, network environments generally have the following characteristics:
(1)网络是相对静态的,大多网络防护规则都是基于静态的IP地址和端口;(1) The network is relatively static, and most network protection rules are based on static IP addresses and ports;
(2)内部是默认可信的,网络边界较清晰,访问控制机制一般是部署在网络边界处;(2) The interior is trusted by default, the network boundary is clear, and the access control mechanism is generally deployed at the network boundary;
(3)大部分的网络流量会经过网关。(3) Most network traffic will pass through the gateway.
在此基础上,在容器(pod)环境中的访问控制具有以下特点:On this basis, access control in the container (pod) environment has the following characteristics:
(1)容器的启停和动态迁移总在发生,IP分配变换频繁;(1) The starting, stopping and dynamic migration of containers are always happening, and IP allocation changes frequently;
(2)多应用混合部署、边界不清晰、内部通信关系极其复杂,导致无法预先设置安全防护策略;(2) Mixed deployment of multiple applications, unclear boundaries, and extremely complex internal communication relationships make it impossible to set security protection strategies in advance;
(3)容器间的东西向流量可见性差,为了检测和防护看不见的流量,一般采用容器平台自带的网络策略规则(network policy),但是无法做到7层的高级访问控制;(3) The visibility of east-west traffic between containers is poor. In order to detect and protect invisible traffic, the network policy rules (network policy) that come with the container platform are generally used, but layer 7 advanced access control cannot be achieved;
(4)混合云模式下,缺少通用的技术实现跨云平台的统一访问控制,如资源云和边缘云,以及不同区域、不同业务的云之间业务通信的场景,无法做到统一访问控制。(4) Under the hybrid cloud model, there is a lack of common technology to achieve unified access control across cloud platforms, such as resource clouds and edge clouds, as well as business communication scenarios between clouds in different regions and different services. Unified access control cannot be achieved.
其中,东西向流量是指数据中心内部容器之间的流量,南北向流量是数据中心内部容器和与数据中心外(如互联网)至今的流量。Among them, east-west traffic refers to the traffic between containers inside the data center, and north-south traffic refers to the traffic between containers inside the data center and outside the data center (such as the Internet).
容器技术可以看作一种轻量级的虚拟化方式,将应用与必要的执行环境打包成容器镜像,使得应用程序可以直接在宿主机(物理机或虚拟机)中相对独立地运行。容器是在操作系统层进行应用隔离,可在宿主机内核上运行多个独立的应用运行环境。相比于传统的应用测试与部署,容器的部署无需预先考虑应用的运行环境兼容性问题;而相比于传统虚拟机,容器无需独立的操作系统内核就可在宿主机中运行,实现了更高的运行效率与资源利用率。Container technology can be regarded as a lightweight virtualization method that packages applications and necessary execution environments into container images, so that applications can run relatively independently directly on the host (physical machine or virtual machine). Containers isolate applications at the operating system layer and can run multiple independent application operating environments on the host kernel. Compared with traditional application testing and deployment, container deployment does not need to consider the compatibility of the application's operating environment in advance; and compared with traditional virtual machines, containers can run in the host machine without an independent operating system kernel, achieving more High operating efficiency and resource utilization.
随着IT技术不断发展,容器的轻量化特点使该技术在云计算中广泛应用,由于容器属于更细粒度的识别单元,不像虚拟机那样与传统硬件设备有类似的网络属性,容器间的安全无疑是巨大的威胁挑战。With the continuous development of IT technology, the lightweight characteristics of containers have made this technology widely used in cloud computing. Since containers are more fine-grained identification units and do not have similar network attributes to traditional hardware devices like virtual machines, the communication between containers Security is undoubtedly a huge threat challenge.
另外,容器集群提供桥接网络、MacVLAN、覆盖网络(Overlay)等多种组网模式,同时容器与宿主机共享操作系统内核,引入容器与宿主机之间、容器与容器之间隔离方面的安全风险。容器间的访问控制包括容器不同命名空间的网络通信,也不能像传统配置五元组访问控制策略一样进行安全防护,多次网络地址转换(Network Address Translation,NAT)使得IP寻址非常复杂,实现访问控制非常困难。In addition, container clusters provide various networking modes such as bridge network, MacVLAN, and overlay network. At the same time, containers and hosts share the operating system kernel, which introduces security risks in terms of isolation between containers and hosts and between containers. . Access control between containers includes network communication in different namespaces of the containers, and cannot be used for security protection like the traditional configuration of five-tuple access control policies. Multiple Network Address Translation (NAT) makes IP addressing very complex and difficult to implement. Access control is very difficult.
表1命名空间的类型列表Table 1 List of types of namespaces
此外,在介绍本发明之前,简单介绍本发明中所涉及到的关于容器的一些技术术语:In addition, before introducing the present invention, some technical terms related to containers involved in the present invention are briefly introduced:
命名空间(Namespace):如表1所示,为了保证容器进程之间的资源隔离,避免相互影响和干扰,Linux内核的Namespaces机制提供了UTS、User、Mount、Network、PID、IPC等命名空间,实现了主机名、用户权限、文件系统、网络、进程号、进程间通信等六项资源隔离功能。通过调用clone()函数并传入相应的系统调用参数创建容器进程,可实现对应资源内容的隔离。Namespace: As shown in Table 1, in order to ensure resource isolation between container processes and avoid mutual influence and interference, the Namespaces mechanism of the Linux kernel provides UTS, User, Mount, Network, PID, IPC and other namespaces. It implements six resource isolation functions including host name, user permissions, file system, network, process number, and inter-process communication. By calling the clone() function and passing in the corresponding system call parameters to create a container process, the corresponding resource content can be isolated.
其中,虚拟网卡Veth都是成对出现的,就像一个管道的两端,从这个管道的一端的veth进去的数据会从另一端的veth再出来。也就是说,可以使用veth接口把一个网络命名空间连接到外部的默认命名空间或者global命名空间,而物理网卡就存在这些命名空间里。veth-pair打通的是容器network namespace和宿主机root namespace间互相访问的限制,veth-pair的一端在宿主机,一端在容器中。Among them, virtual network cards Veth appear in pairs, just like the two ends of a pipe. Data entering from the veth at one end of the pipe will come out from the veth at the other end. In other words, you can use the veth interface to connect a network namespace to an external default namespace or global namespace, and the physical network cards exist in these namespaces. What veth-pair clears is the mutual access restrictions between the container network namespace and the host root namespace. One end of the veth-pair is on the host and the other end is in the container.
Cgroup:在容器中,有分配好的特定比例的CPU、IO、内存、网络等资源,这就是controller group,简称为cgroup,用于限制和隔离一组进程对系统资源的使用。对不同资源的具体管理是由各个子系统分工完成的。Cgroup: In the container, there are allocated specific proportions of CPU, IO, memory, network and other resources. This is the controller group, referred to as cgroup, which is used to limit and isolate the use of system resources by a group of processes. The specific management of different resources is completed by the division of labor of each subsystem.
地址转换管理工具NFQUEUE(缩写为NFQ):是一个iptables和ip6tables目标,其是将数据包的决定委托给用户空间软件。Address Translation Management Tool NFQUEUE (abbreviated as NFQ): is an iptables and ip6tables target that delegates packet decisions to user-space software.
例如,以下规则将要求所有去往包的数据包都要听取用户安全计划的决定。当一个数据包到达一个NFQ目标时,它就会进入与--queue-num选项给定的编号对应的队列,即NFQ是在内核中实现流量重定向的一种技术。For example, the following rule will require that all packets destined for the package listen to the user's security plan. When a packet arrives at an NFQ destination, it enters the queue corresponding to the number given by the --queue-num option. NFQ is a technology that implements traffic redirection in the kernel.
安全防护组件agent:本发明所涉及的agent是指本领域通俗认为的容器安全引擎,该引擎可实现容器间访问控制等安全防护,主要利用NFQ进行数据流量重定向。agent的防护过程,类似于在数据包通信线路上添加一个虚拟的防火墙,与传统安全防护逻辑是一致的,而NFQ的功能就相当于交换机的作用,将数据流量引至安全防护组件agent。Security protection component agent: The agent involved in the present invention refers to what is generally considered in the field as a container security engine. This engine can implement security protection such as inter-container access control and mainly uses NFQ to redirect data traffic. The agent's protection process is similar to adding a virtual firewall on the data packet communication line, which is consistent with the traditional security protection logic. The function of NFQ is equivalent to the role of a switch, directing data traffic to the security protection component agent.
但是,由于Linux命名空间的隔离作用,导致agent只能针对agent进程所在的命名空间内的流量进行安全防护,也就是agent无法截获其他命名空间中的通信流量,因此该防护方式对跨命名空间的容器的安全防护,就失去作用了。However, due to the isolation effect of the Linux namespace, the agent can only provide security protection for traffic in the namespace where the agent process is located. That is, the agent cannot intercept communication traffic in other namespaces. Therefore, this protection method does not protect traffic across namespaces. The security protection of the container is useless.
下面,通过剖析现有的通过ingress网关对容器环境进行安全防护方法,以及原生自带的network policy防护方法,来进一步阐述本发明所作出的改进方向以及改进原理。Next, by analyzing the existing security protection methods for the container environment through ingress gateways and the native network policy protection methods, the improvement direction and improvement principle of the present invention will be further explained.
关于现有技术一,通过ingress网关对容器环境进行安全防护方法:Regarding existing technology 1, a method for security protection of a container environment through an ingress gateway:
Ingress网关作为容器的服务入口,提供权限控制、入侵防御等安全防护功能。通常情况下,service和pod的IP仅可在集群内部访问。集群外部的请求需要通过负载均衡转发到service在Node上暴露的NodePort上,然后再由kube-proxy将其转发给相关的Pod。而Ingress就是为进入集群的请求提供路由规则的集合,Ingress可以给service提供集群外部访问的URL、负载均衡、SSL终止、HTTP路由等。为了配置这些Ingress规则,集群管理员需要部署一个Ingress controller,由其监听Ingress和service的变化,并根据规则配置负载均衡并提供访问入口。As the service entrance of the container, the Ingress gateway provides security protection functions such as permission control and intrusion prevention. Normally, service and pod IPs are only accessible within the cluster. Requests from outside the cluster need to be forwarded to the NodePort exposed by the service on the Node through load balancing, and then forwarded to the relevant Pod by kube-proxy. Ingress provides a collection of routing rules for requests entering the cluster. Ingress can provide services with URLs for external access to the cluster, load balancing, SSL termination, HTTP routing, etc. In order to configure these Ingress rules, the cluster administrator needs to deploy an Ingress controller, which monitors changes in Ingress and services, configures load balancing according to the rules, and provides access.
因此,Ingress所解决的是新的服务加入后,域名和服务的对应问题,基本上是一个ingress的对象,通过yaml进行创建和更新进行加载。Therefore, what Ingress solves is the corresponding problem between domain names and services after new services are added. It is basically an ingress object, which is created, updated and loaded through yaml.
Ingress Controller是将Ingress这种变化生成一段Nginx的配置,然后将这个配置通过Kubernetes API写到Nginx的Pod中,然后reload重新加载。The Ingress Controller generates an Nginx configuration from the changes in Ingress, then writes this configuration to the Nginx Pod through the Kubernetes API, and then reloads it.
连接请求被负载均衡器拦截,比如Nginx,然后Ingress Controller通过跟Ingress交互得知某个域名对应的service,再通过跟kubernetes API交互得知service地址等信息;综合后生成配置文件实时写入负载均衡器,然后负载均衡器reload该规则便可实现服务发现,即动态映射。The connection request is intercepted by the load balancer, such as Nginx, and then the Ingress Controller learns the service corresponding to a certain domain name by interacting with the Ingress, and then learns the service address and other information by interacting with the kubernetes API; after synthesis, the configuration file is generated and written to the load balancer in real time. The load balancer then reloads the rule to realize service discovery, that is, dynamic mapping.
通过对上述现有技术一的分析,可以获知其只能提供南北向安全服务,无法做到任意两个容器之间的东西向安全防护。Through the analysis of the above-mentioned existing technology 1, it can be learned that it can only provide north-south security services and cannot provide east-west security protection between any two containers.
关于现有技术二,云原生自带的network policy防护方法:Regarding the second existing technology, the network policy protection method that comes with cloud native:
Network Policy提供了基于策略的网络控制,用于隔离应用并减少攻击面。其使用标签选择器模拟传统的分段网络,并通过策略控制它们之间的流量以及来自外部的流量。Network Policy provides policy-based network control to isolate applications and reduce the attack surface. It uses tag selectors to simulate traditional segmented networks and controls traffic between them and from outside via policies.
Network Policy是kubernetes中的一种资源类型,从属于某个namespace。其内容从逻辑上看包含两个关键部分,一个部分是pod选择器,基于标签选择相同namespace下的pod,将其中定义的规则作用于选中的pod;另一个部分是规则,就是网络流量进出pod的规则,其采用的是白名单模式,符合规则的通过,不符合规则的拒绝,通过Network Policy机制可以控制pod之间的基于传输层五元组的访问控制策略。Network Policy is a resource type in kubernetes and belongs to a certain namespace. Its content logically contains two key parts. One part is the pod selector, which selects pods in the same namespace based on labels, and applies the rules defined in it to the selected pods; the other part is the rules, which are the network traffic in and out of the pod. The rules adopt a whitelist mode. Those that comply with the rules are passed and those that do not comply with the rules are rejected. The Network Policy mechanism can control the access control policy based on the transport layer quintuple between pods.
通过对上述现有技术一的分析,可以获知其只能提供基础的容器间的访问控制功能,只能针对传输层五元组进行访问控制,无法实现4-7层的高级安全功能,无基于内容的入侵防御、恶意代码过滤等功能。Through the analysis of the above-mentioned existing technology 1, it can be learned that it can only provide basic inter-container access control functions, and can only perform access control on transport layer quintuples. It cannot realize advanced security functions of layers 4-7 and has no based on Content intrusion prevention, malicious code filtering and other functions.
容器环境中不同namespace是相互隔离的,无法通过一个防护机制进行跨命名空间的安全防护,如在根命名空间中无法对其他命名空间的网络通信进行安全防护。Different namespaces in the container environment are isolated from each other, and cross-namespace security protection cannot be implemented through a protection mechanism. For example, network communications in other namespaces cannot be securely protected in the root namespace.
有鉴于此,本发明提供的跨命名空间的容器安全防护方法、装置、设备及介质,能够有效实现容器环境中,跨命名空间以及命名空间内部的容器安全防护,即解决不同命名空间的容器间东西向安全防护。In view of this, the cross-namespace container security protection method, device, equipment and medium provided by the present invention can effectively realize container security protection across namespaces and within namespaces in a container environment, that is, to solve the problem of container security between different namespaces. East-west security protection.
下面结合图1-图10描述本发明提供的跨命名空间的容器安全防护方法、装置、设备及介质。The following describes the cross-namespace container security protection method, device, equipment and medium provided by the present invention with reference to Figures 1-10.
图1是本发明提供的跨命名空间的容器安全防护方法的流程示意图之一,如图1所示,主要包括但不限于以下步骤:Figure 1 is one of the flow diagrams of the cross-namespace container security protection method provided by the present invention. As shown in Figure 1, it mainly includes but is not limited to the following steps:
步骤101,在根命名空间中部署根命名空间安全防护组件master agent。Step 101: Deploy the root namespace security protection component master agent in the root namespace.
图2是本发明提供的容器环境部署场景的结构示意图,如图2所示,在本发明的容器环境中,包含基本的根命名空间(root namespace),以及多个远程命名空间如namespace1、namespace2……,还包含直接创建在根命名空间下的容器。Figure 2 is a schematic structural diagram of a container environment deployment scenario provided by the present invention. As shown in Figure 2, the container environment of the present invention includes a basic root namespace (root namespace) and multiple remote namespaces such as namespace1 and namespace2. …, also includes containers created directly under the root namespace.
已部署的安全防护组件在图2中体现为agent,安全防护组件包含master agent和remote agent,在根命名空间下部署master agent,其他remote agent均为其复制。安全防护组件agent主要利用NFQ进行重定向来获取要检测的数据报文The deployed security protection components are represented as agents in Figure 2. The security protection components include master agent and remote agent. The master agent is deployed in the root namespace, and other remote agents are copied from it. The security protection component agent mainly uses NFQ for redirection to obtain the data packets to be detected.
在执行容器安全防护的过程中,首先在根命名空间下,启动一个根命名空间安全防护组件master agent进程,该进程能够对根命名空间里的容器提供诸如访问控制、入侵防御、恶意代码过滤等安全防护(类似于容器环境里的一个虚拟化的防火墙)。In the process of executing container security protection, first start a root namespace security protection component master agent process under the root namespace. This process can provide such things as access control, intrusion prevention, malicious code filtering, etc. to the containers in the root namespace. Security protection (similar to a virtualized firewall in a container environment).
在根命名空间里,看不到其他远程命名空间的网络流量,那么master agent在利用NFQ进行重定向时就没办法获取到其他远程命名空间的数据报文,因此只有在每个命名空间下都有一个agent,才能实现跨命名空间的安全防护。In the root namespace, the network traffic of other remote namespaces cannot be seen. Then the master agent cannot obtain the data packets of other remote namespaces when using NFQ for redirection. Therefore, it can only obtain the data packets of other remote namespaces under each namespace. Only with an agent can cross-namespace security protection be achieved.
步骤102,在所述master agent监听到当前网络环境节点上新建了远程命名空间的情况下,控制所述master agent在所述根命名空间中生成一个远程命名空间安全防护组件remote agent。Step 102: When the master agent detects that a remote namespace is newly created on the current network environment node, control the master agent to generate a remote namespace security protection component remote agent in the root namespace.
具体地,本发明通过在根命名空间下的master agent监听当前网络环境的节点上新的远程命名空间的创建动作,在其确定有新的远程命名空间创建时,master agent会自动识别。Specifically, the present invention monitors the creation of new remote namespaces on nodes in the current network environment through the master agent under the root namespace. When it determines that a new remote namespace is created, the master agent will automatically identify it.
当master agent识别到新建容器的同时创建了新的远程命名空间时(例如新创建了namespace1),master agent在其命名空间内自动启动一个远程命名空间安全防护组件remote agent。When the master agent recognizes the new container and creates a new remote namespace (for example, newly created namespace1), the master agent automatically starts a remote namespace security protection component remote agent in its namespace.
需要说明的是,新启动的remote agent是一个与master agent功能一致的进程,能够提供与mater agent相同的安全防护,但此时其不属于任何一个命名空间。It should be noted that the newly started remote agent is a process with the same functions as the master agent and can provide the same security protection as the master agent, but it does not belong to any namespace at this time.
步骤103,将所述remote agent的运行空间切换至所述远程命名空间。Step 103: Switch the running space of the remote agent to the remote namespace.
图3是本发明提供的跨命名空间的容器安全防护方法的流程示意图之二,如图3所示,整个方法总体上包括以下步骤:Figure 3 is the second flow diagram of the cross-namespace container security protection method provided by the present invention. As shown in Figure 3, the entire method generally includes the following steps:
步骤301,在根命名空间中部署根命名空间安全防护组件;Step 301: Deploy the root namespace security protection component in the root namespace;
步骤302,在新命名空间namespace1创建时,在根命名空间中生成一个remoteagent;Step 302: When the new namespace namespace1 is created, a remoteagent is generated in the root namespace;
步骤303,启动enter ns,以将生成的remote agent的运行空间切换到新创建的namespace1;Step 303, start enter ns to switch the running space of the generated remote agent to the newly created namespace1;
步骤304,remote agent在namespace1执行安全防护动作。Step 304: The remote agent performs security protection actions in namespace1.
需要说明的是,在根命名空间中创建关于远程命名空间namespace1的remoteagent(记作remote agent1)之后,通过启动Linux系统调用enter ns,以实现内核系统调用把所创建的remote agent1的运行空间切换到所要防护的远程命名空间namespace1里,如:利用setns()函数可以把remote agent1加入到指定的远程命名空间namespace1中。It should be noted that after creating the remoteagent (denoted as remote agent1) for the remote namespace namespace1 in the root namespace, the Linux system call enter ns is started to realize the kernel system call to switch the running space of the created remote agent1 to In the remote namespace namespace1 to be protected, for example: use the setns() function to add remote agent1 to the specified remote namespace namespace1.
此时,转换后的remote agent1与新建的远程命名空间namespace1下的容器同属于同一个命名空间。At this time, the converted remote agent1 and the container under the newly created remote namespace namespace1 belong to the same namespace.
上述对remote agent1的命名空间的切换过程,是在remote agent1进程中运行代码实现的,具体函数调用的过程的代码可以设置如下:The above switching process of the namespace of remote agent1 is implemented by running code in the remote agent1 process. The code of the specific function calling process can be set as follows:
snprintf(path,sizeof(path),"%s/%s/ns/net",mountpoint,container_pid_env);snprintf(path,sizeof(path),"%s/%s/ns/net",mountpoint,container_pid_env);
fd=open(path,O_RDONLY);fd=open(path,O_RDONLY);
retval=setns(fd,0);retval=setns(fd,0);
setns(fd,0)。setns(fd,0).
当remote agent1执行完setns系统调用后,就完成了命名空间的切换,remoteagent1看到的名字空间就是新命名空间的相关数据信息了。After remote agent1 executes the setns system call, the namespace switching is completed. The namespace seen by remoteagent1 is the relevant data information of the new namespace.
步骤104,控制所述remote agent在所述远程命名空间中执行安全防护,并控制所述master agent在所述根命名空间中执行安全防护。Step 104: Control the remote agent to perform security protection in the remote namespace, and control the master agent to perform security protection in the root namespace.
具体地,remote agent1开始以独立组件的身份在namespace1中执行安全防护动作,即主动利用底层NFQ将当前命名空间的流量引入,进行访问控制、入侵防护等安全过滤检测,以解决在新创建的远程命名空间namespace1内,原有安全防护功能失效的危险。Specifically, remote agent1 starts to perform security protection actions in namespace1 as an independent component, that is, it actively uses the underlying NFQ to introduce the traffic of the current namespace and performs security filtering and detection such as access control and intrusion prevention to solve the problem in the newly created remote In the namespace namespace1, there is a risk that the original security protection function will fail.
需要说明的是,remote agent1在远程命名空间namespace1里执行iptables NFQ重定向引流时,只针对namespace1的数据报文,即实现了对新创建的namespace1中容器的防护。It should be noted that when remote agent1 executes iptables NFQ redirection in the remote namespace namespace1, it only targets the data packets of namespace1, thus achieving protection for the newly created container in namespace1.
另外,特殊情况下,有些特例的容器,是直接创建在根命名空间内,此类容器就直接通过根命名空间下的master agent进行安全防护。In addition, under special circumstances, some special containers are created directly in the root namespace. Such containers are directly protected through the master agent under the root namespace.
图4是本发明提供的安全防护组件的工作原理示意图,如图4所示,在任一命名空间内分布于两个计算节点的进程启动后,会被节点内的agent识别发现,agent通过标签提取器提取容器的相关属性标签,包括,进程pid,label(用户给的标签),进程名字等信息。Figure 4 is a schematic diagram of the working principle of the security protection component provided by the present invention. As shown in Figure 4, after a process distributed on two computing nodes in any namespace is started, it will be identified and discovered by the agent in the node. The agent extracts it through tags. The extractor extracts the relevant attribute labels of the container, including process pid, label (label given by the user), process name and other information.
建立连接时,podA发送出的数据包会通过底层Iptables的NFQ实现重定向,将数据包重定向到容器安全引擎agent中,agent作为安全防护组件,掌握访问控制策略,可以作出对应的策略匹配。When establishing a connection, the data packets sent by podA will be redirected through the NFQ of the underlying Iptables, and the data packets will be redirected to the container security engine agent. As a security protection component, the agent masters access control policies and can make corresponding policy matches.
策略判读结束,agent将放行数据包继续传输,相互进行通信时,通信两端(即容器计算节点1与容器计算节点2)将分别进行出站的策略匹配和入站的策略匹配,这样就可以实现对每个命名空间内的流量进行安全防护。After the policy interpretation is completed, the agent will release the data packet to continue transmission. When communicating with each other, the two ends of the communication (i.e. container computing node 1 and container computing node 2) will perform outbound policy matching and inbound policy matching respectively, so that Implement security protection for traffic within each namespace.
本发明提供的跨命名空间的容器安全防护方法,通过部署一个master agent,随命名空间创建自动生成remote agent,并通过NFQ机制、截获对应命名空间内的容器的通信流量,能有效地实现容器环境中,不同命名空间以及命名空间内部的容器安全防护。The cross-namespace container security protection method provided by the present invention can effectively realize the container environment by deploying a master agent, automatically generating a remote agent with the namespace creation, and intercepting the communication traffic of the container in the corresponding namespace through the NFQ mechanism. , different namespaces and container security protection within namespaces.
基于上述实施例的内容,作为一种可选实施例,步骤104中所述的控制所述remoteagent在所述远程命名空间中执行安全防护,并控制所述master agent在所述根命名空间中执行安全防护,具体包括:Based on the contents of the above embodiments, as an optional embodiment, the step 104 is to control the remoteagent to perform security protection in the remote namespace, and to control the master agent to perform security protection in the root namespace. Security protection, specifically includes:
利用系统内核中的地址转换管理工具NFQ,分别将远程命名空间中的数据报文引入至remote agent,以供remote agent执行对远程命名空间中的数据报文的安全防护;Use the address translation management tool NFQ in the system kernel to introduce data packets in the remote namespace to the remote agent, so that the remote agent can perform security protection on the data packets in the remote namespace;
利用NFQ将根命名空间中的数据报文引入至master agent,以供master agent执行对根命名空间中的数据报文的安全防护。Use NFQ to introduce data packets in the root namespace to the master agent, so that the master agent can perform security protection on the data packets in the root namespace.
图5是本发明提供的远程安全防护组件建立后的安全防护的原理示意图,如图5所示,任一remote agent在该命名空间里执行iptables NFQ重定向引流时,只针对当前这个远程命名空间namespace的数据报文数据,即实现了对新创建的远程命名空间中容器的防护。Figure 5 is a schematic diagram of the security protection principle after the remote security protection component provided by the present invention is established. As shown in Figure 5, when any remote agent executes iptables NFQ redirection in the namespace, it only targets the current remote namespace. The data packet data of the namespace realizes the protection of the containers in the newly created remote namespace.
另外,特殊情况下,有些特例的容器,即直接直接创建在根命名空间内的容器,就可以直接利用NFQ将根命名空间中的数据报文引入至根命名空间下的master agent进行安全防护。In addition, under special circumstances, some special containers, that is, containers created directly in the root namespace, can directly use NFQ to introduce data packets in the root namespace to the master agent under the root namespace for security protection.
本发明提供的跨命名空间的容器安全防护方法,通过将master agent的安全防护策略复制到remote agent,为每个命名空间都建立了独立的防护组件,综合实现了容器环境内跨命名空间的安全防护。The cross-namespace container security protection method provided by the present invention, by copying the security protection policy of the master agent to the remote agent, establishes an independent protection component for each namespace, and comprehensively realizes cross-namespace security in the container environment. protection.
基于上述实施例的内容,作为一种可选实施例,在将remote agent的运行空间切换至所述远程容器所对应的远程命名空间之后,还包括:Based on the content of the above embodiment, as an optional embodiment, after switching the running space of the remote agent to the remote namespace corresponding to the remote container, it also includes:
在master agent中建立一个远程过程调用客户端RPC client,并在remote agent中建立一个远程过程调用服务端RPC server;建立RPC client与所述RPC server之间的通信,以供remote agent将策略配置信息发送至master agent;由master agent将所述策略配置信息上传至管理端。Establish a remote procedure call client RPC client in the master agent, and establish a remote procedure call server RPC server in the remote agent; establish communication between the RPC client and the RPC server for the remote agent to transfer policy configuration information Sent to the master agent; the master agent uploads the policy configuration information to the management end.
其中,策略配置信息主要包括现有防护策略的标签、report日志以及监控信息等。Among them, the policy configuration information mainly includes labels of existing protection policies, report logs, and monitoring information.
本发明在实现了将新创建的remote agent的运行空间切换至远程容器所对应的远程命名空间之后,还提供了一种在master agent和remote agent之间进行配置管理的方式。After realizing switching the running space of the newly created remote agent to the remote namespace corresponding to the remote container, the present invention also provides a method for configuration management between the master agent and the remote agent.
图6是本发明提供的一种安全策略配置管理的流程示意图,如图6所示,在上述实施例中已经详细描述了在每一个命名空间内创建安全防护组件agent的方式(在根命名空间中部署master agent,在远程命名空间中部署remote agent),这样若在各个remoteagent都单独配置安全策略,显然太复杂也不现实。Figure 6 is a schematic flow chart of security policy configuration management provided by the present invention. As shown in Figure 6, the method of creating a security protection component agent in each namespace has been described in detail in the above embodiment (in the root namespace Deploy the master agent in the remote namespace and deploy the remote agent in the remote namespace). If you configure the security policy separately for each remoteagent, it is obviously too complicated and unrealistic.
因此,本发明提供的跨命名空间的容器安全防护方法,在配置管理上,本发明所采用的方式主要包括以下步骤:Therefore, the cross-namespace container security protection method provided by the present invention mainly includes the following steps in terms of configuration management:
步骤601,在master agent中建立一个RPC client;Step 601, establish an RPC client in the master agent;
步骤602,在每一个remote agent建立一个RPC server;Step 602, establish an RPC server in each remote agent;
步骤603,remote agent就可以把policy以及report日志或者监控信息等策略配置信息通过RPC client发给master agent;Step 603, the remote agent can send policy configuration information such as policy and report logs or monitoring information to the master agent through the RPC client;
步骤604,通过master agent将上述policy以及report日志或者监控信息等策略配置信息发送至管理端。Step 604: Send the above policy and policy configuration information such as report log or monitoring information to the management terminal through the master agent.
具体地,本发明通过master agent建立一个RPC client,同时在每一个remoteagent建立一个RPC server,RPC client分别与各RPC server通信,这样remote agent就可以把policy以及report日志或者监控信息等策略配置信息通过RPC client发给masteragent。Specifically, the present invention establishes an RPC client through the master agent, and at the same time establishes an RPC server in each remoteagent. The RPC client communicates with each RPC server respectively, so that the remote agent can pass policy and report log or monitoring information and other policy configuration information through RPC client sends to masteragent.
图7是本发明提供的安全防护组件传递策略信息的流程示意图,如图7所示,由所述master agent将所述策略配置信息上传至管理端之后,还包括:Figure 7 is a schematic flowchart of the security protection component provided by the present invention for transmitting policy information. As shown in Figure 7, after the master agent uploads the policy configuration information to the management end, it also includes:
由管理端根据所述策略配置信息,从策略库中匹配出公共防护策略集,并将公共防护策略集下发至master agent;由master agent确定公共防护策略集中的各防护策略的标签与remote agent中现有防护策略的标签之间的交集作为公共标签;由master agent将与公共标签相关的防护策略下发至远程命名空间。The management end matches the public protection policy set from the policy library according to the policy configuration information, and delivers the public protection policy set to the master agent; the master agent determines the label and remote agent of each protection policy in the public protection policy set. The intersection between the labels of existing protection policies is used as a public label; the master agent delivers the protection policy related to the public label to the remote namespace.
具体地,在任一remote agent将策略配置信息发送至master agent之后,masteragent将所获取到的该策略配置信息上传至管理端。Specifically, after any remote agent sends the policy configuration information to the master agent, the master agent uploads the obtained policy configuration information to the management end.
此时,对于管理中心来说,与其信息交互的只有一个master agent,由其进行下发策略、感知命名空间下容器的变化、收发日志等工作,而其他remote agent只需跟masteragent通信,实现了管理端通过master agent执行对所有remote agent的综合管理。At this time, for the management center, there is only one master agent that interacts with information, and it is responsible for issuing policies, sensing changes in containers under the namespace, sending and receiving logs, etc., while other remote agents only need to communicate with the master agent to achieve The management end performs comprehensive management of all remote agents through the master agent.
在执行上述策略配置管理的过程中,当由master agent监控到任一远程命名空间消失的时候,remote agent就会自动的退出。也就是说remote agent将跟随起对应的远程命名空间的变化而自动创建和退出,达到全自动化透明无感的状态。During the process of executing the above policy configuration management, when the master agent monitors that any remote namespace disappears, the remote agent will automatically exit. In other words, the remote agent will automatically create and exit following changes in the corresponding remote namespace, achieving a fully automated, transparent and insensitive state.
图8是本发明提供的跨命名空间的容器安全防护方法的流程示意图之三,作为一种可选实施例,如图8所示,本发明中对remote agent安全策略配置管理的具体处理方法可以包括以下步骤:Figure 8 is the third flow diagram of the cross-namespace container security protection method provided by the present invention. As an optional embodiment, as shown in Figure 8, the specific processing method for remote agent security policy configuration management in the present invention can be Includes the following steps:
当用户启动一个容器资源后,会相应地在当前网络环境节点上新建一个远程命名空间,master agent通过监听docker守护进程来获取到启动事件。启动事件会触发masteragent为容器资源启动一个remote agent(即图8中的远端代理)负责维护该远程命名空间的iptables规则以及ipset。When the user starts a container resource, a new remote namespace will be created on the current network environment node accordingly. The master agent obtains the startup event by listening to the docker daemon process. The startup event will trigger the masteragent to start a remote agent (that is, the remote agent in Figure 8) for the container resource, which is responsible for maintaining the iptables rules and ipset of the remote namespace.
同时,master agent中包含了一个策略管理服务,它订阅管理端的策略事件(策略规则下发到了master agent,这就叫一个策略事件),在管理端预先创建了一个策略库,其中的策略主要分为入站模式、出战模式、双向模式三种,策略库规则的追加将通过管理端来实现。At the same time, the master agent contains a policy management service, which subscribes to policy events on the management side (the policy rules are sent to the master agent, which is called a policy event), and a policy library is pre-created on the management side. The policies are mainly divided into There are three modes: inbound mode, outbound mode, and two-way mode. The addition of policy library rules will be implemented through the management end.
可选地,上述实施例中所提及的由管理端根据策略配置信息,从策略库中匹配出公共防护策略集,包括由所述管理端执行以下操作:Optionally, the management end mentioned in the above embodiment matches the public protection policy set from the policy library according to the policy configuration information, including the management end performing the following operations:
基于标签匹配算法,对策略库中的所有防护策略进行初筛;对通过初筛获取到的所有防护策略进行清洗,以从中筛除为空的防护策略以及与远程命名空间不匹配的策略;根据策略配置信息,对通过清洗后的所有防护策略进行交集去重,获取公共防护策略集。Based on the label matching algorithm, all protection policies in the policy library are initially screened; all protection policies obtained through the preliminary screening are cleaned to filter out empty protection policies and policies that do not match the remote namespace; according to For the policy configuration information, all the protection policies after cleaning are intersected and deduplicated to obtain a public protection policy set.
由于管理端所面对的策略库中的策略规则较多,本发明通过标签匹配算法,通过策略配置信息从策略库中匹配出与请求策略下发的remote agent相关联的所有防护策略,并将这些防护策略构建成公共防护策略集下发给master agent。Since there are many policy rules in the policy library faced by the management end, the present invention uses a label matching algorithm and policy configuration information to match all protection policies associated with the remote agent that requests policy issuance from the policy library, and These protection strategies are constructed into a public protection strategy set and delivered to the master agent.
本发明提供的跨命名空间的容器安全防护方法,通过管理端对策略库中的所有防护策略进行匹配初筛,然后在master agent对初筛后获取的公共防护策略集作进一步筛选,能够提高策略配置管理的效率。The cross-namespace container security protection method provided by the present invention uses the management end to perform a preliminary screening of all protection strategies in the policy library, and then the master agent further filters the set of public protection strategies obtained after the preliminary screening, which can improve the strategy. Configuration management efficiency.
基于上述实施例的内容,结合图8所示,作为一种可选实施例,上述由管理端根据策略配置信息,从策略库中匹配出公共防护策略集,主要包括但不限于由管理端执行以下操作:Based on the contents of the above embodiments, as shown in Figure 8, as an optional embodiment, the management end matches the public protection policy set from the policy library according to the policy configuration information, which mainly includes but is not limited to execution by the management end. The following actions:
基于标签匹配算法,对策略库中的所有防护策略进行初筛;对通过初筛获取到的所有防护策略进行清洗,以从中筛除为空的防护策略以及与远程命名空间不匹配的策略;根据策略配置信息,对通过清洗后的所有防护策略进行交集去重,获取公共防护策略集。Based on the label matching algorithm, all protection policies in the policy library are initially screened; all protection policies obtained through the preliminary screening are cleaned to filter out empty protection policies and policies that do not match the remote namespace; according to For the policy configuration information, all the protection policies after cleaning are intersected and deduplicated to obtain a public protection policy set.
具体地,在管理端收到master agent的订阅请求时,管理端会通过标签匹配算法,在策略库中进行规则匹配,以匹配到对应的公共防护策略集,然后将所匹配到的公共防护策略集中的所有策略规则下发至代理端进行缓存。Specifically, when the management end receives a subscription request from the master agent, the management end will use the label matching algorithm to perform rule matching in the policy library to match the corresponding public protection policy set, and then use the matched public protection policy to All centralized policy rules are delivered to the agent for caching.
标签匹配算法会遍历策略库中的每一个防护策略,对为空的防护策略以及防护策略的命名空间与remote agent不匹配的防护策略进行丢弃处理The label matching algorithm will traverse every protection policy in the policy library and discard the empty protection policies and the protection policies whose namespace does not match the remote agent.
作为一种可选实施例,上述根据策略配置信息,对通过清洗后的所有防护策略进行交集去重,获取所述公共防护策略集,具体由master agent执行以下步骤,包括:As an optional embodiment, according to the policy configuration information, all the protection policies after cleaning are intersected and deduplicated to obtain the public protection policy set. Specifically, the master agent performs the following steps, including:
master agent计算每个清洗后的防护策略所对应的标签特征向量,并计算remoteagent的标签所对应的远端标签特征向量;根据每个策略标签特征向量与远端标签特征向量之间的距离与预设阈值的比较结果,确定所有防护策略中的重复防护策略;从所有防护策略中筛除重复防护策略,获取公共防护策略集。The master agent calculates the tag feature vector corresponding to each cleaned protection policy, and calculates the remote tag feature vector corresponding to the remoteagent tag; based on the distance between each policy tag feature vector and the remote tag feature vector and the predetermined Set the threshold comparison results to determine duplicate protection strategies among all protection strategies; filter out duplicate protection strategies from all protection strategies to obtain a public protection strategy set.
master agent会对公共防护策略集中的所有的策略规则进行进一步筛选,最终生成可以下发至请求策略下发的各remote agent,具体包括:The master agent will further filter all the policy rules in the public protection policy set, and finally generate each remote agent that can be issued to the requested policy, including:
master agent在接收到从管理端下发下来的所有策略规则后,首先用每个策略规则的标签与remote agent的标签进行交集去重处理;然后,使用标签筛选出所有未被禁用的策略。After receiving all the policy rules issued from the management side, the master agent first uses the labels of each policy rule and the labels of the remote agent to perform intersection deduplication processing; then, it uses the labels to filter out all policies that are not disabled.
需要指出的是,无论是策略规则,还是remote agent,亦或是容器本身,都会有标签进行标记。交集去重是要过滤掉相同的标签,在剩余中筛选未被禁用的标签。It should be pointed out that whether it is policy rules, remote agent, or the container itself, it will be marked with labels. Intersection deduplication is to filter out identical tags and filter out the remaining tags that are not disabled.
其中,防护策略分为启用和禁用两种状态,启用是指该防护策略需要下发生效;被禁用则是代表该防护策略不需要下发或者属于已下发的防护策略。Among them, the protection policy is divided into two states: enabled and disabled. Enabled means that the protection policy needs to be issued to take effect; disabled means that the protection policy does not need to be issued or is a issued protection policy.
可选地,本发明提供一种交集去重算法的具体执行方法,其执行主体为Masteragent,主要包括但不限于以下步骤:Optionally, the present invention provides a specific execution method of the intersection deduplication algorithm, whose execution subject is Masteragent, which mainly includes but is not limited to the following steps:
(1)策略标签预处理:读取各防护策略标签subject和object的并集。其中,Subject和object均为防护策略中的字段,各自包含了若干标签,对上述标签防护策略中无效的值进行清洗,即对一条防护策略中的所有标签的无效标签进行清洗,比如筛除只有key没有value这种标签。(1) Policy label preprocessing: Read the union of subject and object of each protection policy label. Among them, Subject and object are fields in the protection policy, and each contains several tags. To clean the invalid values in the above tag protection policy, that is, to clean the invalid tags of all tags in a protection policy, for example, filter out only Key does not have such a label as value.
(2)计算清洗后的防护策略所对应的标签特征向量:本发明将防护策略标签出现的频率(将上一步骤中进行清洗后获取到的并集),以字典形式表现为{policytag:counts}。(2) Calculate the tag feature vector corresponding to the cleaned protection strategy: This invention expresses the frequency of occurrence of the protection strategy tag (the union obtained after cleaning in the previous step) in the form of a dictionary as {policytag: counts }.
进一步地,通过哈希函数,将标签字符串(一个防护策略标签的所有字符)转换为长度为N的0、1形式的向量,即以字典形式表示为{[01]{N}:counts}。Further, the label string (all characters of a protection policy label) is converted into a vector of length N in the form of 0 and 1 through the hash function, that is, expressed in dictionary form as {[01]{N}:counts} .
接着,将哈希中的0映射为-1,然后与防护策略标签出现的频率按位相乘,得到特征向量集可表示为{[I(xn=1)-I((xn=0)]*counts|n∈(1,N)}。Next, 0 in the hash is mapped to -1, and then multiplied bitwise with the frequency of occurrence of the protection policy label, and the resulting feature vector set can be expressed as {[I(xn=1)-I((xn=0)] *counts|n∈(1,N)}.
相应地,采用同样的方法计算出remote agent的标签所对应的远端标签特征向量。Correspondingly, the same method is used to calculate the remote label feature vector corresponding to the remote agent's label.
(3)计算各防护策略标签与remote agent的标签之间的距离:(3) Calculate the distance between each protection policy label and the remote agent label:
根据抽屉原理,若将哈希分为K+1段,则重复标签必有一段取值相同,基于这一原则,本发明通过将各防护策略标签相关的标签特征向量与remote agent的标签所对应的远端标签特征向量按位异或之后,其中取值为1的个数即为两个标签的距离,即 According to the drawer principle, if the hash is divided into K+1 segments, then one segment of the repeated tags must have the same value. Based on this principle, the present invention corresponds to the tag feature vector related to each protection policy tag and the tag of the remote agent. After the bitwise XOR of the remote label feature vectors, the number of values is 1 is the distance between the two labels, that is
当某一防护策略标签与remote agent的标签之间的距离小于等于预设阈值时,可认为该防护策略标签是重复标签,则对其进行删除处理。When the distance between a certain protection policy label and the label of the remote agent is less than or equal to the preset threshold, the protection policy label can be considered to be a duplicate label and will be deleted.
需要说明的是,各防护策略标签是从管理端下发下来的,remote agent的标签是master agent可以直接读取到的。It should be noted that each protection policy label is issued from the management end, and the label of the remote agent can be directly read by the master agent.
本发明提供的跨命名空间的容器安全防护方法,通过以上两级筛选过程,对管理端下发的防护策略进行筛选梳理,得到master agent和其创建的remote agent的防护策略,以达到优化策略分发的目的。In the cross-namespace container security protection method provided by the present invention, through the above two-level screening process, the protection strategies issued by the management end are screened and sorted out, and the protection strategies of the master agent and the remote agent created by it are obtained, so as to optimize policy distribution. the goal of.
基于上述实施例的内容,作为一种可选实施例,由master agent将与公共标签相关的防护策略下发至远程命名空间,包括由master agent执行以下操作:Based on the content of the above embodiment, as an optional embodiment, the master agent delivers the protection policy related to the public label to the remote namespace, including the master agent performing the following operations:
确定每个与公共标签相关的防护策略的策略模式;若策略模式为入站模式,则将防护策略的公共标签写入至dst区;若策略模式为出站模式,则将防护策略的公共标签写入至src区;若策略模式为双向模式,则将防护策略的公共标签写入至dst区和src区。Determine the policy mode of each protection policy related to the public label; if the policy mode is inbound mode, write the public label of the protection policy to the dst area; if the policy mode is outbound mode, write the public label of the protection policy to the dst area Write to the src area; if the policy mode is bidirectional mode, write the public label of the protection policy to the dst area and src area.
进一步地,若防护策略的策略模式为入站模式,根据dst区中的标签与每个remoteagent的标签的匹配度,确定目标远程命名空间,以供目标远程命名空间将所述防护策略配置到remote agent的networksACL和xRules中。Further, if the policy mode of the protection policy is inbound mode, the target remote namespace is determined based on the matching degree between the label in the dst area and the label of each remoteagent, so that the target remote namespace can configure the protection policy to the remote In the agent's networksACL and xRules.
若防护策略的策略模式为出站模式,根据src区中的标签与每个remote agent的标签的匹配度,确定目标远程命名空间,以供目标远程命名空间将所述防护策略配置到remote agent的ApplicationACLs和xRules中。If the policy mode of the protection policy is outbound mode, determine the target remote namespace based on the matching degree between the label in the src area and the label of each remote agent, so that the target remote namespace can configure the protection policy to the remote agent. ApplicationACLs and xRules.
若防护策略的策略模式为双向模式,根据dst区和src区中的标签与每个remoteagent的标签的匹配度,确定目标远程命名空间,以供目标远程命名空间将所述防护策略配置到networksACL、ApplicationACLs以及xRules中。If the policy mode of the protection policy is bidirectional mode, determine the target remote namespace based on the matching degree between the labels in the dst area and src area and the labels of each remoteagent, so that the target remote namespace can configure the protection policy to networksACL, ApplicationACLs and xRules.
本发明所提供的跨命名空间的容器安全防护方法,最后判断各防护策略的模式,如果某防护策略为入站模式,则将该防护标签写入dst(全称:destination,目的地)中;如果某防护策略为出站模式,将该防护标签写入src(全称:source,源)中;如果某防护策略为双向模式,则在dst和src中均写入该防护策略标签。The cross-namespace container security protection method provided by the present invention finally determines the mode of each protection strategy. If a certain protection strategy is inbound mode, the protection label is written into dst (full name: destination, destination); if If a protection policy is in outbound mode, write the protection label in src (full name: source, source); if a protection policy is in bidirectional mode, write the protection policy label in both dst and src.
全部完成后,由master agent将所有防护策略分别下发至标签匹配的remoteagent。其中,策略标签和remote agent的标签一致,就认为两者的标签匹配。After all is completed, the master agent will deliver all protection policies to the remote agents with matching labels. Among them, if the policy label and the remote agent label are consistent, the two labels are considered to match.
进一步地,当remote agent收到下发的防护策略后,会根据防护策略里面的字段所确定的策略模式来进行不同的操作。Furthermore, when the remote agent receives the delivered protection policy, it will perform different operations based on the policy mode determined by the fields in the protection policy.
具体来说,防护策略下发后,找到需要配置策略的remote agent的位置的过程如下:Specifically, after the protection policy is delivered, the process of finding the location of the remote agent that needs to be configured with the policy is as follows:
入站模式:当匹配到防护策略的模式为入站的时候,master agent会根据dst中的防护策略标签来与remote agent进行整体匹配。由于remote agent会有很多,这里是指是将任一防护策略标签与所有remote agent的合集来进行标签匹配,以锁定需要配置策略的remote agent。Inbound mode: When the mode matching the protection policy is inbound, the master agent will overall match the remote agent based on the protection policy label in dst. Since there are many remote agents, what we mean here is to match any protection policy label with the collection of all remote agents to lock the remote agent for which the policy needs to be configured.
在防护策略到达remote agent后,remote agent会将防护策略配置到该remoteagent的networksACL和xRules中。After the protection policy reaches the remote agent, the remote agent will configure the protection policy into the networksACL and xRules of the remote agent.
相应地,在匹配到的防护策略为出站模式时,master agent会根据src中的标签来与remote agent进行整体匹配,以锁定需要配置策略的某个remote agent。Correspondingly, when the matched protection policy is in outbound mode, the master agent will match the remote agent as a whole based on the label in src to lock a certain remote agent for which the policy needs to be configured.
在防护策略到达该remote agent后,其会将该防护策略配置到ApplicationACLs和xRules中。After the protection policy reaches the remote agent, it will configure the protection policy into ApplicationACLs and xRules.
最后,如果匹配到的防护策略是双向模式,master agent则会根据dst和src中的标签来一起与所有remote agent进行匹配。Finally, if the matched protection policy is in bidirectional mode, the master agent will match all remote agents together based on the labels in dst and src.
匹配到之后,remote agent会将策略配置到networksACL、ApplicationACLs以及xRules。After matching, the remote agent will configure the policy to networksACL, ApplicationACLs and xRules.
至此,整个策略下发的流程就结束了。At this point, the entire policy issuance process is over.
本发明提供的跨命名空间的容器安全防护方法,利用RPC进行mater agent对remote agent的统一配置,通过策略动态计算,对策略进行去重筛选,动态拉取针对不同容器的相对应的安全策略,实现远端的管理端只面向一个master agent的便捷安全管理,提升了安全策略下发和安全日志收集的便捷性,提高运维效率,方便安全事件查看管理。The cross-namespace container security protection method provided by the present invention uses RPC to perform unified configuration of the mater agent to the remote agent. Through dynamic calculation of policies, the policies are deduplicated and filtered, and corresponding security policies for different containers are dynamically pulled. It realizes convenient security management of the remote management terminal for only one master agent, which improves the convenience of security policy issuance and security log collection, improves operation and maintenance efficiency, and facilitates the viewing and management of security events.
图9是本发明提供的跨命名空间的容器安全防护装置的结构示意图,如图9所示,主要包括组件部署单元91、监控部署单元92、空间切换单元93和防护控制单元94,其中:Figure 9 is a schematic structural diagram of the cross-namespace container security protection device provided by the present invention. As shown in Figure 9, it mainly includes a component deployment unit 91, a monitoring deployment unit 92, a space switching unit 93 and a protection control unit 94, where:
组件部署单元91主要用于在根命名空间中部署根命名空间安全防护组件masteragent;The component deployment unit 91 is mainly used to deploy the root namespace security protection component masteragent in the root namespace;
监控部署单元92主要用于在所述master agent监听到当前网络环境节点上新建了远程命名空间的情况下,控制所述master agent在所述根命名空间中生成一个远程命名空间安全防护组件remote agent;The monitoring and deployment unit 92 is mainly used to control the master agent to generate a remote namespace security protection component remote agent in the root namespace when the master agent detects that a new remote namespace is created on the current network environment node. ;
空间切换单元93主要用于将所述remote agent的运行空间切换至所述远程命名空间;The space switching unit 93 is mainly used to switch the running space of the remote agent to the remote namespace;
防护控制单元94主要用于控制所述remote agent在所述远程命名空间中执行安全防护,并控制所述master agent在所述根命名空间中执行安全防护。The protection control unit 94 is mainly used to control the remote agent to perform security protection in the remote namespace, and to control the master agent to perform security protection in the root namespace.
其中,所述remote agent与所述master agent的安全防护功能一致。Wherein, the security protection functions of the remote agent and the master agent are consistent.
需要说明的是,本发明实施例提供的跨命名空间的容器安全防护装置,在具体运行时,可以执行上述任一实施例所述的跨命名空间的容器安全防护方法,对此本实施例不作赘述。It should be noted that the cross-namespace container security protection device provided by the embodiment of the present invention can execute the cross-namespace container security protection method described in any of the above embodiments during specific operation. This embodiment does not make any reference to this. Repeat.
本发明提供的跨命名空间的容器安全防护装置,通过部署一个master agent,随命名空间创建自动生成remote agent,以实现在每个远程命名空间下都有一个remoteagent防护组件,然后通过NFQ机制、截获对应命名空间内的容器的通信流量,能有效地实现容器环境中,不同命名空间以及命名空间内部的容器安全防护。The cross-namespace container security protection device provided by the present invention deploys a master agent and automatically generates a remote agent with the creation of the namespace, so as to realize that there is a remoteagent protection component under each remote namespace, and then intercepts and intercepts it through the NFQ mechanism. Corresponding to the communication traffic of containers in the namespace, it can effectively implement container security protection in different namespaces and within the namespace in the container environment.
图10是本发明提供的电子设备的结构示意图,如图10所示,该电子设备可以包括:处理器(processor)1010、通信接口(Communications Interface)1020、存储器(memory)1030和通信总线1040,其中,处理器1010,通信接口1020,存储器1030通过通信总线1040完成相互间的通信。处理器1010可以调用存储器1030中的逻辑指令,以执行跨命名空间的容器安全防护方法,该方法包括:在根命名空间中部署根命名空间安全防护组件masteragent;在所述master agent监听到当前网络环境节点上新建了远程命名空间的情况下,控制所述master agent在所述根命名空间中生成一个远程命名空间安全防护组件remoteagent;将所述remote agent的运行空间切换至所述远程命名空间;控制所述remote agent在所述远程命名空间中执行安全防护,并控制所述master agent在所述根命名空间中执行安全防护;所述remote agent与所述master agent的安全防护功能一致。Figure 10 is a schematic structural diagram of an electronic device provided by the present invention. As shown in Figure 10, the electronic device may include: a processor (processor) 1010, a communications interface (Communications Interface) 1020, a memory (memory) 1030 and a communication bus 1040. Among them, the processor 1010, the communication interface 1020, and the memory 1030 complete communication with each other through the communication bus 1040. The processor 1010 can call logical instructions in the memory 1030 to execute a cross-namespace container security protection method. The method includes: deploying the root namespace security protection component masteragent in the root namespace; monitoring the current network when the master agent When a remote namespace is newly created on the environment node, control the master agent to generate a remote namespace security protection component remoteagent in the root namespace; switch the running space of the remote agent to the remote namespace; Control the remote agent to perform security protection in the remote namespace, and control the master agent to perform security protection in the root namespace; the security protection functions of the remote agent and the master agent are consistent.
此外,上述的存储器1030中的逻辑指令可以通过软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本发明的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行本发明各个实施例所述方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(ROM,Read-Only Memory)、随机存取存储器(RAM,Random Access Memory)、磁碟或者光盘等各种可以存储程序代码的介质。In addition, the above-mentioned logical instructions in the memory 1030 can be implemented in the form of software functional units and can be stored in a computer-readable storage medium when sold or used as an independent product. Based on this understanding, the technical solution of the present invention essentially or the part that contributes to the existing technology or the part of the technical solution can be embodied in the form of a software product. The computer software product is stored in a storage medium, including Several instructions are used to cause a computer device (which may be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in various embodiments of the present invention. The aforementioned storage media include: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), magnetic disk or optical disk and other media that can store program code. .
另一方面,本发明还提供一种计算机程序产品,所述计算机程序产品包括存储在非暂态计算机可读存储介质上的计算机程序,所述计算机程序包括程序指令,当所述程序指令被计算机执行时,计算机能够执行上述各方法所提供的跨命名空间的容器安全防护方法,该方法包括:在根命名空间中部署根命名空间安全防护组件master agent;在所述master agent监听到当前网络环境节点上新建了远程命名空间的情况下,控制所述masteragent在所述根命名空间中生成一个远程命名空间安全防护组件remote agent;将所述remote agent的运行空间切换至所述远程命名空间;控制所述remote agent在所述远程命名空间中执行安全防护,并控制所述master agent在所述根命名空间中执行安全防护;所述remote agent与所述master agent的安全防护功能一致。On the other hand, the present invention also provides a computer program product. The computer program product includes a computer program stored on a non-transitory computer-readable storage medium. The computer program includes program instructions. When the program instructions are read by a computer, When executed, the computer can execute the cross-namespace container security protection method provided by each of the above methods. The method includes: deploying the root namespace security protection component master agent in the root namespace; monitoring the current network environment in the master agent. When a remote namespace is newly created on the node, control the masteragent to generate a remote namespace security protection component remote agent in the root namespace; switch the running space of the remote agent to the remote namespace; control The remote agent performs security protection in the remote namespace and controls the master agent to perform security protection in the root namespace; the security protection functions of the remote agent and the master agent are consistent.
又一方面,本发明还提供一种非暂态计算机可读存储介质,其上存储有计算机程序,该计算机程序被处理器执行时实现以执行上述各实施例提供的跨命名空间的容器安全防护方法,该方法包括:在根命名空间中部署根命名空间安全防护组件master agent;在所述master agent监听到当前网络环境节点上新建了远程命名空间的情况下,控制所述master agent在所述根命名空间中生成一个远程命名空间安全防护组件remote agent;将所述remote agent的运行空间切换至所述远程命名空间;控制所述remote agent在所述远程命名空间中执行安全防护,并控制所述master agent在所述根命名空间中执行安全防护;所述remote agent与所述master agent的安全防护功能一致。In another aspect, the present invention also provides a non-transitory computer-readable storage medium on which a computer program is stored. The computer program is implemented when executed by a processor to perform the cross-namespace container security protection provided by the above embodiments. Method, the method includes: deploying the root namespace security protection component master agent in the root namespace; when the master agent monitors that a remote namespace is newly created on the current network environment node, controlling the master agent to Generate a remote namespace security protection component remote agent in the root namespace; switch the running space of the remote agent to the remote namespace; control the remote agent to perform security protection in the remote namespace, and control all The master agent performs security protection in the root namespace; the security protection functions of the remote agent and the master agent are consistent.
以上所描述的装置实施例仅仅是示意性的,其中所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部模块来实现本实施例方案的目的。本领域普通技术人员在不付出创造性的劳动的情况下,即可以理解并实施。The device embodiments described above are only illustrative. The units described as separate components may or may not be physically separated. The components shown as units may or may not be physical units, that is, they may be located in One location, or it can be distributed across multiple network units. Some or all of the modules can be selected according to actual needs to achieve the purpose of the solution of this embodiment. Persons of ordinary skill in the art can understand and implement the method without any creative effort.
通过以上的实施方式的描述,本领域的技术人员可以清楚地了解到各实施方式可借助软件加必需的通用硬件平台的方式来实现,当然也可以通过硬件。基于这样的理解,上述技术方案本质上或者说对现有技术做出贡献的部分可以以软件产品的形式体现出来,该计算机软件产品可以存储在计算机可读存储介质中,如ROM/RAM、磁碟、光盘等,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行各个实施例或者实施例的某些部分所述的方法。Through the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by software plus a necessary general hardware platform, and of course, it can also be implemented by hardware. Based on this understanding, the part of the above technical solution that essentially contributes to the existing technology can be embodied in the form of a software product. The computer software product can be stored in a computer-readable storage medium, such as ROM/RAM, magnetic disk, optical disk, etc., including a number of instructions to cause a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in various embodiments or certain parts of the embodiments.
最后应说明的是:以上实施例仅用以说明本发明的技术方案,而非对其限制;尽管参照前述实施例对本发明进行了详细的说明,本领域的普通技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本发明各实施例技术方案的精神和范围。Finally, it should be noted that the above embodiments are only used to illustrate the technical solution of the present invention, but not to limit it; although the present invention has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that it can still be used Modifications are made to the technical solutions described in the foregoing embodiments, or equivalent substitutions are made to some of the technical features; however, these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims (10)
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202210234155.6A CN116781301A (en) | 2022-03-10 | 2022-03-10 | Cross-namespace container security protection methods, devices, equipment and media |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202210234155.6A CN116781301A (en) | 2022-03-10 | 2022-03-10 | Cross-namespace container security protection methods, devices, equipment and media |
Publications (1)
| Publication Number | Publication Date |
|---|---|
| CN116781301A true CN116781301A (en) | 2023-09-19 |
Family
ID=87986558
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN202210234155.6A Pending CN116781301A (en) | 2022-03-10 | 2022-03-10 | Cross-namespace container security protection methods, devices, equipment and media |
Country Status (1)
| Country | Link |
|---|---|
| CN (1) | CN116781301A (en) |
-
2022
- 2022-03-10 CN CN202210234155.6A patent/CN116781301A/en active Pending
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| US11397609B2 (en) | Application/context-based management of virtual networks using customizable workflows | |
| US9064121B2 (en) | Network data transmission analysis | |
| US11252183B1 (en) | System and method for ransomware lateral movement protection in on-prem and cloud data center environments | |
| US8555383B1 (en) | Network data transmission auditing | |
| US8416709B1 (en) | Network data transmission analysis management | |
| EP2283611B1 (en) | Distributed security provisioning | |
| US9166988B1 (en) | System and method for controlling virtual network including security function | |
| CN103229185B (en) | Systems and methods for local protection against malware | |
| EP2283670B1 (en) | Security message processing within constrained time | |
| CN110035079B (en) | A honeypot generation method, device and device | |
| Tupakula et al. | Intrusion detection techniques for infrastructure as a service cloud | |
| US11252038B2 (en) | Network agent for generating platform specific network policies | |
| US11509535B2 (en) | Network agent for reporting to a network policy system | |
| KR101076683B1 (en) | Apparatus and method for splitting host-based networks | |
| US20180278459A1 (en) | Sharding Of Network Resources In A Network Policy Platform | |
| You et al. | HELIOS: Hardware-assisted high-performance security extension for cloud networking | |
| JP6491221B2 (en) | Distributed network security using a logical multidimensional label-based policy model | |
| Zhan et al. | CIADL: cloud insider attack detector and locator on multi-tenant network isolation: an OpenStack case study | |
| US20160205135A1 (en) | Method and system to actively defend network infrastructure | |
| US20250112892A1 (en) | Process-Aware Identity Firewall | |
| CN116781301A (en) | Cross-namespace container security protection methods, devices, equipment and media | |
| CN119892389A (en) | Data packet processing method, system, electronic device and storage medium | |
| Kilari et al. | A novel approach to protect cloud environments against DDOS attacks | |
| CN116963066A (en) | A network protection device, method and computer storage medium | |
| US20230388275A1 (en) | Method and a system of tunneling traffic in a distributed network for detecting malware |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| PB01 | Publication | ||
| PB01 | Publication | ||
| SE01 | Entry into force of request for substantive examination | ||
| SE01 | Entry into force of request for substantive examination |