Protocol conversion method, device and equipment and computer readable storage medium
By analyzing the type and version of client traffic in the proxy device, and performing data conversion according to the protocol version, the interoperability problem between the HTTP1.1 and HTTP2 protocols is solved, and the problem of access failure caused by protocol inconsistency is solved. And provides security protection for HTTP1 and HTTP2 protocol traffic.
Patent Information
- Application Number
- CN202411209430.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-30
- Publication Date
- 2024-10-11
- Estimated Expiration
- 2044-08-30
AI Technical Summary
Existing technology cannot realize protocol conversion between the HTTP1.1 protocol and the HTTP2 protocol, resulting in the inability to communicate smoothly between clients and servers using different protocol versions.
By performing type analysis and version analysis on client traffic in the proxy device, a matching security engine analysis and detection program is selected for security detection, and data conversion is performed based on the protocol versions of the client and server to ensure data interoperability between different protocol versions. sex.
It achieves data interoperability between different protocol versions, solves the problem of access failure caused by protocol inconsistency, and provides security protection for HTTP1 and HTTP2 protocol traffic.
Smart Images

Figure CN118764544A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of data transmission, and in particular to a protocol conversion method, device, equipment and computer-readable storage medium. Background Art
[0002] Hyper Text Transfer Protocol (HTTP) is a lightweight communication protocol. Over time, HTTP has been continuously improved and optimized, from the initial http1.0 protocol to the http1.1 protocol, and then to the current http2.0 protocol. Compared with the currently commonly used http1.1 protocol, the http2.0 protocol reduces network latency and improves the client's page loading speed by compressing the header field, multiplexing data transmission, and increasing server push.
[0003] Due to the fundamental differences in data transmission format and communication mechanism, http1.1 and http2.0 cannot communicate directly. Although the current technical solution can provide proxy forwarding services for http1.1 and http2, it cannot perform protocol conversion operations between http2 and http1.1, resulting in the inability of clients and servers using different protocol versions to communicate smoothly. For example, if the client uses http1.1 and the server uses http2, the current text parsing-based inspection method is not suitable for http2, which transmits data in binary format, resulting in the inability of the client and server to communicate.
[0004] It can be seen that how to achieve intercommunication between devices with different protocol versions is a problem that needs to be solved by those skilled in the art. Summary of the invention
[0005] The purpose of the embodiments of the present invention is to provide a protocol conversion method, apparatus, device and computer-readable storage medium, which can realize intercommunication between devices with different protocol versions.
[0006] In order to solve the above technical problems, an embodiment of the present invention provides a protocol conversion method applicable to a proxy device, the method comprising:
[0007] Performing type analysis on the acquired client traffic to determine the traffic type of the client traffic;
[0008] When the traffic type of the client traffic belongs to the set interception and forwarding type, performing version parsing on the client traffic to determine the client protocol version of the client traffic;
[0009] Select a security engine parsing detection program that matches the client protocol version to perform security detection on the client traffic to determine whether the client traffic is attack traffic;
[0010] In the case where the client traffic is non-attack traffic, determining the server protocol version supported by the server according to the address information and port information of the server accessed by the client;
[0011] According to the client protocol version and the server protocol version, the client traffic is converted into data that complies with the server protocol version and the data is transmitted to the server, and the response information fed back by the server is converted into information that complies with the client protocol version and the information is fed back to the client.
[0012] On the one hand, selecting a security engine parsing detection program that matches the client protocol version to perform security detection on the client traffic to determine whether the client traffic is attack traffic includes:
[0013] In the case that the client protocol version does not belong to the http2 protocol, the text-based protocol security engine parsing and detection program parses and detects the client traffic to determine the detection result;
[0014] In the case where the client protocol version belongs to the http2 protocol, the security engine parsing detection program based on binary format parsing performs decoding statistical analysis detection on the request data frame of the client traffic to determine the detection result;
[0015] When the detection result shows that the traffic content is abnormal, the traffic data volume is abnormal, the traffic source is abnormal and / or the traffic pattern is abnormal, it is determined that the client traffic is attack traffic.
[0016] On the one hand, it also includes:
[0017] In the case that the client traffic is attack traffic, the client traffic is blocked from being transmitted to the server.
[0018] On the one hand, according to the client protocol version and the server protocol version, converting the client traffic into data that conforms to the server protocol version and transmitting the data to the server, converting the response information fed back by the server into information that conforms to the client protocol version and feeding the information back to the client includes:
[0019] When the client protocol version is the http1 protocol version and the server protocol version does not support the http2 protocol, or when the client protocol version is the http2 protocol version and the server protocol version supports the http2 protocol, transmit the client traffic to the server according to the client protocol version, and feed back the response information transmitted by the server to the client;
[0020] When the client protocol version is the http2 protocol version and the server protocol version does not support the http2 protocol, the client traffic is converted into client traffic that complies with the http1 protocol version, and the client traffic that complies with the http1 protocol version is transmitted to the server; when the response information transmitted by the server is received, the response information is converted into response information that complies with the http2 protocol, and the response information that complies with the http2 protocol is fed back to the client;
[0021] When the client protocol version is the http2 protocol version and the server protocol version does not support the http2 protocol, the client traffic is converted into client traffic that complies with the http1 protocol version, and the client traffic that complies with the http1 protocol version is transmitted to the server; when response information transmitted by the server is received, the response information is converted into response information that complies with the http2 protocol, and the response information that complies with the http2 protocol is fed back to the client.
[0022] On the one hand, according to the address information and port information of the server accessed by the client, determining the server protocol version supported by the server includes:
[0023] Get the address and port information of the server accessed by the client;
[0024] A protocol version matching the address information and the port information is queried from the stored protection site configuration information; wherein the protection site configuration information records the address information, port information and supported protocol versions of different servers.
[0025] On the one hand, performing type parsing on the acquired client traffic to determine the traffic type of the client traffic includes:
[0026] When client traffic is acquired, parsing data packet header information of the client traffic;
[0027] The traffic type of the client traffic is determined according to the data packet header information.
[0028] On the one hand, it also includes:
[0029] In the case where the traffic type belongs to the transmission control protocol, performing a step of version parsing on the client traffic to determine a client protocol version of the client traffic;
[0030] When the traffic type does not belong to the transmission control protocol, the client traffic is transparently transmitted or discarded.
[0031] The embodiment of the present invention also provides a protocol conversion device, which is applicable to a proxy device, and the device includes a type parsing unit, a version parsing unit, a security detection unit, a determination unit and a conversion unit;
[0032] The type parsing unit is used to perform type parsing on the acquired client traffic to determine the traffic type of the client traffic;
[0033] The version parsing unit is used to perform version parsing on the client traffic to determine the client protocol version of the client traffic when the traffic type of the client traffic belongs to the set interception and forwarding type;
[0034] The security detection unit is used to select a security engine parsing detection program that matches the client protocol version to perform security detection on the client traffic to determine whether the client traffic is attack traffic;
[0035] The determining unit is used to determine the server protocol version supported by the server according to the address information and port information of the server accessed by the client when the client traffic is non-attack traffic;
[0036] The conversion unit is used to convert the client traffic into data that complies with the server protocol version and transmit the data to the server based on the client protocol version and the server protocol version, and convert the response information fed back by the server into information that complies with the client protocol version and feed the information back to the client.
[0037] On the one hand, the safety detection unit includes a first detection subunit, a second detection subunit and a determination subunit;
[0038] The first detection subunit is used for, when the client protocol version does not belong to the http2 protocol, performing parsing and detection on the client traffic based on the text protocol security engine parsing detection program to determine the detection result;
[0039] The second detection subunit is used to perform decoding statistics and analysis detection on the request data frame of the client traffic based on the security engine parsing detection program of binary format parsing when the client protocol version belongs to the http2 protocol to determine the detection result;
[0040] The determination subunit is used to determine that the client traffic is attack traffic when the detection result shows that the traffic content is abnormal, the traffic data volume is abnormal, the traffic source is abnormal and / or the traffic pattern is abnormal.
[0041] On the one hand, it also includes a blocking unit;
[0042] The blocking unit is used to block the client traffic from being transmitted to the server when the client traffic is attack traffic.
[0043] On the one hand, the conversion unit is used to transmit the client traffic to the server according to the protocol version of the client, and feed back the response information transmitted by the server to the client when the client protocol version is the http1 protocol version and the server protocol version does not support the http2 protocol, or when the client protocol version is the http2 protocol version and the server protocol version supports the http2 protocol;
[0044] When the client protocol version is the http2 protocol version and the server protocol version does not support the http2 protocol, the client traffic is converted into client traffic that complies with the http1 protocol version, and the client traffic that complies with the http1 protocol version is transmitted to the server; when the response information transmitted by the server is received, the response information is converted into response information that complies with the http2 protocol, and the response information that complies with the http2 protocol is fed back to the client;
[0045] When the client protocol version is the http2 protocol version and the server protocol version does not support the http2 protocol, the client traffic is converted into client traffic that complies with the http1 protocol version, and the client traffic that complies with the http1 protocol version is transmitted to the server; when response information transmitted by the server is received, the response information is converted into response information that complies with the http2 protocol, and the response information that complies with the http2 protocol is fed back to the client.
[0046] In one aspect, the determining unit includes an acquiring subunit and a querying subunit;
[0047] The acquisition subunit is used to acquire the address information and port information of the server accessed by the client;
[0048] The query subunit is used to query the protocol version matching the address information and the port information from the stored protection site configuration information; wherein the protection site configuration information records the address information, port information and supported protocol versions of different servers.
[0049] On the one hand, the type parsing unit is used to parse the data packet header information of the client traffic when the client traffic is acquired; and determine the traffic type of the client traffic based on the data packet header information.
[0050] On the one hand, it also includes a discard unit;
[0051] The version parsing unit is used to perform a step of performing version parsing on the client traffic to determine a client protocol version of the client traffic when the traffic type belongs to the transmission control protocol;
[0052] The discarding unit is used to transparently transmit or discard the client traffic when the traffic type does not belong to the transmission control protocol.
[0053] The embodiment of the present invention further provides a protocol conversion device, including:
[0054] Memory for storing computer programs;
[0055] A processor is used to execute the computer program to implement the steps of the above-mentioned protocol conversion method.
[0056] An embodiment of the present invention further provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the above-mentioned protocol conversion method are implemented.
[0057] It can be seen from the above technical solution that the acquired client traffic is type parsed to determine the traffic type of the client traffic. When the traffic type of the client traffic belongs to the set interception and forwarding type, the client traffic is version parsed to determine the client protocol version of the client traffic. There are differences in the security detection methods used by different protocol versions, so a security engine parsing detection program matching the client protocol version is selected to perform security detection on the client traffic to determine whether the client traffic belongs to attack traffic. When the client traffic belongs to non-attack traffic, the server protocol version supported by the server can be determined based on the address information and port information of the server accessed by the client. According to the client protocol version and the server protocol version, the client traffic is converted into data that conforms to the server protocol version and the data is transmitted to the server, and the response information fed back by the server is converted into information that conforms to the client protocol version and the information is fed back to the client. In this technical solution, not only can the security protection requirements of data between different protocol versions be achieved, but also the access failure problem caused by the inconsistency of the client and server protocol versions is well solved. BRIEF DESCRIPTION OF THE DRAWINGS
[0058] In order to more clearly illustrate the embodiments of the present invention, the following briefly introduces the drawings required for use in the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0059] Figure 1 A flowchart of a protocol conversion method provided by an embodiment of the present invention;
[0060] Figure 2 A schematic diagram of a process flow of security protection and protocol conversion performed by a proxy device provided in an embodiment of the present invention;
[0061] Figure 3 A schematic diagram of the structure of a protocol conversion device provided in an embodiment of the present invention;
[0062] Figure 4 A structural diagram of a protocol conversion device provided in an embodiment of the present invention. DETAILED DESCRIPTION
[0063] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0064] In order to enable those skilled in the art to better understand the solution of the present invention, the present invention is further described in detail below in conjunction with the accompanying drawings and specific implementation methods.
[0065] Since both http1.0 and http1.1 use text format to transmit data, for the sake of convenience, http1.0 and http1.1 can be collectively referred to as http1. Compared with http1, http2 has significantly improved performance. http2 has many advantages such as multiplexing, header compression, server push, binary framing, etc., which can significantly improve the transmission speed of network devices and greatly improve the performance of devices.
[0066] Currently, many products support http2 proxy communication, such as nginx, F5 and other proxy communication devices. Take nginx as an example: when the client accesses the server through the http1.1 protocol, nginx performs proxy forwarding through http1.1; when the client accesses the server through the http2 protocol, nginx performs proxy forwarding through http2. However, the current proxy technology cannot inspect and protect http2 traffic, and cannot perform protocol conversion operations between http2 and http1 protocols, so it is not suitable for firewall products.
[0067] Therefore, the embodiments of the present invention provide a protocol conversion method, apparatus, device and computer-readable storage medium, which can ensure the security of data transmitted to the server by identifying the client protocol version and selecting a security engine parsing detection program that matches the client protocol version to perform security detection on the client traffic. By further identifying the server protocol version, the proxy device can convert the client traffic and the response information fed back by the server into a protocol format recognizable by the peer device, which effectively solves the access failure problem caused by the inconsistency of the client and server protocol versions.
[0068] Next, a protocol conversion method provided by an embodiment of the present invention is described in detail. Figure 1 A flowchart of a protocol conversion method provided by an embodiment of the present invention is applicable to a proxy device, and the method includes:
[0069] S101: performing type analysis on the acquired client traffic to determine the traffic type of the client traffic.
[0070] When the client interacts with the server, the client traffic it transmits will flow through the proxy device. When the proxy device obtains the client traffic, it can parse the data packet header information of the client traffic; based on the data packet header information, the traffic type of the client traffic is determined.
[0071] In the embodiment of the present invention, the proxy device may be a firewall product.
[0072] S102: When the traffic type of the client traffic belongs to the set interception and forwarding type, version parsing is performed on the client traffic to determine the client protocol version of the client traffic.
[0073] The set interception and forwarding type can be the traffic type that the proxy device needs to detect.
[0074] In actual applications, the proxy device mainly intercepts and analyzes the Transmission Control Protocol (TCP) traffic. Therefore, if the traffic type belongs to the TCP, the client traffic can be parsed to determine the client protocol version of the client traffic. If the traffic type does not belong to the TCP, the client traffic can be transparently transmitted or discarded.
[0075] S103: Select a security engine parsing detection program that matches the client protocol version to perform security detection on the client traffic to determine whether the client traffic is attack traffic.
[0076] The security engine analysis and detection program is used to identify and intercept attack traffic to protect the security of WEB applications. Attack traffic can threaten system security. In the embodiment of the present invention, attack traffic can also be called threat traffic.
[0077] In actual applications, traffic identification and interception can be performed based on a predetermined set of rules. Considering that different types of protocol versions have different corresponding security detection methods, corresponding security engine parsing detection programs can be set for different protocol versions.
[0078] When the client protocol version does not belong to the http2 protocol, the client traffic can be parsed and detected based on the text protocol security engine parsing detection program to determine the detection result.
[0079] When the client protocol version belongs to the http2 protocol, the security engine parsing detection program based on binary format parsing can perform decoding statistics and analysis on the request data frame of the client traffic to determine the detection result.
[0080] The http2 protocol message uses a binary format, which makes it more difficult to parse than the text format of http1. Therefore, the security engine parsing and detection program applicable to the http2 protocol needs to add support for the http2 framing and flow control mechanism to accurately parse and check the message content.
[0081] In terms of security engine performance optimization, http2 supports multiplexing and header compression. Compared with the http1 protocol, proxy devices need to adapt to these features when analyzing and identifying to ensure that normal traffic is not misjudged and malicious traffic is released.
[0082] In terms of server push, http2 allows the server to actively push resources, and the proxy device needs to identify and analyze these requests to prevent the push of malicious resources.
[0083] Attack traffic has a variety of attack characteristics, the most common of which include the following four aspects:
[0084] 1. Abnormal traffic content: The traffic contains illegal characters such as SQ injection statements, XSS attacks, CSRF and other malicious codes.
[0085] 2. Abnormal traffic data volume: For example, in a DDOS attack, a large amount of traffic suddenly appears in a short period of time, far exceeding the normal level.
[0086] 3. Abnormal traffic sources: such as traffic from overseas countries, and IP addresses from uncommon geographic locations.
[0087] 4. Abnormal traffic patterns: such as CC attacks, frequent requests for the same page in a short period of time or multiple requests sent continuously in a short period of time.
[0088] Therefore, when the detection results show abnormal traffic content, abnormal traffic data volume, abnormal traffic source and / or abnormal traffic pattern, it can be determined that the client traffic is attack traffic.
[0089] In the case where the client traffic is attack traffic, in order to reduce the adverse impact of the attack traffic on the server, the proxy device can block the client traffic from being transmitted to the server.
[0090] S104: When the client traffic is non-attack traffic, the server protocol version supported by the server is determined according to the address information and port information of the server accessed by the client.
[0091] When configuring a protection site, the customer can choose whether to enable or disable the http2 protocol for the servers protected by the proxy device. The configuration information in these sites can be used to determine whether the servers protected by the proxy device support the http2 protocol. In actual applications, the address information, port information, and supported protocol versions of different servers can be recorded in the protection site configuration information.
[0092] After obtaining the address information and port information of the server accessed by the client, the protocol version matching the address information and the port information can be queried from the stored protection site configuration information.
[0093] S105: According to the client protocol version and the server protocol version, the client traffic is converted into data that complies with the server protocol version and the data is transmitted to the server, and the response information fed back by the server is converted into information that complies with the client protocol version and the information is fed back to the client.
[0094] When the client protocol version is consistent with the server protocol version, the client can communicate with the server according to the original protocol. When the client protocol version is inconsistent with the server protocol version, when the proxy device obtains the client traffic, it can convert it into traffic that conforms to the server protocol version and then transmit it to the server; when receiving the response information fed back by the server, it needs to convert the response information into information that conforms to the client protocol version and then transmit it to the client.
[0095] Figure 2 A schematic diagram of a process for performing security protection and protocol conversion by a proxy device provided in an embodiment of the present invention, wherein the proxy device obtains the client traffic transmitted by the client and determines whether the client traffic belongs to TCP traffic. If the client traffic does not belong to TCP traffic, it is transparently transmitted or discarded. If the client traffic belongs to TCP traffic, it is further determined whether the client traffic is http2 traffic. If the client traffic is http2 traffic, it means that the client supports the http2 protocol version, and the security engine parsing detection program based on binary format parsing decodes and statistically analyzes the request data frame of the client traffic to identify whether it belongs to threat traffic. That is, the security engine decodes and statistically analyzes the request data frame of the traffic sent by the client based on the binary protocol. If the client traffic is not http2 traffic, it means that the client does not support the http2 protocol version, and the security engine parsing detection program based on the text protocol parses and detects the client traffic to identify whether it belongs to threat traffic. That is, the security engine performs message parsing detection on the traffic sent by the client based on the text protocol.
[0096] Through detection, it is possible to identify whether the client traffic is threat traffic. Threat traffic can be directly blocked. For non-threat traffic, it is possible to further identify whether the server supports http2.
[0097] When the client protocol version is http1 and the server protocol version does not support http2, or when the client protocol version is http2 and the server protocol version supports http2, the proxy device transmits the client traffic to the server according to the client protocol version and feeds back the response information transmitted by the server to the client. That is, the proxy device can communicate with the server using the original client protocol and return the received server response information to the client.
[0098] When the client protocol version is the http2 protocol version and the server protocol version does not support the http2 protocol, the client traffic is converted into client traffic that complies with the http1 protocol version, and the client traffic that complies with the http1 protocol version is transmitted to the server; when the response information transmitted by the server is received, the response information is converted into response information that complies with the http2 protocol, and the response information that complies with the http2 protocol is fed back to the client.
[0099] When the client protocol version is http2 and the server protocol version does not support http2, the client traffic is converted to client traffic that complies with http1 and transmitted to the server; when receiving the response information transmitted by the server, the response information is converted to response information that complies with http2 and fed back to the client. The protocol version that complies with http1 can be either HTTP1.0 or HTTP1.1. HTTP1.1 is the most widely used protocol at this stage, so HTTP1.1 is used by default to communicate with the server. Of course, HTTP1.0 can also be used to communicate with the server.
[0100] In an embodiment of the present invention, through a proxy device, a client can successfully access a server that does not support the http2 protocol using the http2 protocol. The http1 and http2 protocol traffic can be detected, intercepted and protected at the same time. It is applicable to transparent proxy, reverse proxy and routing traction modes. By setting the proxy device provided by the embodiment of the present invention, great convenience is provided for the implementation and deployment of http2 communication. The original program basically does not need to be adjusted to realize the http2 protocol communication. The development of a new program does not need to consider whether the selected programming language can realize http2 communication and the difficulty of realizing http2 communication. It only needs to consider which programming language is most suitable for the implementation of the business logic. In this way, the development workload of the http2 protocol communication program can be simplified, the program can be decoupled, and the difficulty of program development can be reduced. On the other hand, the security detection and protection function based on the http2 protocol also fills the shortcomings of the http2 protocol communication in business security and meets the security requirements of the http2 protocol in data transmission.
[0101] It can be seen from the above technical solution that the acquired client traffic is type parsed to determine the traffic type of the client traffic. When the traffic type of the client traffic belongs to the set interception and forwarding type, the client traffic is version parsed to determine the client protocol version of the client traffic. There are differences in the security detection methods used by different protocol versions, so a security engine parsing detection program matching the client protocol version is selected to perform security detection on the client traffic to determine whether the client traffic belongs to attack traffic. When the client traffic belongs to non-attack traffic, the server protocol version supported by the server can be determined based on the address information and port information of the server accessed by the client. According to the client protocol version and the server protocol version, the client traffic is converted into data that conforms to the server protocol version and the data is transmitted to the server, and the response information fed back by the server is converted into information that conforms to the client protocol version and the information is fed back to the client. In this technical solution, not only can the security protection requirements of data between different protocol versions be achieved, but also the access failure problem caused by the inconsistency of the client and server protocol versions is well solved.
[0102] Figure 3 A schematic diagram of the structure of a protocol conversion device provided by an embodiment of the present invention, which is applicable to a proxy device, includes a type parsing unit 31, a version parsing unit 32, a security detection unit 33, a determination unit 34 and a conversion unit 35;
[0103] A type parsing unit 31 is used to perform type parsing on the acquired client traffic to determine the traffic type of the client traffic;
[0104] A version parsing unit 32, configured to perform version parsing on the client traffic to determine a client protocol version of the client traffic when the traffic type of the client traffic belongs to the set interception and forwarding type;
[0105] A security detection unit 33, used for selecting a security engine parsing detection program matching the client protocol version to perform security detection on the client traffic to determine whether the client traffic is attack traffic;
[0106] The determination unit 34 is used to determine the server protocol version supported by the server according to the address information and port information of the server accessed by the client when the client traffic is non-attack traffic;
[0107] The conversion unit 35 is used to convert the client traffic into data that complies with the server protocol version and transmit the data to the server based on the client protocol version and the server protocol version, and convert the response information fed back by the server into information that complies with the client protocol version and feed the information back to the client.
[0108] In some embodiments, the security detection unit includes a first detection subunit, a second detection subunit, and a determination subunit;
[0109] The first detection subunit is used to parse and detect the client traffic based on the text protocol security engine parsing detection program to determine the detection result when the client protocol version does not belong to the http2 protocol;
[0110] The second detection subunit is used for, when the client protocol version belongs to the http2 protocol, decoding and statistically analyzing the request data frame of the client traffic based on the security engine parsing detection program of the binary format parsing to determine the detection result;
[0111] The determination subunit is used to determine that the client traffic is attack traffic when the detection result shows that the traffic content is abnormal, the traffic data volume is abnormal, the traffic source is abnormal and / or the traffic pattern is abnormal.
[0112] In some embodiments, a blocking unit is further included;
[0113] The blocking unit is used to block the transmission of client traffic to the server when the client traffic is attack traffic.
[0114] In some embodiments, the conversion unit is used to transmit the client traffic to the server according to the client's protocol version, and feed back the response information transmitted by the server to the client when the client's protocol version is the http1 protocol version and the server's protocol version does not support the http2 protocol, or when the client's protocol version is the http2 protocol version and the server's protocol version supports the http2 protocol;
[0115] When the client protocol version is http2 and the server protocol version does not support http2, the client traffic is converted into the client traffic that complies with http1, and the client traffic that complies with http1 is transmitted to the server; when the response information transmitted by the server is received, the response information is converted into the response information that complies with http2, and the response information that complies with http2 is fed back to the client;
[0116] When the client protocol version is the http2 protocol version and the server protocol version does not support the http2 protocol, the client traffic is converted into client traffic that complies with the http1 protocol version, and the client traffic that complies with the http1 protocol version is transmitted to the server; when the response information transmitted by the server is received, the response information is converted into response information that complies with the http2 protocol, and the response information that complies with the http2 protocol is fed back to the client.
[0117] In some embodiments, the determining unit includes an acquiring subunit and a querying subunit;
[0118] The acquisition subunit is used to acquire the address information and port information of the server accessed by the client;
[0119] The query subunit is used to query the protocol version matching the address information and the port information from the stored protection site configuration information; wherein the protection site configuration information records the address information, port information and supported protocol versions of different servers.
[0120] In some embodiments, the type parsing unit is used to parse the data packet header information of the client traffic when the client traffic is acquired; and determine the traffic type of the client traffic based on the data packet header information.
[0121] In some embodiments, further comprising a discarding unit;
[0122] The version parsing unit is used to perform a step of parsing the client traffic version to determine the client protocol version of the client traffic when the traffic type belongs to the transmission control protocol;
[0123] The discard unit is used to transparently transmit or discard the client traffic when the traffic type does not belong to the transmission control protocol.
[0124] Figure 3 The description of the features in the corresponding embodiments can be found in Figure 1 The relevant descriptions of the corresponding embodiments will not be repeated here one by one.
[0125] It can be seen from the above technical solution that the acquired client traffic is type parsed to determine the traffic type of the client traffic. When the traffic type of the client traffic belongs to the set interception and forwarding type, the client traffic is version parsed to determine the client protocol version of the client traffic. There are differences in the security detection methods used by different protocol versions, so a security engine parsing detection program matching the client protocol version is selected to perform security detection on the client traffic to determine whether the client traffic belongs to attack traffic. When the client traffic belongs to non-attack traffic, the server protocol version supported by the server can be determined based on the address information and port information of the server accessed by the client. According to the client protocol version and the server protocol version, the client traffic is converted into data that conforms to the server protocol version and the data is transmitted to the server, and the response information fed back by the server is converted into information that conforms to the client protocol version and the information is fed back to the client. In this technical solution, not only can the security protection requirements of data between different protocol versions be achieved, but also the access failure problem caused by the inconsistency of the client and server protocol versions is well solved.
[0126] Figure 4 A structural diagram of a protocol conversion device provided by an embodiment of the present invention, such as Figure 4 As shown, the protocol conversion device includes: a memory 40 for storing a computer program;
[0127] The processor 41 is used to implement the steps of the protocol conversion method in the above embodiment when executing a computer program.
[0128] The protocol conversion device provided in this embodiment may include but is not limited to a smart phone, a tablet computer, a laptop computer, or a desktop computer.
[0129] Among them, the processor 41 may include one or more processing cores, such as a 4-core processor, an 8-core processor, etc. The processor 41 can be implemented in at least one hardware form of DSP (Digital Signal Processing), FPGA (Field-Programmable Gate Array), and PLA (Programmable Logic Array). The processor 41 may also include a main processor and a coprocessor. The main processor is a processor for processing data in the awake state, also known as a CPU (Central Processing Unit); the coprocessor is a low-power processor for processing data in the standby state. In some embodiments, the processor 41 may be integrated with a GPU (Graphics Processing Unit), which is responsible for rendering and drawing the content to be displayed on the display screen. In some embodiments, the processor 41 may also include an AI (Artificial Intelligence) processor, which is used to process computing operations related to machine learning.
[0130] The memory 40 may include one or more computer-readable storage media, which may be non-transitory. The memory 40 may also include a high-speed random access memory, and a non-volatile memory, such as one or more disk storage devices, flash memory storage devices. In this embodiment, the memory 40 is at least used to store the following computer program 401, wherein, after the computer program is loaded and executed by the processor 41, the relevant steps of the protocol conversion method disclosed in any of the aforementioned embodiments can be implemented. In addition, the resources stored in the memory 40 may also include an operating system 402 and data 403, etc., and the storage method may be temporary storage or permanent storage. Among them, the operating system 402 may include Windows, Unix, Linux, etc. Data 403 may include but is not limited to client traffic, security engine parsing detection programs, etc.
[0131] In some embodiments, the protocol conversion device may further include a display screen 42 , an input / output interface 43 , a communication interface 44 , a power supply 45 , and a communication bus 46 .
[0132] Those skilled in the art will understand that Figure 4 The structure shown in the figure does not constitute a limitation on the protocol conversion device, and may include more or fewer components than those shown in the figure.
[0133] It is understandable that if the protocol conversion method in the above embodiment is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium to execute all or part of the steps of the various embodiments of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM), random access memory (RAM), electrically erasable programmable ROM, register, hard disk, removable disk, CD-ROM, disk or optical disk and other media that can store program code.
[0134] Based on this, an embodiment of the present invention further provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the above-mentioned protocol conversion method are implemented.
[0135] The functions of the functional modules of the computer-readable storage medium described in the embodiment of the present invention can be specifically implemented according to the method in the above method embodiment. The specific implementation process can refer to the relevant description of the above method embodiment, which will not be repeated here.
[0136] The above is a detailed introduction to a protocol conversion method, device, equipment and computer-readable storage medium provided in the embodiments of the present application. Each embodiment in the specification is described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same and similar parts between the embodiments can be referred to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part description.
[0137] Professionals may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in the above description according to function. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians may use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0138] The above is a detailed introduction to a protocol conversion method, device, equipment and computer-readable storage medium provided by the present application. Specific examples are used herein to illustrate the principles and implementation methods of the present invention, and the description of the above embodiments is only used to help understand the method of the present invention and its core idea. It should be pointed out that for ordinary technicians in this technical field, without departing from the principles of the present invention, several improvements and modifications can be made to the present application, and these improvements and modifications also fall within the scope of protection of the claims of the present application.
Claims
1. A protocol conversion method, It is characterized in that Applicable to a proxy device, the method comprises: Performing type analysis on the acquired client traffic to determine the traffic type of the client traffic; When the traffic type of the client traffic belongs to the set interception and forwarding type, performing version parsing on the client traffic to determine the client protocol version of the client traffic; Select a security engine parsing detection program that matches the client protocol version to perform security detection on the client traffic to determine whether the client traffic is attack traffic; In the case where the client traffic is non-attack traffic, determining the server protocol version supported by the server according to the address information and port information of the server accessed by the client; According to the client protocol version and the server protocol version, the client traffic is converted into data that complies with the server protocol version and the data is transmitted to the server, and the response information fed back by the server is converted into information that complies with the client protocol version and the information is fed back to the client.
2. The protocol conversion method according to claim 1, It is characterized in that Selecting a security engine parsing detection program that matches the client protocol version to perform security detection on the client traffic to determine whether the client traffic is attack traffic includes: In the case that the client protocol version does not belong to the http2 protocol, the text-based protocol security engine parsing and detection program parses and detects the client traffic to determine the detection result; In the case where the client protocol version belongs to the http2 protocol, the security engine parsing detection program based on binary format parsing performs decoding statistical analysis detection on the request data frame of the client traffic to determine the detection result; When the detection result shows that the traffic content is abnormal, the traffic data volume is abnormal, the traffic source is abnormal and / or the traffic pattern is abnormal, it is determined that the client traffic is attack traffic.
3. The protocol conversion method according to claim 2, It is characterized in that Also includes: In the case that the client traffic is attack traffic, the client traffic is blocked from being transmitted to the server.
4. The protocol conversion method according to claim 1, It is characterized in that According to the client protocol version and the server protocol version, converting the client traffic into data that conforms to the server protocol version and transmitting the data to the server, converting the response information fed back by the server into information that conforms to the client protocol version and feeding the information back to the client includes: When the client protocol version is the http1 protocol version and the server protocol version does not support the http2 protocol, or when the client protocol version is the http2 protocol version and the server protocol version supports the http2 protocol, transmit the client traffic to the server according to the client protocol version, and feed back the response information transmitted by the server to the client; When the client protocol version is the http2 protocol version and the server protocol version does not support the http2 protocol, the client traffic is converted into client traffic that complies with the http1 protocol version, and the client traffic that complies with the http1 protocol version is transmitted to the server; when the response information transmitted by the server is received, the response information is converted into response information that complies with the http2 protocol, and the response information that complies with the http2 protocol is fed back to the client; When the client protocol version is the http2 protocol version and the server protocol version does not support the http2 protocol, the client traffic is converted into client traffic that complies with the http1 protocol version, and the client traffic that complies with the http1 protocol version is transmitted to the server; when response information transmitted by the server is received, the response information is converted into response information that complies with the http2 protocol, and the response information that complies with the http2 protocol is fed back to the client.
5. The protocol conversion method according to claim 1, It is characterized in that Determining the server protocol version supported by the server based on the address information and port information of the server accessed by the client includes: Get the address and port information of the server accessed by the client; A protocol version matching the address information and the port information is queried from the stored protection site configuration information; wherein the protection site configuration information records the address information, port information and supported protocol versions of different servers.
6. The protocol conversion method according to claim 1, It is characterized in that The acquired client traffic is parsed to determine the traffic type of the client traffic, including: When client traffic is acquired, parsing data packet header information of the client traffic; The traffic type of the client traffic is determined according to the data packet header information.
7. The protocol conversion method according to claim 6, It is characterized in that Also includes: In the case where the traffic type belongs to the transmission control protocol, performing a step of version parsing on the client traffic to determine a client protocol version of the client traffic; When the traffic type does not belong to the transmission control protocol, the client traffic is transparently transmitted or discarded.
8. A protocol conversion device, It is characterized in that Applicable to a proxy device, the device comprises a type parsing unit, a version parsing unit, a security detection unit, a determination unit and a conversion unit; The type parsing unit is used to perform type parsing on the acquired client traffic to determine the traffic type of the client traffic; The version parsing unit is used to perform version parsing on the client traffic to determine the client protocol version of the client traffic when the traffic type of the client traffic belongs to the set interception and forwarding type; The security detection unit is used to select a security engine parsing detection program that matches the client protocol version to perform security detection on the client traffic to determine whether the client traffic is attack traffic; The determining unit is used to determine the server protocol version supported by the server according to the address information and port information of the server accessed by the client when the client traffic is non-attack traffic; The conversion unit is used to convert the client traffic into data that complies with the server protocol version and transmit the data to the server based on the client protocol version and the server protocol version, and convert the response information fed back by the server into information that complies with the client protocol version and feed the information back to the client.
9. A protocol conversion device, It is characterized in that include: Memory for storing computer programs; A processor, configured to execute the computer program to implement the steps of the protocol conversion method according to any one of claims 1 to 7.
10. A computer-readable storage medium, It is characterized in that The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the protocol conversion method according to any one of claims 1 to 7 are implemented.
Citation Information
Patent Citations
Secure access method and network firewall system
CN114465744A
Security detection method, security detection device, electronic equipment and medium
CN114726564A
Port multiplexing method and device and readable storage medium
CN114900427A
Proxy communication method and device based on national secret and international protocols, and computer equipment
CN116915446A
Dual relay system and methods for securely translating among communication protocols
WO2023154074A1
Cited By
Protocol adaptation method and system based on TSN gateway
CN121357262A
