Session access control method and device, equipment, medium and program product

By using the service port set and the registered IP address set in the firewall to identify the TCP session direction and set the ACL, it solves the problem that the existing firewall cannot determine the session direction, improves the applicability and security of the firewall, and ensures efficient access control and performance.

CN118611964APending Publication Date: 2024-09-06CHINA UNIONPAY
View PDF 0 Cites 3 Cited by

Patent Information

Application Number
CN202410833758.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-06-25
Publication Date
2024-09-06

AI Technical Summary

Technical Problem

Existing firewalls based on packet inspection cannot effectively determine the direction of TCP sessions, resulting in the inability to configure access control rules that meet certain scenarios. The applicability is poor, and the performance of stateful inspection firewalls decreases when the number of sessions increases and they are easily destroyed by malicious attacks. .

Method used

By introducing a service port set and a registered IP address set into the firewall, the session direction of the TCP communication session is determined based on the IP address and port information in the data packet, and the corresponding access control list (ACL) is set according to the session direction to perform access control. operation, avoiding the use of session tables, reducing storage usage and query time.

Benefits of technology

It achieves precise access control for different session directions, improves the applicability and security of the firewall, avoids performance degradation and malicious attacks, and ensures efficient communication performance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118611964A
    Figure CN118611964A
Patent Text Reader

Abstract

The invention discloses a session access control method and device, equipment, a medium and a program product, and belongs to the field of data communication. The method comprises the following steps: receiving a first data packet, the first data packet comprising a data packet transmitted after a TCP communication session is established; based on the IP address and port in the first data packet, a service port set and a registered IP address set, determining the first ACL and / or the second ACL as a target ACL, the service port set comprising the IP address and port of a communication device registered and serving as a server, or comprising the IP address and port of a communication device unregistered and serving as the server, the server is a receiver of a TCP communication session, the registered IP address set comprises an IP address of the registered communication device, the first ACL corresponds to a first session direction of the registered communication device, and the second ACL corresponds to a second session direction of the registered communication device; and executing an access control operation according to the target ACL. According to the embodiment of the invention, the applicability of the firewall can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application belongs to the field of data communications, and in particular, relates to a session access control method, apparatus, device, medium and program product. Background Art

[0002] The Transmission Control Protocol (TCP) is a connection-oriented, reliable transport layer communication protocol. In the scenario where the client accesses the server and the server provides services to the client, a TCP communication session can be established between the client and the server to transmit data packets. In order to improve network security, a firewall will be set up, and the firewall will detect the data packets between the client and the server based on the rules and block the data packets that do not meet the rules to achieve session access control. However, the firewall based on data packet detection cannot determine the TCP session direction of the data packet. In some scenarios, such as allowing the device with Internet Protocol Address (IP) address A1 to access the device with IP address A2, but not allowing the device with IP address A2 to access the device with IP address A1, it is impossible to configure the access control rules that meet the scenario, so that the firewall's session access control cannot meet the actual scenario requirements and has poor applicability. Summary of the invention

[0003] The embodiments of the present application provide a session access control method, apparatus, device, medium and program product, which can improve the applicability of a firewall.

[0004] In a first aspect, an embodiment of the present application provides a session access control method, comprising: receiving a first data packet, the first data packet comprising a data packet transmitted after establishing a transmission control protocol TCP communication session; based on the network protocol IP address and port, the service port set and the registered IP address set in the first data packet, determining a preset first access control list ACL and / or a preset second ACL as a target ACL, the service port set comprising the IP address and port of a communication device that is registered and acts as a server, or comprising the IP address and port of a communication device that is not registered and acts as a server, the server being the receiver of the TCP communication session, the registered IP address set comprising the IP address of the registered communication device, the first ACL corresponding to the first session direction of the registered communication device, and the second ACL corresponding to the second session direction of the registered communication device; performing access control operations according to the target ACL.

[0005] In a second aspect, an embodiment of the present application provides a session access control device, comprising: a receiving module, used to receive a first data packet, the first data packet including a data packet transmitted after establishing a transmission control protocol TCP communication session; an access control table determination module, used to determine a preset first access control table ACL and / or a preset second ACL as a target ACL based on a network protocol IP address and port, a service port set, and a registered IP address set in the first data packet, the service port set including an IP address and port of a communication device that is registered and acts as a server, or including an IP address and port of a communication device that is not registered and acts as a server, the server is a receiver of the TCP communication session, the registered IP address set including an IP address of a registered communication device, the first ACL corresponding to a first session direction of the registered communication device, and the second ACL corresponding to a second session direction of the registered communication device; an access control module, used to perform access control operations according to the target ACL.

[0006] In a third aspect, an embodiment of the present application provides a firewall device, comprising: a processor and a memory storing computer program instructions; when the processor executes the computer program instructions, the session access control method of the first aspect is implemented.

[0007] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, on which computer program instructions are stored. When the computer program instructions are executed by a processor, the session access control method of the first aspect is implemented.

[0008] In a fifth aspect, an embodiment of the present application provides a computer program product, including a computer program, which implements the session access control method of the first aspect when the computer program is executed by a processor.

[0009] The embodiments of the present application provide a session access control method, apparatus, device, medium and program product, which can set corresponding ACLs for different session directions of a TCP communication session. The firewall device can receive a data packet transmitted after establishing a TCP communication session, and determine the session direction of the TCP communication session to which the data packet belongs based on a service port set that records the IP address and port of the communication device that is the server, i.e., the receiver of the TCP communication session, thereby determining the ACL corresponding to the session scheme, and performing access control operations according to the ACL corresponding to the session direction. Through the service port set and the registered IP address set, the firewall device based on data packet detection can also identify the session direction of the TCP communication session, and can configure respective ACLs for different session directions, thereby configuring access control rules that meet various scenarios, so that the firewall's session access control can meet actual scenario requirements and improve the applicability of the firewall. BRIEF DESCRIPTION OF THE DRAWINGS

[0010] In order to more clearly illustrate the technical solution of the embodiments of the present application, the following is a brief introduction to the drawings required for use in the embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.

[0011] Figure 1 A schematic diagram of an example of an application scenario of the session access control method provided in an embodiment of the present application;

[0012] Figure 2 A schematic diagram of another example of an application scenario of the session access control method provided in an embodiment of the present application;

[0013] Figure 3 A flowchart of a session access control method provided by an embodiment of the present application;

[0014] Figure 4 A flowchart of a session access control method provided by another embodiment of the present application;

[0015] Figure 5 A flowchart of a session access control method provided by another embodiment of the present application;

[0016] Figure 6 A schematic diagram of an example architecture of a cloud firewall provided in an embodiment of the present application;

[0017] Figure 7 A schematic diagram of the structure of a session access control device provided in one embodiment of the present application;

[0018] Figure 8 A schematic diagram of the structure of a firewall device provided in one embodiment of the present application. DETAILED DESCRIPTION

[0019] The features and exemplary embodiments of various aspects of the present application will be described in detail below. In order to make the purpose, technical solutions and advantages of the present application clearer, the present application will be further described in detail below in conjunction with the accompanying drawings and specific embodiments. It should be understood that the specific embodiments described herein are intended only to explain the present application, rather than to limit the present application. For those skilled in the art, the present application can be implemented without the need for some of these specific details. The following description of the embodiments is only to provide a better understanding of the present application by showing examples of the present application. It should be noted that the acquisition, storage, use, and processing of information and data in the embodiments of the present application are authorized by users or relevant agencies, in compliance with the relevant provisions of national laws and regulations.

[0020] TCP is a connection-oriented, reliable transport layer communication protocol. In the scenario where the client accesses the server and the server provides services to the client, a TCP communication session can be established between the client and the server to transmit data packets. In order to improve network security, a firewall will be set up, and the firewall will detect the data packets between the client and the server based on the rules and block the data packets that do not meet the rules to achieve session access control. However, the firewall based on data packet detection cannot determine the TCP session direction of the data packet, so it is impossible to configure access control rules that meet the requirements of certain scenarios, making the firewall's session access control unable to meet the actual scenario requirements. For example, for the scenario where the device with IP address A1 is allowed to access the device with IP address A2, but the device with IP address A2 is not allowed to access the device with IP address A1, it is impossible to configure the access control rules that meet the scenario, making the firewall's session access control unable to meet the actual scenario requirements and poor applicability.

[0021] In order to improve the adaptability of the firewall's session access control, a stateful inspection firewall can be used to perform session access control. The stateful inspection firewall will record TCP communication sessions through the session table, and treat all messages belonging to the same connection exchanged between the two communicating parties as a whole data flow, thereby identifying the direction of the session. However, the session table requires a very large storage space. When the number of sessions recorded in the session table reaches a certain level, such as 200,000 sessions, the query and maintenance time of the session table will increase significantly, which will reduce the performance of session access control. In addition, the TCP communication session is a long connection, and the data exchange interval between sessions can be long. Network attackers can establish TCP communication sessions with the destination server continuously, but do not release the corresponding TCP communication connection, so that the number of sessions in the session table maintained by the stateful inspection firewall can easily reach the upper limit, making the stateful inspection firewall easily destroyed by malicious attacks.

[0022] The present application provides a session access control method, device, equipment, medium and program product, which can set corresponding access control lists (ACLs) for different session directions on the basis of a firewall based on data packet detection, and determine the session direction of the TCP communication session to which the data packet belongs according to the service port set that records the IP address and port of the communication device as the server, that is, the receiver of the TCP communication session, thereby determining the ACL corresponding to the session direction, and performing access control operations according to the ACL corresponding to the session direction. The identification of the session direction enables ACLs to be set for different session directions respectively, so that access control rules that meet various scenarios can be configured, so that the session access control of the firewall can meet the actual scenario requirements and improve the applicability of the firewall. Moreover, the firewall based on data packet detection does not need to establish a session table, and the service port set occupies very little storage space compared to the session table, and even if the network attacker continuously establishes a TCP communication connection with the target server, since the IP address and port of the target server will not change, each TCP communication connection established will not be recorded according to different IP addresses and ports in the service port table, and the number of records in the service port set is always kept at a low state, which can ensure communication performance and prevent the firewall from being damaged by malicious attacks.

[0023] To facilitate understanding, the application scenario of the session access control method provided in the embodiment of the present application is briefly described here. Figure 1 The schematic diagram of an example of an application scenario of the session access control method provided in the embodiment of the present application is as follows: Figure 1 As shown, the communication device 11 communicates with the communication device 13 through the firewall device 12. The firewall device 12 is a firewall device connected in series between the communication device 11 and the communication device 13. The firewall device 12 can execute the session access control method in the embodiment of the present application.

[0024] Figure 2 A schematic diagram of another example of an application scenario of the session access control method provided in an embodiment of the present application, such as Figure 2 As shown, the communication device 11 and the communication device 13 communicate with each other, and the firewall device 14 is a bypass firewall device of the communication device 11 and the communication device 13. The firewall device 14 can execute the session access control method in the embodiment of the present application. Figure 1 The communication devices 11 and 13 are just examples, and more communication devices may be included in actual application scenarios, which are not limited here.

[0025] The session access control method, apparatus, device, medium and program product provided by the present application are described below respectively.

[0026] In a first aspect, the present application provides a session access control method, which can be applied to firewall session access control scenarios or other scenarios. The session access control method can be executed by a session access control device, equipment, etc. The session access control device can be implemented as a firewall device, firewall system, etc., which is not limited here. Figure 3 A flow chart of a session access control method provided in an embodiment of the present application, such as Figure 3 As shown, the session access control method may include steps S201 to S203.

[0027] In step S201, a first data packet is received.

[0028] The first data packet includes a data packet transmitted after the TCP communication session is established, that is, a data packet transmitted between two communication devices after the TCP communication session is established can be referred to as a first data packet.

[0029] In step S202, based on the network protocol IP address and port, the service port set and the registered IP address set in the first data packet, the preset first access control list ACL and / or the preset second ACL are determined as the target ACL.

[0030] The first data packet may include an IP address and a port, specifically, the first data packet includes a source IP address, a source port, a destination IP address, and a destination port. The source IP address and the source port are the IP address and the port of the sender of the first data packet, and the destination IP address and the destination port are the IP address and the port of the receiver of the first data packet. Based on the first data packet alone, the transmission direction of the first data packet can be known, but the session direction of the TCP communication session to which the first data packet belongs cannot be determined. In a TCP communication session, the initiator of the TCP communication session can be the sender of the first data packet or the receiver of the first data packet. Similarly, the receiver of the TCP communication session can be the sender of the first data packet or the receiver of the first data packet.

[0031] For ease of explanation, in the embodiment of the present application, the receiver of the TCP communication session is referred to as the server, and the initiator of the TCP communication session is referred to as the client. It should be noted that the identity of a communication device in different TCP communication sessions may be different, such as a communication device is a server in one TCP communication session, and the communication device may be a client in another TCP communication session. The service port set is a dynamically changing set, which can be implemented in the form of a table, such as the service port set is implemented in the form of a service port table. The service port set may include the IP address and port of a communication device that is registered and acts as a server. Alternatively, the service port set may include the IP address and port of a communication device that is not registered and acts as a server. The registered IP address set includes the IP addresses of registered communication devices. A registered communication device is a communication device registered with a firewall, that is, a registered communication device is a communication device protected by a firewall.

[0032] In an embodiment of the present application, the ACL includes a first ACL and a second ACL, the first ACL corresponds to the first session direction of the registered communication device, and the second ACL corresponds to the second session direction of the registered communication device. The first ACL includes access control rules configured for the first session direction of the registered communication device. The second ACL includes access control rules configured for the second session direction of the registered communication device. The first session direction is opposite to the second session direction. For example, for a registered communication device, the session direction of the registered communication device as a server in a TCP communication session is the first session direction, and the session direction of the registered communication device as a client in a TCP communication session is the second session direction. By setting the first ACL and the second ACL, various actual scenario requirements can be met. For example, in the scenario where the related technology mentioned above cannot be configured to allow the communication device with IP address A1 to access the communication device with IP address A2, but not allow the communication device with IP address A2 to access the communication device with IP address A1, in an embodiment of the present application, an access control rule that allows the communication device with IP address A1 to access the communication device with IP address A2 can be configured in the first ACL, and an access control rule that prohibits the communication device with IP address A2 from accessing the communication device with IP address A1 can be configured in the second ACL to meet the configuration requirements of the scenario.

[0033] Whether the IP address and port in the first data packet are recorded in the service port set, and whether the IP address in the first data packet is recorded in the registered IP address set, can be used to determine whether the sender communication device and the receiver communication device of the first data packet are server or client, and whether the sender communication device and the receiver communication device of the first data packet are registered communication devices, thereby determining the session direction of the registered communication device, and realizing the session direction identification of the TCP communication session by the firewall device based on data packet detection. By determining the session direction of this TCP communication session, the first ACL or the second ACL corresponding to the session direction of this TCP communication session can be determined as the target ACL.

[0034] In step S203, an access control operation is performed according to the target ACL.

[0035] After determining the target ACL, the access control operation can be performed according to the access control rules in the target ACL. The target ACL includes the first ACL and / or the second ACL. The target ACL belongs to the ACL, and the ACL may include a prohibition access rule and / or a permission access rule. The prohibition access rule may include a communication rule that characterizes the prohibition of access, and the permission access rule may include a rule that characterizes the permission of access. For example, the rules of the first ACL are shown in Table 1 below:

[0036] Table 1

[0037] Serial number Source IP address Source Port Destination IP address Destination Port action 2 Cloud_IP_A ANY Cloud_IP_B 80 Do Not Pass 0 ANY ANY Cloud_IP_B 80 Allow through

[0038] Among them, the access control rule with sequence number 2 is a prohibition access rule, which means that the communication device with IP address Cloud_IP_A is prohibited from accessing port 80 of the communication device with IP address Cloud_IP_B through any port; the access control rule with sequence number 0 is a permission access rule, which means that the communication device with any IP address is allowed to access port 80 of the communication device with IP address Cloud_IP_B through any port.

[0039] In the case where the ACL includes a prohibition access rule, if the first data packet meets any one of the prohibition access rules, the TCP communication session to which the data packet belongs is blocked. If the first data packet meets any one of the prohibition access rules, it means that the TCP communication session to which the first data packet belongs is prohibited, and the TCP communication session should be blocked. In the case where the ACL includes a permission access rule, if the first data packet does not meet any one of the permission access rules, the TCP communication session to which the data packet belongs is blocked. If the first data packet meets the permission access rule, it means that the TCP communication session to which the first data packet belongs is permitted, and the TCP communication session can be continued. If the first data packet does not meet any one of the permission access rules, it means that the TCP communication session to which the first data packet belongs is prohibited, and the TCP communication session should be blocked. Specifically, blocking the TCP communication session to which the first data packet belongs can be specifically implemented as, but not limited to, the firewall device sends a session end packet to the initiator communication device and the receiver communication device of the TCP communication session to which the first data packet belongs, respectively, to end the TCP communication session to which the first data packet belongs, thereby blocking the TCP communication session.

[0040] In the embodiment of the present application, corresponding ACLs can be set for different session directions of TCP communication sessions. The firewall device can receive data packets transmitted after establishing a TCP communication session, and determine the session direction of the TCP communication session to which the data packet belongs according to the service port set that records the IP address and port of the communication device as the server, i.e., the receiver of the TCP communication session, thereby determining the ACL corresponding to the session scheme, and performing access control operations according to the ACL corresponding to the session direction. Through the service port set and the registered IP address set, the firewall device based on data packet detection can also identify the session direction of the TCP communication session, and can configure respective ACLs for different session directions, thereby configuring access control rules that meet various scenarios, so that the session access control of the firewall can meet the actual scenario requirements and improve the applicability of the firewall. Moreover, the service port set set by the firewall based on data packet detection occupies very little storage space, and the maintenance time and query time are very short, which can ensure the performance of session access control. Even if a network attacker conducts a network attack by continuously establishing TCP communication sessions, the number of IP addresses and ports recorded in the service port set is always kept at a low state, which can adapt to high-concurrency scenarios and avoid the firewall from being damaged by malicious attacks, thereby improving the security of session access control.

[0041] In some embodiments, the session direction of the communication device registered in the TCP communication session may be determined first, and the target ACL may be determined according to the session direction. The above step S202 may be specifically refined as follows: determining the session direction of the communication device registered in the TCP communication session according to whether the service port set includes the IP address and port in the first data packet, and whether the registered IP address set includes the IP address in the first data packet; determining the first ACL and / or the second ACL as the target ACL according to the session direction of the communication device registered in the TCP communication session.

[0042] According to whether the service port set includes the IP address and port in the first data packet and whether the registered IP address set includes the IP address in the first data packet, it can be determined whether the registered communication device is the service end or the receiving end in this TCP communication session, and then the session direction of the communication device registered in the TCP communication session can be determined, and the session direction of the communication device registered in the TCP communication session can be regarded as the session direction of the TCP communication session. The first data packet includes two groups of IP addresses and ports, one group of IP addresses and ports is the source IP address and source port, and the other group of IP addresses and ports is the destination IP address and destination port.

[0043] In some examples, the service port set includes the IP address and port of the communication device registered and used as the server, that is, the service port set records the IP address and port of the communication device protected by the firewall device and used as the server. If the service port set includes a set of IP addresses and ports in the first data packet, and the registered IP address set includes an IP address in a set of IP addresses and ports, it is determined that the session direction of the communication device registered in the TCP communication session includes the first session direction. The service port set includes a set of IP addresses and ports in the first data packet, which can be implemented as the service port set including the source IP address and source port in the first data packet or the service port set including the destination IP address and destination port in the first data packet. The service port set includes a set of IP addresses and ports in the first data packet, and the registered IP address set also includes the IP address in this set of IP addresses and ports, indicating that the communication device registered in the TCP communication session is the server, and the unregistered communication device in the TCP communication session is the client. In this case, it can be considered that the unregistered communication device initiates a TCP communication session to the registered communication device, that is, the session direction of the TCP communication session in which the registered communication device acts as the server is the first session direction. If the service port set does not include any set of IP addresses and ports in the first data packet, and the registered IP address set includes an IP address in a set of IP addresses and ports in the first data packet, it is determined that the session direction of the communication device registered in the TCP communication session includes the second session direction. The service port set does not include any set of IP addresses and ports in the first data packet, that is, the service port set does not include the source IP address and source port in the first data packet, nor does it include the destination IP address and source port in the first data packet. The service port set does not include any set of IP addresses and ports in the first data packet, and the registered IP address set includes an IP address in a set of IP addresses and ports in the first data packet, indicating that the communication device registered in the TCP communication session is a client, and the unregistered communication device in the TCP communication session is a server. In this case, it can be considered that the registered communication device initiates a TCP communication session to the unregistered communication device, that is, the session direction of the TCP communication session in which the registered communication device acts as a client is the second session direction. If the service port set includes a set of IP addresses and ports in the first data packet, and the registered IP address set includes the IP addresses in the two sets of IP addresses and ports in the first data packet, it is determined that the session direction of the communication device registered in the TCP communication session includes the first session direction and the second session direction. The service port set includes a set of IP addresses and ports in the first data packet, which can be implemented as the service port set including the source IP address and source port in the first data packet or the service port set including the destination IP address and destination port in the first data packet.The service port set includes a group of IP addresses and ports in the first data packet, and the registered IP address set includes the IP addresses in the two groups of IP addresses and ports in the first data packet, indicating that the two communication devices involved in the TCP communication session are both registered communication devices, one registered communication device in the TCP communication session is the server, and the other registered communication device in the TCP communication session is the client. In this case, it can be considered that the registered communication device initiates a TCP communication session to the registered communication device. For the registered communication device as the server, the session direction of the TCP communication session is the first session direction, and for the registered communication device as the client, the session direction of the TCP communication session is the second session direction. Therefore, the session directions of the TCP communication sessions for these two registered communication devices are the first session direction and the second session direction.

[0044] In some examples, the service port set includes the IP address and port of the communication device that is not registered and acts as a server, that is, the service port set records the IP address and port of the communication device that is not protected by the firewall device and acts as a server. If the service port set includes a set of IP addresses and ports in the first data packet, and the registered IP address set does not include the IP address in this set of IP addresses and ports, it is determined that the session direction of the communication device registered in the TCP communication session includes the second session direction. The service port set includes a set of IP addresses and ports in the first data packet, which can be implemented as the service port set including the source IP address and source port in the first data packet or the service port set including the destination IP address and destination port in the first data packet. The service port set includes a set of IP addresses and ports in the first data packet, and the registered IP address set does not include the IP address in this set of IP addresses and ports, indicating that the unregistered communication device in the TCP communication session is the server, and the registered communication device in the TCP communication session is the client. In this case, it can be considered that the registered communication device initiates a TCP communication session to the unregistered communication device, that is, the session direction of the TCP communication session in which the registered communication device acts as a client is the second session direction. If the service port set does not include any set of IP addresses and ports in the first data packet, and the registered IP address set includes an IP address in a set of IP addresses and ports in the first data packet, it is determined that the session direction of the communication device registered in the TCP communication session includes the first session direction. The service port set does not include any set of IP addresses and ports in the first data packet, that is, the service port set does not include the source IP address and source port in the first data packet, nor does it include the destination IP address and source port in the first data packet. The service port set does not include any set of IP addresses and ports in the first data packet, and the registered IP address set includes an IP address in a set of IP addresses and ports in the first data packet, indicating that the communication device registered in the TCP communication session is the server, and the unregistered communication device in the TCP communication session is the client. In this case, it can be considered that the unregistered communication device initiates a TCP communication session to the registered communication device, that is, the session direction of the TCP communication session of the registered communication device as the server is the first session direction. If the service port set does not include any set of IP addresses and ports in the first data packet, and the registered IP address set includes the IP addresses in the two sets of IP addresses and ports in the first data packet, it is determined that the session direction of the communication device registered in the TCP communication session includes the first session direction and the second session direction. The service port set does not include any set of IP addresses and ports in the first data packet, that is, the service port set does not include the source IP address and source port in the first data packet, nor does it include the destination IP address and source port in the first data packet.The service port set does not include any set of IP addresses and ports in the first data packet, and the registered IP address set includes the IP addresses in the two sets of IP addresses and ports in the first data packet, indicating that the two communication devices involved in the TCP communication session are both registered communication devices, one registered communication device in the TCP communication session is the server, and the other registered communication device in the TCP communication session is the client. In this case, it can be considered that the registered communication device initiates a TCP communication session to the registered communication device. For the registered communication device as the server, the session direction of the TCP communication session is the first session direction, and for the registered communication device as the client, the session direction of the TCP communication session is the second session direction. Therefore, the session directions of the TCP communication sessions for these two registered communication devices are the first session direction and the second session direction.

[0045] In the case where the session direction of the communication device registered in the TCP communication session includes the first session direction, the first ACL is determined as the target ACL. In the case where the session direction of the communication device registered in the TCP communication session includes the second session direction, the second ACL is determined as the target ACL. In the case where the session direction of the communication device registered in the TCP communication session includes the first session direction and the second session direction, the first ACL and the second ACL are determined as the target ACL.

[0046] In some embodiments, two communication devices need to perform a three-way handshake to establish a TCP communication session. In the process of establishing a TCP communication session, the firewall device can still detect the data packets transmitted during the process of establishing the TCP communication session to implement session access control. The following uses the service port set including the IP address and port of the communication device registered as the server and the service port set including the IP address and port of the communication device that is not registered as the server as an example to illustrate the session access control during the process of establishing a TCP communication session.

[0047] Figure 4 A flowchart of a session access control method provided by another embodiment of the present application, Figure 4 The illustrated method is for controlling session access when the service port set includes the IP address and port of the communication device registered as the server. Figure 4 and Figure 3 The difference is that Figure 4 The session access control method shown may further include steps S204 to S209.

[0048] In step S204, a third data packet is received.

[0049] The third data packet is a data packet transmitted during the first handshake in the process of establishing a TCP communication session. The third data packet has a request identifier, through which the data packet can be identified as the third data packet. The third data packet can also be called a synchronize packet, referred to as a SYN data packet, and the request identifier may include a SYN identifier. The third data packet includes a source IP address and a source port as well as a destination IP address and a destination port. Since the third data packet is a data packet transmitted during the first handshake in the process of establishing a TCP communication session, the sender communication device of the third data packet is the client of the TCP communication session, and the receiver communication device of the third data packet is the server of the TCP communication session. Correspondingly, the source IP and source port in the third data packet are the IP address and port of the client of the TCP communication session, and the destination IP address and destination port in the third data packet are the IP address and port of the server of the TCP communication session.

[0050] In step S205, if the registered IP address set includes the destination IP address in the third data packet, an access control operation is performed according to the first ACL.

[0051] The registered IP address set includes the destination IP address in the third data packet, indicating that the registered communication device is the server of the TCP communication session, the session direction of the communication device registered in the TCP communication session includes the first session direction, and the access control operation is performed according to the first ACL corresponding to the first session direction.

[0052] In step S206, if the registered IP address set includes the source IP address in the second data packet, an access control operation is performed according to the second ACL.

[0053] The registered IP address set includes the source IP address in the third data packet, indicating that the registered communication device is the client of the TCP communication session, the session direction of the communication device registered in the TCP communication session includes the second session direction, and the access control operation is performed according to the second ACL corresponding to the second session direction.

[0054] It should be noted that if the registered IP address set includes the source IP address and the destination IP address in the second data packet, it means that one registered communication device in the TCP communication session acts as a server and the other registered communication device acts as a client. The session direction of the one registered communication device in the TCP communication session is the first session direction, and the session direction of the other registered communication device is the second session direction, that is, the session direction of the communication devices registered in the TCP communication session includes the first session direction and the second session direction, and access control operations are performed according to the first ACL and the second ACL.

[0055] Through the third data packet and the registered IP address set, the session direction of the TCP communication session can be determined, and then the access control operation can be performed to ensure the security of session access control during the establishment of the TCP communication session.

[0056] In step S207, a second data packet is received.

[0057] The second data packet is a data packet transmitted during the second handshake in the process of establishing a TCP communication session. The second data packet has a request and confirmation mark, through which the data packet can be identified as the second data packet. The second data packet can also be called a SYN / ACK data packet or a SYN+ACK data packet. The request and confirmation mark may include a SYN / ACK mark. The second data packet includes a source IP address and a source port as well as a destination IP address and a destination port. Since the second data packet is a data packet transmitted during the second handshake in the process of establishing a TCP communication session, the sender communication device of the second data packet is the server of the TCP communication session, and the receiver communication device of the second data packet is the client of the TCP communication session. Correspondingly, the source IP and source port in the second data packet are the IP address and port of the server of the TCP communication session, and the destination IP address and destination port in the second data packet are the IP address and port of the client of the TCP communication session.

[0058] In step S208, if the registered IP address set includes the source IP address in the second data packet, the source IP address and source port in the second data packet are written into the service port set, and the access control operation is performed according to the first ACL.

[0059] The registered IP address set includes the source IP address in the second data packet, indicating that the communication device corresponding to the source IP address in the second data packet is a registered communication device, and the registered communication device is a server in the TCP communication session, so the source IP address and source port in the second data packet are written into the service port set to ensure that the service port set records the IP addresses and ports of all registered communication devices that serve as servers, so that after the TCP communication session is established, the service port set is used to determine the session direction of the TCP communication session to which the subsequent first data packet belongs. The registered communication device is a server in the TCP communication session, and the session direction of the communication device registered in the TCP communication session includes a first session direction, and the access control operation is performed according to the first ACL corresponding to the first session direction.

[0060] In step S209, if the registered IP address set includes the destination IP address in the second data packet, an access control operation is performed according to the second ACL.

[0061] The registered IP address set includes the destination IP address in the second data packet, indicating that the communication device corresponding to the destination IP address in the second data packet is a registered communication device, and the registered communication device is a client in the TCP communication session, and it is not necessary to write the source IP address and source port in the second data packet into the service port set. The registered communication device acts as a client in the TCP communication session, and the session direction of the registered communication device in the TCP communication session includes a second session direction, and the access control operation is performed according to the second ACL corresponding to the second session direction.

[0062] In some examples, if the registered IP address set includes the destination IP address in the second data packet but does not include the source IP address, and the service port set includes the destination IP address and the destination port in the second data packet, the destination IP address and the destination port in the second data packet are deleted from the service port set. The registered IP address set includes the destination IP address in the second data packet but does not include the source IP address, indicating that the registered communication device is a client in the TCP communication session. If the service port set includes the destination IP address and the destination port in the second data packet at this time, it may be that the registered communication device is a server in the previously established TCP communication session. In order to prevent the previously established TCP communication session from affecting this TCP communication session, the destination IP address and the destination port in the second data packet are deleted from the service port set to prevent the registered communication device from being considered as a server in this TCP communication session.

[0063] It should be noted that if the registered IP address set includes the source IP address and the destination IP address in the second data packet, it means that one registered communication device in the TCP communication session acts as a server and the other registered communication device acts as a client. The session direction of the one registered communication device in the TCP communication session is the first session direction, and the session direction of the other registered communication device is the second session direction, that is, the session direction of the communication devices registered in the TCP communication session includes the first session direction and the second session direction, and access control operations are performed according to the first ACL and the second ACL.

[0064] During the second handshake process of establishing a TCP communication session, the service port set can be dynamically updated to accurately determine the session direction of the TCP communication session to which the first transmitted data packet belongs, select the correct ACL, and improve the security of session access control.

[0065] Figure 5 A flowchart of a session access control method provided by another embodiment of the present application, Figure 5 The method for controlling session access when the service port set includes the IP address and port of the communication device that is not registered and acts as the server is shown. Figure 5 and Figure 3The difference is that Figure 4 The session access control method shown may further include steps S210 to S216.

[0066] In step S210, a third data packet is received.

[0067] In step S211, if the registered IP address set includes the destination IP address in the third data packet, an access control operation is performed according to the first ACL.

[0068] In step S212, if the registered IP address set includes the source IP address in the second data packet, an access control operation is performed according to the second ACL.

[0069] In step S213, a second data packet is received.

[0070] The second data packet has a request and confirmation identifier. The second data packet includes a source IP address and a source port and a destination IP address and a destination port.

[0071] The specific contents of step S210 to step S213 are substantially the same as the specific contents of step S204 to step S207 in the above embodiment, and reference may be made to the relevant descriptions above, which will not be repeated here.

[0072] In step S214, if the registered IP address set includes the destination IP address in the second data packet but does not include the source IP address, the source IP address and source port in the second data packet are written into the service port set, and access control operations are performed according to the second ACL.

[0073] The registered IP address set includes the destination IP address in the second data packet but does not include the source IP address, indicating that the communication device corresponding to the destination IP address in the second data packet is a registered communication device, and the communication device corresponding to the source IP address in the second data packet is an unregistered communication device, and the registered communication device is a client in the TCP communication session, and the unregistered communication device is a server in the TCP communication session, so the source IP address and source port in the second data packet are written into the service port set to ensure that the service port set records the IP addresses and ports of all unregistered communication devices that serve as servers, so that after the TCP communication session is established, the service port set is used to determine the session direction of the TCP communication session to which the subsequent first data packet belongs. The registered communication device acts as a client in the TCP communication session, and the session direction of the registered communication device in the TCP communication session includes the second session direction, and the access control operation is performed according to the second ACL corresponding to the second session direction.

[0074] In step S215, if the registered IP address set includes the source IP address in the second data packet but does not include the destination IP address, an access control operation is performed according to the first ACL.

[0075] The registered IP address set includes the source IP address in the second data packet but does not include the destination IP address, indicating that the communication device corresponding to the source IP address in the second data packet is a registered communication device, and the communication device corresponding to the destination IP address in the second data packet is an unregistered communication device. The registered communication device is a server in the TCP communication session, and the unregistered communication device is a client in the TCP communication session. It is not necessary to write the destination IP address and the destination port in the second data packet into the service port set. The registered communication device is a server in the TCP communication session, and the session direction of the registered communication device in the TCP communication session includes a first session direction, and the access control operation is performed according to the first ACL corresponding to the first session direction.

[0076] In some examples, if the registered IP address set includes the source IP address in the second data packet but does not include the destination IP address, and the service port set includes the destination IP address and the destination port in the second data packet, the destination IP address and the destination port in the second data packet are deleted from the service port set. The registered IP address set includes the source IP address in the second data packet but does not include the destination IP address, indicating that the unregistered communication device is a client in the TCP communication session. If the service port set includes the destination IP address and the destination port in the second data packet at this time, it may be that the unregistered communication device is a server in the previously established TCP communication session. In order to prevent the previously established TCP communication session from affecting this TCP communication session, the destination IP address and the destination port in the second data packet are deleted from the service port set to prevent the registered communication device from being considered as a server in this TCP communication session.

[0077] In step S216, if the registered IP address set includes the source IP address and the destination IP address in the second data packet, an access control operation is performed according to the first ACL and the second ACL.

[0078] The registered IP address set includes the source IP address and the destination IP address in the second data packet, indicating that one registered communication device in the TCP communication session serves as a server and the other registered communication device serves as a client. The session direction of the one registered communication device in the TCP communication session is a first session direction and the session direction of the other registered communication device is a second session direction, that is, the session directions of the registered communication devices in the TCP communication session include the first session direction and the second session direction, and access control operations are performed according to the first ACL and the second ACL.

[0079] During the second handshake process of establishing a TCP communication session, the service port set can be dynamically updated to accurately determine the session direction of the TCP communication session to which the first transmitted data packet belongs, select the correct ACL, and improve the security of session access control.

[0080] In the above embodiment, when the ACL includes a prohibit access rule, if the second data packet meets any one of the prohibit access rules, the TCP communication session to which the second data packet belongs is blocked; when the ACL includes a permit access rule, if the second data packet does not meet any one of the permit access rules, the TCP communication session to which the second data packet belongs is blocked. When the ACL includes a prohibit access rule, if the third data packet meets any one of the prohibit access rules, the TCP communication session to which the third data packet belongs is blocked; when the ACL includes a permit access rule, if the third data packet does not meet any one of the permit access rules, the TCP communication session to which the third data packet belongs is blocked. For the specific content, please refer to the relevant description of blocking the TCP communication session to which the first data packet belongs above, which will not be repeated here.

[0081] It should be noted that the session direction of the communication device registered in the TCP communication session mentioned in the embodiment of the present application may specifically include the session direction of the port of the communication device registered in the TCP communication session.

[0082] In some embodiments, a port of a communication device may act as both a client and a server, that is, the session direction of the registered communication device includes both a first session direction and a second session direction. In this case, a predetermined access control policy may be executed. The predetermined access control policy may include: performing an access control operation according to the first ACL; or, performing an access control operation according to the second ACL; or, performing an access control operation according to the first ACL and the second ACL. The predetermined access control policy may include performing an access control operation according to the first ACL, indicating that the port of the communication device that acts as both a client and a server is forcibly marked as a server. The predetermined access control policy may include performing an access control operation according to the second ACL, indicating that the port of the communication device that acts as both a client and a server is forcibly marked as a client. The predetermined access control policy may include performing an access control operation according to the first ACL and the second ACL, indicating that the port of the communication device that acts as both a client and a server is forcibly marked as a client. The mandatory marking behavior may be performed in advance, or may be performed when it is detected that a port of the communication device acts as both a client and a server, which is not limited here. The predetermined access control policy may also be adjusted and updated according to scenarios, requirements, etc.

[0083] The firewall in the embodiment of the present application can be implemented as a cloud firewall. Figure 6 A schematic diagram of an example of the architecture of a cloud firewall provided in an embodiment of the present application is shown as follows: Figure 6 As shown, the cloud firewall 30 includes a firewall unit 31, a network traffic analysis (NTA) unit 32, a security management unit 33, a synchronization unit 34 and an ACL management unit 35. The security management unit 33 may have a blocking mode function and a banning management function, and these two functions can be triggered and executed by the inbound ACL management and the outbound ACL management in the ACL management unit 35 synchronized by the synchronization unit 34. The inbound direction is the first session direction in the above embodiment, and the outbound direction is the second session direction in the above embodiment. The cloud firewall 30 can communicate and interact with the user's communication device 40, and the data traffic transmitted to the communication device 40 can be transmitted to the firewall unit 31 and the NTA unit 32 in a mirrored traffic manner. The firewall unit 31 queries and manages the blocking instructions through the banning management function in the security management unit 33, and issues the blocking instructions to the firewall unit 31 through the blocking mode function in the security management unit 33, so that the firewall unit 31 performs the blocking action. The NTA unit 32 may also be able to provide blocking suggestions to the security management unit 33.

[0084] For ease of understanding, the session access control method in the above embodiment is illustrated below by taking three specific scenarios where the service port set includes the IP address and port of a communication device that is registered and serves as a server.

[0085] Scenario 1: The IP address of the registered communication device of user A is Cloud_IP_A, and an exit IP address of the company where user A works is OA_OUT_IP_A. The session access control of the registered communication device is expected to meet the following requirements: (1) All communication device ports can access the website services published by ports 443 and 80 of the registered communication device's IP address Cloud_IP_A; (2) Only the company is allowed to log in to the registered communication device's IP address Cloud_IP_A for operation and maintenance operations, that is, only IP address OA_OUT_IP_A is allowed to access port 22 of IP address Cloud_IP_A; (3) Since the registered communication device corresponding to IP address Cloud_IP_A needs to have unrestricted access to external services, it can call external application programming interface (API) API services, conduct vulnerability audits, etc. In response to the above requirements, the first ACL shown in Table 2 and the second ACL shown in Table 3 can be configured:

[0086] Table 2

[0087]

[0088] Table 3

[0089]

[0090] Among them, ANY in IP address represents any IP address, and ANY in port represents any port; sequence number 1 corresponds to the above requirement (1), sequence number 2 corresponds to the above requirement (2), and sequence number 3 corresponds to the above requirement (3).

[0091] The access request in scenario 1 is: an IP address IP_B that does not belong to OA_OUT_IP_A attempts to access port 22 of Cloud_IP_A. Correspondingly, the access control process of the TCP communication session may include steps a1 to a3.

[0092] In step a1, IP_B sends a SYN packet to port 22 of Cloud_IP_A through a random port random_b. The session direction can be directly determined as the first session direction based on the SYN packet. Therefore, when the firewall detects the SYN packet, it queries the first ACL in combination with the IP address of the communication device registered as Cloud_IP_A, and determines that the access request does not comply with any access permission rule in the first ACL. The access request should be rejected, thereby executing blocking measures.

[0093] If the blocking in step a1 fails due to other reasons, the session direction can be determined again in step a2, and the corresponding ACL can be searched to execute blocking measures.

[0094] In step a2, port 22 of Cloud_IP_A sends a SYN+ACK packet to a random port random_b of IP_B. After the firewall detects the packet, Cloud_IP_A and port 22 are registered as service ports and written into the service port set because Cloud_IP_A is the registered IP address of the communication device and acts as a server. After the SYN+ACK packet is detected, combined with Cloud_IP_A being the registered IP address of the communication device, the first ACL is queried to determine that the access request does not meet any of the access-allowing rules in the first ACL, and the access request should be rejected, thereby executing blocking measures.

[0095] If the blocking in step a2 fails due to other reasons, the session direction can be determined again in step a3, and the corresponding ACL can be searched to execute the blocking measure.

[0096] In step a3, the TCP communication session has been established, and the firewall detects each first data packet transmitted between port 22 of Cloud_IP_A and a random port random_b of IP_B. Port 22 of Cloud_IP_A in the first data packet is in the service port set, and Cloud_IP_A is in the registered IP address set. The session direction is determined to be the first session direction, and the first ACL is queried to determine that the access request does not comply with any access permission rule in the first ACL. The access request should be rejected, and blocking measures are performed.

[0097] Scenario 2: The first ACL and the second ACL configured in Scenario 2 are the same as those in Scenario 1. The difference is that the access request in Scenario 2 is: Cloud_IP_A accesses the service of port 80 of IP_C, and IP_C is the IP address of an unregistered communication device. Correspondingly, the access control process of the TCP communication session may include steps b1 to b3.

[0098] In step b1, Cloud_IP_A sends a SYN packet to port 80 of IP_C through a random port random_a. The session direction can be directly determined as the second session direction based on the SYN packet. Therefore, when the firewall detects the SYN packet, it queries the second ACL in combination with the IP address of the communication device registered as Cloud_IP_A, determines that the access request meets the access permission rule in the second ACL, and the access request should be accepted, thereby releasing the access request.

[0099] In step b2, port 80 of IP_C sends a SYN+ACK packet to random port random_a of Cloud_IP_A. The communication device corresponding to IP_C is the server of the TCP communication session, and the communication device corresponding to IP_C is an unregistered communication device. Port 80 of IP_C will not be written into the service port set. At the same time, because the communication device corresponding to Cloud_IP_A is the client of the TCP communication session, the session direction is determined to be the second session direction, and the second ACL is queried to determine that the access request meets the access permission rule in the second ACL. The access request should be accepted, and thus the access request is released.

[0100] In step b3, the TCP communication session has been established, and the firewall detects each first data packet transmitted between port 80 of IP_C and random port random_a of Cloud_IP_A. The random port random_a of Cloud_IP_A and port 80 of IP_C in the first data packet are not in the service port set. The session direction is determined to be the second direction, and the second ACL is queried to determine that the access request meets the access permission rule in the second ACL. The access request should be accepted, and the access request is released.

[0101] Scenario 3: The IP address of user A's registered communication device is Cloud_IP_A, and the IP address of user B's registered communication device is Cloud_IP_B. The session access control of these two registered communication devices is expected to meet the following requirements: (1) Cloud_IP_B opens the Web service of port 80 to the outside world; (2) Cloud_IP_A allows its own access to the service of port 80 of Cloud_IP_B; (3) However, Cloud_IP_B prohibits Cloud_IP_A from accessing port 80 of Cloud_IP_B. In response to the above requirements, the first ACL shown in Table 4 and the second ACL shown in Table 5 can be configured:

[0102] Table 4

[0103]

[0104] Table 5

[0105]

[0106] Among them, ANY in IP address represents any IP address, and ANY in port represents any port; sequence number 1 corresponds to the above requirement (1), sequence number 2 corresponds to the above requirement (2), and sequence number 3 corresponds to the above requirement (3).

[0107] The access request in scenario three is: Cloud_IP_A accesses port 80 of Cloud_IP_B through a random port random_a. Correspondingly, the access control process of the TCP communication session may include steps c1 to c3.

[0108] In step c1, Cloud_IP_A will send a SYN packet to Cloud_IP_B:80 through a random port random_a. According to the SYN packet, the session direction is determined to be Cloud_IP_A to Cloud_IP_B. The communication device corresponding to Cloud_IP_A and the communication device corresponding to Cloud_IP_B are both registered communication devices. Therefore, the session direction includes the first session direction and the second session direction. The first ACL and the second ACL are queried to determine that the access request meets the access prohibition rules in the first ACL and the second ACL. The access request should be rejected, and blocking measures are performed.

[0109] If the blocking in step c1 fails due to other reasons, the session direction can be determined again in step c2, and the corresponding ACL can be searched to execute the blocking measure.

[0110] In step c2, port 80 of Cloud_IP_B sends a SYN+ACK packet to random port random_a of Cloud_IP_A. According to the SYN+ACK packet, the session direction is determined to be Cloud_IP_A to Cloud_IP_B. Cloud_IP_B is the server in the TCP communication session, and port 80 of Cloud_IP_B is written into the service port set. The communication device corresponding to Cloud_IP_A and the communication device corresponding to Cloud_IP_B are both registered communication devices, so the session direction includes the first session direction and the second session direction. The first ACL and the second ACL are queried to determine that the access request meets the access prohibition rules in the first ACL and the second ACL, and the access request should be rejected, so as to perform blocking measures.

[0111] If the blocking in step c2 fails due to other reasons, the session direction can be determined again in step c3, and the corresponding ACL can be searched to execute the blocking measure.

[0112] In step c3, the TCP communication session has been established, and the firewall detects each first data packet transmitted between port 80 of Cloud_IP_B and random port random_a of Cloud_IP_A. Port 80 of Cloud_IP_B in the first data packet is in the service port set, and the communication device corresponding to Cloud_IP_A and the communication device corresponding to Cloud_IP_B are both registered communication devices. Therefore, the session direction includes the first session direction and the second session direction. The first ACL and the second ACL are queried to determine that the access request meets the access prohibition rules in the first ACL and the second ACL, and the access request should be rejected, thereby executing blocking measures.

[0113] Through the examples of the above scenarios, it can be seen that the session access control method provided in the embodiments of the present application can be used to configure access control rules that meet various scenarios. For example, the configuration of access control rules for the scenario in which a communication device with IP address A1 can access a communication device with IP address A2, but a communication device with IP address A2 is not allowed to access a communication device with IP address A1 can be implemented. This enables the access control of the firewall to meet the actual scenario requirements, improves the applicability and accuracy of the session access control of the firewall, and ensures the security of the session access control.

[0114] A second aspect of the present application provides a session access control device. Figure 7 A schematic diagram of the structure of a session access control device provided in an embodiment of the present application is shown in FIG. Figure 7 As shown, the session access control device 500 may include a receiving module 501 , an access control table determination module 502 and an access control module 503 .

[0115] The receiving module 501 may be configured to receive a first data packet.

[0116] The first data packet includes a data packet transmitted after a Transmission Control Protocol TCP communication session is established.

[0117] The access control list determination module 502 may be used to determine a preset first access control list ACL and / or a preset second ACL as a target ACL based on the network protocol IP address and port, the service port set and the registered IP address set in the first data packet.

[0118] The service port set includes the IP address and port of the communication device that is registered and acts as the server, or includes the IP address and port of the communication device that is not registered and acts as the server. The server is the receiver of the TCP communication session. The registered IP address set includes the IP address of the registered communication device. The first ACL corresponds to the first session direction of the registered communication device, and the second ACL corresponds to the second session direction of the registered communication device.

[0119] The access control module 503 may be used to perform access control operations according to the target ACL.

[0120] In some embodiments, the access control list determination module 502 can be specifically used to: determine the session direction of the communication device registered in the TCP communication session based on whether the service port set includes the IP address and port in the first data packet, and whether the registered IP address set includes the IP address in the first data packet; and determine the first ACL and / or the second ACL as the target ACL based on the session direction of the communication device registered in the TCP communication session.

[0121] In some examples, the first data packet includes two groups of IP addresses and ports, and the service port set includes the IP address and port of the communication device registered and serving as the service end. The access control table determination module 502 can be specifically used to: if the service port set includes a group of IP addresses and ports in the first data packet, and the registered IP address set includes an IP address in a group of IP addresses and ports, determine that the session direction of the communication device registered in the TCP communication session includes a first session direction; if the service port set does not include any group of IP addresses and ports in the first data packet, and the registered IP address set includes an IP address in a group of IP addresses and ports in the first data packet, determine that the session direction of the communication device registered in the TCP communication session includes a second session direction; if the service port set includes a group of IP addresses and ports in the first data packet, and the registered IP address set includes an IP address in two groups of IP addresses and ports in the first data packet, determine that the session direction of the communication device registered in the TCP communication session includes the first session direction and the second session direction.

[0122] In some examples, the first data packet includes two groups of IP addresses and ports, and the service port set includes the IP address and port of the communication device that is not registered and serves as the service end. The access control table determination module 502 can be specifically used to: if the service port set includes a group of IP addresses and ports in the first data packet, and the registered IP address set does not include an IP address in a group of IP addresses and ports, determine that the session direction of the communication device registered in the TCP communication session includes the second session direction; if the service port set does not include any group of IP addresses and ports in the first data packet, and the registered IP address set includes an IP address in a group of IP addresses and ports in the first data packet, determine that the session direction of the communication device registered in the TCP communication session includes the first session direction; if the service port set does not include any group of IP addresses and ports in the first data packet, and the registered IP address set includes an IP address in two groups of IP addresses and ports in the first data packet, determine that the session direction of the communication device registered in the TCP communication session includes the first session direction and the second session direction.

[0123] In some examples, the access control list determination module 502 can be specifically used to: determine the first ACL as the target ACL when the session direction of the communication device registered in the TCP communication session includes the first session direction; determine the second ACL as the target ACL when the session direction of the communication device registered in the TCP communication session includes the second session direction; determine the first ACL and the second ACL as the target ACLs when the session direction of the communication device registered in the TCP communication session includes the first session direction and the second session direction.

[0124] In some embodiments, the service port set includes the IP address and port of the communication device that is registered and acts as a server.

[0125] The receiving module 501 can also be used to: receive a second data packet before receiving the first data packet, the second data packet having a request and confirmation identifier, and the second data packet including a source IP address and a source port and a destination IP address and a destination port.

[0126] The access control module 503 can also be used for: if the registered IP address set includes the source IP address in the second data packet, the source IP address and source port in the second data packet are written into the service port set, and the access control operation is performed according to the first ACL; if the registered IP address set includes the destination IP address in the second data packet, the access control operation is performed according to the second ACL.

[0127] In some examples, the access control module 503 can also be used to: if the registered IP address set includes the destination IP address in the second data packet but does not include the source IP address, and the service port set includes the destination IP address and destination port in the second data packet, then delete the destination IP address and destination port in the second data packet from the service port set.

[0128] In some embodiments, the service port set includes the IP address and port of the communication device that is not registered and acts as a server.

[0129] The receiving module 501 can also be used to: receive a second data packet before receiving the first data packet, the second data packet having a request and confirmation identifier, and the second data packet including a source IP address and a source port and a destination IP address and a destination port.

[0130] The access control list determination module 502 can also be used for: if the registered IP address set includes the destination IP address in the second data packet but does not include the source IP address, then the source IP address and the source port in the second data packet are written into the service port set, and the access control operation is performed according to the second ACL; if the registered IP address set includes the source IP address in the second data packet but does not include the destination IP address, then the access control operation is performed according to the first ACL; if the registered IP address set includes the source IP address and the destination IP address in the second data packet, then the access control operation is performed according to the first ACL and the second ACL.

[0131] In some examples, the access control list determination module 502 can also be used to: if the registered IP address set includes the source IP address in the second data packet but does not include the destination IP address, and the service port set includes the destination IP address and destination port in the second data packet, then delete the destination IP address and destination port in the second data packet from the service port set.

[0132] In some embodiments, the receiving module 501 may also be used to: receive a third data packet before receiving the first data packet, the third data packet having a request identifier, and the third data packet including a source IP address and a source port and a destination IP address and a destination port.

[0133] The access control list determination module 502 can also be used to: if the registered IP address set includes the destination IP address in the third data packet, then perform access control operations according to the first ACL; if the registered IP address set includes the source IP address in the second data packet, then perform access control operations according to the second ACL.

[0134] In some embodiments, the access control table determination module 502 may also be used to: execute a predetermined access control policy when a session direction of a registered communication device includes both a first session direction and a second session direction.

[0135] The predetermined access control policy includes: performing access control operations according to the first ACL; or performing access control operations according to the second ACL; or performing access control operations according to the first ACL and the second ACL.

[0136] In some embodiments, the ACL includes a first ACL and / or a second ACL. The access control list determination module 502 can also be used to: when the ACL includes a prohibition access rule, if the data packet meets any one of the prohibition access rules, block the TCP communication session to which the data packet belongs; when the ACL includes a permission access rule, if the data packet does not meet any one of the permission access rules, block the TCP communication session to which the data packet belongs. The data packet includes at least one of the first data packet, the second data packet, and the third data packet.

[0137] It should be noted that the session access control device 500 is a device corresponding to the above-mentioned session access control method, and all implementation methods in the above-mentioned method embodiment are applicable to the embodiment of the device and can achieve the same technical effect.

[0138] The third aspect of the present application also provides a firewall device. Figure 8 A schematic diagram of the structure of a firewall device provided in an embodiment of the present application is shown in FIG. Figure 8 As shown, the firewall device 600 includes a memory 601 , a processor 602 , and a computer program stored in the memory 601 and executable on the processor 602 .

[0139] In some examples, the processor 602 may include a central processing unit (CPU), or an application specific integrated circuit (ASIC), or may be configured to implement one or more integrated circuits of the embodiments of the present application.

[0140] The memory 601 may include a read-only memory (ROM), a random access memory (RAM), a disk storage medium device, an optical storage medium device, a flash memory device, an electrical, optical or other physical / tangible memory storage device. Therefore, typically, the memory includes one or more tangible (non-transitory) computer-readable storage media (e.g., a memory device) encoded with software including computer executable instructions, and when the software is executed (e.g., by one or more processors), it is operable to perform the operations described with reference to the session access control method in the embodiment of the present application.

[0141] The processor 602 runs a computer program corresponding to the executable program code by reading the executable program code stored in the memory 601, so as to implement the session access control method in the above embodiment.

[0142] In some examples, the firewall device 600 may also include a communication interface 603 and a bus 604. Figure 8 As shown, the memory 601, the processor 602, and the communication interface 603 are connected via a bus 604 and communicate with each other.

[0143] The communication interface 603 is mainly used to realize the communication between the modules, devices, units and / or equipment in the embodiment of the present application. The communication interface 603 can also be used to access input devices and / or output devices.

[0144] The bus 604 includes hardware, software, or both, coupling the components of the firewall device 600 to each other. By way of example and not limitation, the bus 604 may include an Accelerated Graphics Port (AGP) or other graphics bus, an Enhanced Industry Standard Architecture (EISA) bus, a Front Side Bus (FSB), a Hyper Transport (HT) interconnect, an Industry Standard Architecture (ISA) bus, an InfiniBand interconnect, a Low Pin Count (LPC) bus, a Memory bus, a Micro Channel Architecture (MCA) bus, a Peripheral Component Interconnect (PCI) bus, a PCI-Express (PCI-E) bus, a Serial Advanced Technology Attachment (SATA) bus, a Video Electronics Standards Association Local Bus (VLB) bus, or other suitable buses or a combination of two or more of the above. Where appropriate, the bus 604 may include one or more buses. Although embodiments of the present application describe and illustrate a particular bus, the present application contemplates any suitable bus or interconnect.

[0145] In a fourth aspect, the present application provides a computer-readable storage medium, on which a computer program instruction is stored, and when the computer program instruction is executed by a processor, the session access control method in the above embodiment can be implemented, and the same technical effect can be achieved. To avoid repetition, it is not repeated here. Among them, the above-mentioned computer-readable storage medium may include a non-transitory computer-readable storage medium, such as a read-only memory (Read-Only Memory, referred to as ROM), a random access memory (Random Access Memory, referred to as RAM), a disk or an optical disk, etc., which is not limited here.

[0146] The fifth aspect of the present application provides a computer program product, which includes a computer program. When the computer program is executed by a processor, it implements the session access control method in the above embodiment and can achieve the same technical effect. To avoid repetition, it will not be repeated here.

[0147] It should be clear that each embodiment in this specification is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. For device embodiments, equipment embodiments, computer-readable storage medium embodiments, and computer program product embodiments, the relevant parts can refer to the description part of the method embodiment. The present application is not limited to the specific steps and structures described above and shown in the figures. Those skilled in the art can make various changes, modifications and additions, or change the order between the steps after understanding the spirit of the present application. In addition, for the sake of brevity, a detailed description of known method technologies is omitted here.

[0148] The above reference is according to the method of the embodiment of the present application, the flow chart of the device (system) and the computer program product and / or the block diagram described various aspects of the present application.It should be understood that each square box in the flow chart and / or the block diagram and the combination of each square box in the flow chart and / or the block diagram can be realized by computer program instructions.These computer program instructions can be provided to the processor of a general-purpose computer, a special-purpose computer or other programmable data processing device to produce a machine so that these instructions executed by the processor of the computer or other programmable data processing device enable the realization of the function / action specified in one or more square boxes of the flow chart and / or the block diagram.Such a processor can be but is not limited to a general-purpose processor, a special-purpose processor, a special application processor or a field programmable logic circuit.It can also be understood that each square box in the block diagram and / or the flow chart and the combination of the square boxes in the block diagram and / or the flow chart can also be realized by the dedicated hardware that performs the specified function or action, or can be realized by the combination of dedicated hardware and computer instructions.

[0149] Those skilled in the art should understand that the above embodiments are exemplary rather than restrictive. Different technical features appearing in different embodiments can be combined to achieve beneficial effects. Based on the study of the drawings, the specification and the claims, those skilled in the art should be able to understand and implement other variations of the disclosed embodiments. In the claims, the term "comprising" does not exclude other devices or steps; the quantifier "one" does not exclude multiple; the terms "first" and "second" are used to indicate names rather than to indicate any specific order. Any figure marks in the claims should not be understood as limiting the scope of protection. The functions of multiple parts appearing in the claims can be implemented by a single hardware or software module. The appearance of certain technical features in different dependent claims does not mean that these technical features cannot be combined to achieve beneficial effects.

Claims

1. A session access control method, characterized in that: include: receiving a first data packet, wherein the first data packet comprises a data packet transmitted after establishing a Transmission Control Protocol (TCP) communication session; Based on the network protocol IP address and port, the service port set and the registered IP address set in the first data packet, a preset first access control list ACL and / or a preset second ACL is determined as a target ACL, the service port set includes the IP address and port of a communication device that is registered and acts as a server, or includes the IP address and port of a communication device that is not registered and acts as a server, the server is a receiver of a TCP communication session, the registered IP address set includes the IP address of the registered communication device, the first ACL corresponds to a first session direction of the registered communication device, and the second ACL corresponds to a second session direction of the registered communication device; According to the target ACL, an access control operation is performed.

2. The method according to claim 1, characterized in that The step of determining a preset first access control list ACL and / or a preset second ACL as a target ACL based on the network protocol IP address and port, the service port set, and the registered IP address set in the first data packet includes: Determine the session direction of the communication device registered in the TCP communication session according to whether the service port set includes the IP address and port in the first data packet, and whether the registered IP address set includes the IP address in the first data packet; The first ACL and / or the second ACL is determined as the target ACL according to the session direction of the communication device registered in the TCP communication session.

3. The method according to claim 2, characterized in that The first data packet includes two sets of IP addresses and ports, and the service port set includes the IP address and port of the communication device registered and serving as the server; The determining, according to whether the service port set includes the IP address and port in the first data packet, and whether the registered IP address set includes the IP address in the first data packet, the session direction of the communication device registered in the TCP communication session comprises: If the service port set includes a set of IP addresses and ports in the first data packet, and the registered IP address set includes an IP address in the set of IP addresses and ports, determining that the session direction of the communication device registered in the TCP communication session includes the first session direction; If the service port set does not include any set of IP addresses and ports in the first data packet, and the registered IP address set includes an IP address in a set of IP addresses and ports in the first data packet, determining that the session direction of the communication device registered in the TCP communication session includes the second session direction; If the service port set includes a group of IP addresses and ports in the first data packet, and the registered IP address set includes the IP addresses in two groups of IP addresses and ports in the first data packet, it is determined that the session direction of the communication device registered in the TCP communication session includes the first session direction and the second session direction.

4. The method according to claim 2, characterized in that: The first data packet includes two sets of IP addresses and ports, and the service port set includes the IP address and port of an unregistered communication device serving as a server; The determining, according to whether the service port set includes the IP address and port in the first data packet, and whether the registered IP address set includes the IP address in the first data packet, the session direction of the communication device registered in the TCP communication session comprises: If the service port set includes a set of IP addresses and ports in the first data packet, and the registered IP address set does not include an IP address in the set of IP addresses and ports, determining that the session direction of the communication device registered in the TCP communication session includes the second session direction; If the service port set does not include any set of IP addresses and ports in the first data packet, and the registered IP address set includes an IP address in a set of IP addresses and ports in the first data packet, determining that the session direction of the communication device registered in the TCP communication session includes the first session direction; If the service port set does not include any set of IP addresses and ports in the first data packet, and the registered IP address set includes the IP addresses in two sets of IP addresses and ports in the first data packet, it is determined that the session direction of the communication device registered in the TCP communication session includes the first session direction and the second session direction.

5. The method according to claim 2, characterized in that: The determining, according to the session direction of the communication device registered in the TCP communication session, the first ACL and / or the second ACL as the target ACL comprises: In a case where the session direction of the communication device registered in the TCP communication session includes the first session direction, determining the first ACL as the target ACL; In a case where the session direction of the communication device registered in the TCP communication session includes the second session direction, determining the second ACL as the target ACL; In a case where the session direction of the communication device registered in the TCP communication session includes the first session direction and the second session direction, the first ACL and the second ACL are determined as the target ACLs.

6. The method according to claim 1, characterized in that The service port set includes the IP address and port of the communication device registered and serving as the server; Before receiving the first data packet, the method further includes: Receive a second data packet, the second data packet having a request and confirmation identifier, the second data packet including a source IP address and a source port and a destination IP address and a destination port; If the registered IP address set includes the source IP address in the second data packet, writing the source IP address and source port in the second data packet into the service port set, and performing access control operations according to the first ACL; If the registered IP address set includes the destination IP address in the second data packet, an access control operation is performed according to the second ACL.

7. The method according to claim 6, characterized in that Also includes: If the registered IP address set includes the destination IP address in the second data packet but does not include the source IP address, and the service port set includes the destination IP address and destination port in the second data packet, the destination IP address and destination port in the second data packet are deleted from the service port set.

8. The method according to claim 1, characterized in that The service port set includes the IP address and port of the unregistered communication device serving as the server; Before receiving the first data packet, the method further includes: Receive a second data packet, the second data packet having a request and confirmation identifier, the second data packet including a source IP address and a source port and a destination IP address and a destination port; If the registered IP address set includes the destination IP address in the second data packet but does not include the source IP address, write the source IP address and source port in the second data packet into the service port set, and perform access control operations according to the second ACL; If the registered IP address set includes the source IP address in the second data packet but does not include the destination IP address, performing an access control operation according to the first ACL; If the registered IP address set includes the source IP address and the destination IP address in the second data packet, an access control operation is performed according to the first ACL and the second ACL.

9. The method according to claim 8, characterized in that Also includes: If the registered IP address set includes the source IP address in the second data packet but does not include the destination IP address, and the service port set includes the destination IP address and destination port in the second data packet, the destination IP address and destination port in the second data packet are deleted from the service port set.

10. The method according to claim 1, characterized in that Before receiving the first data packet, the method further includes: Receive a third data packet, the third data packet having a request identifier, the third data packet including a source IP address and a source port and a destination IP address and a destination port; If the registered IP address set includes the destination IP address in the third data packet, performing an access control operation according to the first ACL; If the registered IP address set includes the source IP address in the second data packet, an access control operation is performed according to the second ACL.

11. The method according to claim 1, characterized in that: Also includes: In the case where the session direction of a registered communication device includes both the first session direction and the second session direction, executing a predetermined access control policy; The predetermined access control strategy includes: Performing access control operations according to the first ACL; Alternatively, performing access control operations according to the second ACL; Alternatively, an access control operation is performed according to the first ACL and the second ACL.

12. The method according to any one of claims 1 to 11, characterized in that The ACL includes the first ACL and / or the second ACL, According to the ACL, perform access control operations, including: In the case where the ACL includes a deny access rule, if the data packet meets any of the deny access rules, the TCP communication session to which the data packet belongs is blocked; In the case where the ACL includes an access permission rule, if the data packet does not comply with any of the access permission rules, the TCP communication session to which the data packet belongs is blocked; The data packet includes at least one of the first data packet, the second data packet, and the third data packet.

13. A session access control device, characterized in that: include: A receiving module, configured to receive a first data packet, wherein the first data packet comprises a data packet transmitted after establishing a Transmission Control Protocol TCP communication session; an access control list determination module, configured to determine a preset first access control list ACL and / or a preset second ACL as a target ACL based on a network protocol IP address and port, a service port set, and a registered IP address set in the first data packet, wherein the service port set includes an IP address and a port of a communication device that is registered and acts as a server, or includes an IP address and a port of a communication device that is not registered and acts as a server, the server being a receiver of a TCP communication session, the registered IP address set including an IP address of a registered communication device, the first ACL corresponding to a first session direction of the registered communication device, and the second ACL corresponding to a second session direction of the registered communication device; The access control module is used to perform access control operations according to the target ACL.

14. A firewall device, characterized in that: include: a processor and a memory storing computer program instructions; When the processor executes the computer program instructions, the session access control method according to any one of claims 1 to 12 is implemented.

15. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer program instructions, and when the computer program instructions are executed by a processor, the session access control method according to any one of claims 1 to 12 is implemented.

16. A computer program product, characterized in that The invention comprises a computer program, which implements the session access control method according to any one of claims 1 to 12 when executed by a processor.

Citation Information

Cited By

  • Session direction identification method and device, electronic equipment and storage medium

    CN120301804A

  • Session access control method and apparatus, device, medium, and program product

    EP4765736A1

  • Session access control method and apparatus, device, medium, and program product

    WO2026000890A1