Message processing method and device for load balancing equipment
By obtaining the five-tuple data of the request packet in the load balancing device matches the virtual service configuration, setting the identifier and discarding it when it does not match, it solves the problem of high CPU usage during attack, ensuring the normal operation of the device and business continuity. .
Patent Information
- Application Number
- CN202211522248.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-11-30
- Publication Date
- 2024-11-15
- Estimated Expiration
- 2042-11-30
AI Technical Summary
When a load balancing device is attacked, it fails to process attack messages in time, resulting in increased CPU usage, reduced device performance, and even paralysis, affecting the normal operation of the business.
By obtaining the client's request message, obtaining the five-tuple data matches the virtual service configuration, setting a mark for the message when it does not match and discarding it, ensuring that the device performs packet loss operations in a timely manner during an attack, and avoiding long-term CPU occupation.
Effectively prevent attack packets from occupying CPU resources, ensure the normal operation of load balancing equipment, prevent business interruptions, and improve equipment performance.
Smart Images

Figure CN115883479B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of computer information processing, and in particular to a message processing method, device, electronic device and computer-readable medium of a load balancing device. Background Art
[0002] With the rapid development of the Internet, users have paid more attention to network security. In recent years, network attacks have occurred frequently, and Trojans and ransomware have emerged one after another on the Internet, which has posed a serious threat to network security and even national security. For load devices, if the business processing of load devices is attacked, it will affect the normal business of the server and cause its business to be interrupted.
[0003] In order to prevent the load balancing business from being attacked, the load balancing device itself has built-in security protection functions. For example, to prevent DDoS attacks, it has built-in DDoS protection functions; to prevent a certain IP address from sending a large number of packets to access the load balancing device at the same time, a session number limit function is set to limit the number of sessions accessing the load balancing device to ensure the normal operation of the device; there are also packet filtering, security domain and other protection measures to prevent the device business from being paralyzed by attacks.
[0004] Generally speaking, servers are more vulnerable to attacks than load balancing devices. Once a server fails, the entire business will be interrupted. The purpose of the design of load balancing devices is not to affect their normal business operations. They are only responsible for receiving business requests and forwarding business requests to the server for processing. If the load balancing forwarding business is attacked and paralyzed, the server cannot receive the client's business request, which will cause business interruption. No device security can be perfect. Although the load balancing device itself is configured with a variety of security measures to prevent attacks, there are still some security loopholes that cause the device business to be attacked and paralyzed.
[0005] Therefore, a new message processing method, device, electronic device and computer-readable medium for a load balancing device are needed.
[0006] The above information disclosed in the Background section is only for enhancement of understanding of the background of the present application and therefore it may contain information that does not constitute the prior art that is already known to a person of ordinary skill in the art. Summary of the invention
[0007] In view of this, the present application provides a message processing method, device, electronic device and computer-readable medium for a load balancing device, which can enable the message load balancing device to promptly perform packet dropping operations when receiving an attack message to ensure the normal operation of the load balancing device.
[0008] Other features and advantages of the present application will become apparent from the following detailed description, or may be learned in part by the practice of the present application.
[0009] According to one aspect of the present application, a message processing method for a load balancing device is proposed, the method comprising: the load balancing device obtains a request message from a client; when the virtual service and the request message satisfy the policy, obtains five-tuple data of the request message; matches the five-tuple data with the virtual service configuration; when the virtual service configuration is not matched, sets an identifier for the request message; and discards the request message based on the identifier.
[0010] In an exemplary embodiment of the present application, it also includes: when the virtual service configuration is matched, forwarding the request message to the fourth layer or seventh layer load service for processing.
[0011] In an exemplary embodiment of the present application, when the virtual service and request message satisfy the policy, it includes: determining whether the virtual service function of the load balancing device is enabled; when the virtual service function is enabled, performing a virtual IP protection process; determining whether the request message satisfies a preset condition; when the request message satisfies the preset condition, determining that the virtual service and request message satisfy the policy.
[0012] In an exemplary embodiment of the present application, it also includes: when the request message does not meet the preset condition, forwarding the request message to the fourth layer or seventh layer load service for processing.
[0013] In an exemplary embodiment of the present application, determining whether the request message satisfies a preset condition includes: when there is no session corresponding to the request message, determining that the message satisfies the preset condition; and / or when there is no preset service corresponding to the request message, determining that the message satisfies the preset condition.
[0014] In an exemplary embodiment of the present application, obtaining the five-tuple data of the request message further includes: setting a matching mark for the five-tuple data of the request message.
[0015] In an exemplary embodiment of the present application, setting a flag for the request message includes: setting a virtual IP protection enable flag for the request message; and / or setting an unmatched flag for the request message.
[0016] In an exemplary embodiment of the present application, the request message is discarded based on the identifier, including: in the packet loss stage, obtaining the request message to be discarded; when the request message contains the identifier, discarding the request message.
[0017] In an exemplary embodiment of the present application, it also includes: counting a first number of request messages with the identifier; counting a second number of discarded request messages; and comparing the first number with the second number to determine a packet loss accuracy rate.
[0018] According to one aspect of the present application, a message processing device for a load balancing device is proposed, and the device includes: a message module, which is used for the load balancing device to obtain a request message from a client; a policy module, which is used to obtain five-tuple data of the request message when the virtual service and the request message meet the policy; a matching module, which is used to match the five-tuple data with the virtual service configuration; an identification module, which is used to set an identification for the request message when the virtual service configuration is not matched; and a discarding module, which is used to discard the request message based on the identification.
[0019] The matching module also forwards the request message to the layer 4 or layer 7 load service for processing when the virtual service configuration is matched.
[0020] The policy module determines whether the virtual service and request message meet the policy, including: judging whether the virtual service function of the load balancing device is turned on; when the virtual service function is turned on, performing a virtual IP protection process; determining whether the request message meets a preset condition; when the request message meets the preset condition, determining that the virtual service and request message meet the policy.
[0021] When the policy module determines that the request message does not meet the preset condition, the request message is forwarded to the layer 4 or layer 7 load service for processing.
[0022] The policy module determines whether the request message satisfies a preset condition, including: when there is no session corresponding to the request message, determining that the message satisfies the preset condition; and / or when there is no preset service corresponding to the request message, determining that the message satisfies the preset condition.
[0023] The policy module obtaining the five-tuple data of the request message includes: setting a matching mark for the five-tuple data of the request message.
[0024] The policy module sets a flag for the request message including: setting a virtual IP protection enabled flag for the request message; and / or setting a non-matching flag for the request message.
[0025] The discarding module discards the request message based on the identifier, including: obtaining the request message to be discarded in the packet loss stage; and discarding the request message when the request message contains the identifier.
[0026] It also includes a statistical module (not shown) for counting a first number of request messages with the identifier; counting a second number of discarded request messages; and comparing the first number with the second number to determine the packet loss accuracy rate.
[0027] According to one aspect of the present application, an electronic device is proposed, which includes: one or more processors; a storage device for storing one or more programs; when the one or more programs are executed by the one or more processors, the one or more processors implement the method as described above.
[0028] According to one aspect of the present application, a computer-readable medium is provided, on which a computer program is stored. When the program is executed by a processor, the method described above is implemented.
[0029] According to the message processing method, device, electronic device and computer-readable medium of the load balancing device of the present application, a request message from a client is obtained through the load balancing device; when the virtual service and the request message meet the policy, the five-tuple data of the request message is obtained; the five-tuple data and the virtual service configuration are matched; when the virtual service configuration is not matched, an identifier is set for the request message; and the request message is discarded based on the identifier. This enables the message load balancing device to perform a packet drop operation in a timely manner when an attack message is received, thereby ensuring the normal operation of the load balancing device.
[0030] It should be understood that the foregoing general description and the following detailed description are exemplary only and are not restrictive of the present application. BRIEF DESCRIPTION OF THE DRAWINGS
[0031] The above and other objects, features and advantages of the present application will become more apparent by describing in detail the exemplary embodiments thereof with reference to the accompanying drawings. The accompanying drawings described below are only some embodiments of the present application, and it is clear to a person skilled in the art that other accompanying drawings can be obtained from these accompanying drawings without creative effort.
[0032] Figure 1 The present invention is a system block diagram showing a message processing method and apparatus of a load balancing device according to an exemplary embodiment.
[0033] Figure 2 The present invention is a flowchart of a method for processing messages of a load balancing device according to an exemplary embodiment.
[0034] Figure 3 The present invention is a flowchart of a method for processing messages of a load balancing device according to another exemplary embodiment.
[0035] Figure 4The present invention is a flowchart of a method for processing messages of a load balancing device according to another exemplary embodiment.
[0036] Figure 5 The present invention is a block diagram of a message processing apparatus of a load balancing device according to an exemplary embodiment.
[0037] Figure 6 It is a block diagram of an electronic device according to an exemplary embodiment.
[0038] Figure 7 It is a block diagram of a computer-readable medium according to an exemplary embodiment. DETAILED DESCRIPTION
[0039] Example embodiments will now be described more fully with reference to the accompanying drawings. However, example embodiments can be implemented in many forms and should not be construed as limited to the embodiments set forth herein; rather, these embodiments are provided so that this application will be comprehensive and complete and will fully convey the concepts of the example embodiments to those skilled in the art. The same reference numerals in the figures represent the same or similar parts, and thus their repeated description will be omitted.
[0040] In addition, described feature, structure or characteristic can be combined in one or more embodiments in any suitable manner. In the following description, many specific details are provided to provide a full understanding of the embodiments of the present application. However, those skilled in the art will appreciate that the technical scheme of the present application can be put into practice without one or more of the specific details, or other methods, components, devices, steps, etc. can be adopted. In other cases, known methods, devices, realizations or operations are not shown or described in detail to avoid blurring the various aspects of the application.
[0041] The block diagrams shown in the accompanying drawings are merely functional entities and do not necessarily correspond to physically independent entities. That is, these functional entities may be implemented in software form, or in one or more hardware modules or integrated circuits, or in different networks and / or processor devices and / or microcontroller devices.
[0042] The flowcharts shown in the accompanying drawings are only exemplary and do not necessarily include all the contents and operations / steps, nor must they be executed in the order described. For example, some operations / steps can be decomposed, and some operations / steps can be combined or partially combined, so the actual execution order may change according to actual conditions.
[0043] It should be understood that although the terms first, second, third, etc. may be used herein to describe various components, these components should not be limited by these terms. These terms are used to distinguish one component from another component. Therefore, the first component discussed below can be referred to as the second component without departing from the teachings of the concepts of the present application. As used herein, the term "and / or" includes any one of the associated listed items and all combinations of one or more.
[0044] Those skilled in the art will appreciate that the drawings are merely schematic diagrams of example embodiments, and the modules or processes in the drawings are not necessarily necessary for implementing the present application, and therefore cannot be used to limit the scope of protection of the present application.
[0045] The technical abbreviations involved in this application are explained as follows:
[0046] Load balancing: Load balancing means balancing the load and distributing it to multiple operating units. Based on the original network structure, it provides a transparent, inexpensive and effective method to expand the bandwidth of servers and network devices, enhance the network data processing capabilities, increase throughput, and improve network availability and flexibility.
[0047] Virtual IP protection: The application service provided by the application delivery device is called a virtual service. The virtual IP is the IP address configured for the virtual service. The destination address of the client's access request is the IP address of the virtual service. After the application delivery device receives the client's request, it forwards the request to the server through a series of processing. Virtual IP protection means that the application delivery device protects the IP address of the virtual service to prevent attacks that paralyze the device.
[0048] The applicant in this case found that the load balancing devices in the current technology take the following measures when protecting virtual services:
[0049] 1. When the Layer 4 load balancing service receives a service request from the client, it will match and analyze the request message. If the source IP address, destination IP address, source port, destination port, and message protocol of the request message match the virtual service configuration of the load balancing device (i.e., it hits the virtual service), the next step of service forwarding will be carried out; if it does not match the virtual service, an error code will be returned and the packet loss procedure will be executed.
[0050] 2. After the client and the load device successfully establish a three-way handshake, the 7-layer load service matches the request message with the listening list, which is similar to the 4-layer matching virtual service process. If no match is found, the packet loss process is executed. If the listening list can be matched, the 7-layer service processing process is followed.
[0051] The applicant of this case believes that although the 4-layer load will execute the packet loss procedure when the client request does not match the configuration of the device virtual service, and the 7-layer load will release the message when it does not match the monitoring list, if a large number of attack messages (the destination IP address is the virtual service, but the protocol is different from the virtual service) enter the device in a short period of time, the device fails to drop the packets in time, resulting in a large number of messages waiting for the device to execute the packet loss operation, which greatly increases the CPU usage rate and reduces the performance of the device, and eventually it will be in a paralyzed state, thus affecting the normal business processing.
[0052] When the load balancing device is processing business, it receives a large number of attack messages in a short period of time. The characteristics of these attack messages are that the destination address is the IP address of the virtual service, but the protocol is different from that of the virtual service. The device fails to timely process the packet loss before processing the business. A large number of attack messages enter the packet loss process because they do not match the configuration of the virtual service. The CPU of the device is occupied by the packet loss program for a long time, resulting in an increase in utilization rate, even reaching 100%, which seriously affects the normal operation of the device and paralyzes the business. The message processing method and device of the load balancing device of the present application can enable the device to perform the packet loss operation in time to ensure the normal operation of the device.
[0053] The content of this application is described in detail below with the help of specific embodiments.
[0054] Figure 1 The present invention is a system block diagram showing a message processing method and apparatus of a load balancing device according to an exemplary embodiment.
[0055] like Figure 1 As shown, the system architecture 10 may include terminal devices 101, 102, 103, a network 104, a load balancing device 105, and servers 106, 107, 108. The network 104 is used to provide a medium for communication links between the terminal devices 101, 102, 103 and the load balancing device 105, and between the load balancing device 105 and the servers 106, 107, 108. The network 104 may include various connection types, such as wired, wireless communication links, or optical fiber cables, etc.
[0056] Users can use terminal devices 101, 102, 103 to interact with servers 106, 107, 108 through load balancing device 105 to receive or send messages, etc. Various communication client applications can be installed on terminal devices 101, 102, 103, such as shopping applications, web browser applications, search applications, instant messaging tools, email clients, social platform software, etc.
[0057] The terminal devices 101 , 102 , and 103 may be various electronic devices having a display screen and supporting web browsing, including but not limited to smart phones, tablet computers, laptop computers, and desktop computers.
[0058] Servers 106, 107, and 108 may be devices that provide various services, such as backend management servers that provide support for shopping websites browsed by users using terminal devices 101, 102, and 103. The backend management servers may analyze and process received data such as product information query requests, and feed back the processing results to the terminal devices.
[0059] The load balancing device 105 may be a device that provides load balancing, and is used to forward service requests from the terminal devices 101 , 102 , 103 to the servers 106 , 107 , 108 for processing.
[0060] The load balancing device 105 can, for example, obtain request messages from terminal devices 101, 102, and 103; the load balancing device 105 can, for example, obtain the five-tuple data of the request message when the virtual service and the request message meet the policy; the load balancing device 105 can, for example, match the five-tuple data with the virtual service configuration; the load balancing device 105 can, for example, set an identifier for the request message when the virtual service configuration is not matched; the load balancing device 105 can, for example, discard the request message based on the identifier; the load balancing device 105 can, for example, forward the request message to the four-layer or seven-layer load service to forward it to the server 106, 107, 108 for processing when the virtual service configuration is matched.
[0061] The load balancing device 105 can be a physical server, or can be composed of multiple servers. It should be noted that the message processing method of the load balancing device provided in the embodiment of the present application can be executed by the load balancing device 105, and accordingly, the message processing device of the load balancing device can be set in the load balancing device 105.
[0062] Figure 2 The flowchart of a method for processing a message of a load balancing device according to an exemplary embodiment is shown. The method 20 for processing a message of a load balancing device at least includes steps S202 to S210.
[0063] like Figure 2 As shown, in S202, the load balancing device obtains a request message from the client.
[0064] In S204, when the virtual service and the request message meet the policy, the five-tuple data of the request message is obtained. For example, it can be determined whether the virtual service function of the load balancing device is enabled; when the virtual service function is enabled, the virtual IP protection process is performed; it is determined whether the request message meets the preset conditions; when the request message meets the preset conditions, it is determined that the virtual service and the request message meet the policy.
[0065] In one embodiment, it also includes setting a match mark for the five-tuple data of the request message. More specifically, it is also possible to set a virtual IP protection enable mark for the request message; and / or set a non-match mark for the request message.
[0066] In S206, the five-tuple data is matched with the virtual service configuration. When the virtual IP protection function is executed normally, the device receives a request message from the client, and before entering the device's 4-layer or 7-layer load service, a protection function test is performed first. The device first securely obtains the source IP address, destination IP address, source port, destination port and message protocol of the client request message; when the five-tuple of the client message is successfully obtained, the five-tuple is marked with need_match_flag, indicating that the five-tuple needs to enter the virtual IP tag configuration process; then enter the virtual service configuration matching process (five-tuple matching process), the attack message will not match the configuration of the virtual service (the protocol type of the virtual service is TCP protocol, and the protocol of the attack message is UDP), and when the virtual service configuration is not matched, the virtual IP protection configuration mark and the mark that matches the virtual service IP will be marked, and the packet loss stage of the virtual IP protection will be entered.
[0067] In S208, when the virtual service configuration is not matched, an identifier is set for the request message, and the request message is discarded based on the identifier. In the packet loss phase, a request message to be discarded is obtained; when the request message contains the identifier, the request message is discarded.
[0068] In the packet loss phase of virtual IP protection, it will detect whether the message matches the virtual service configuration of the device, whether it has been marked with the virtual IP protection configuration tag, and whether it has been marked with the tag matching the virtual service IP. If all the conditions are met, it will directly enter the packet loss process and increase the statistical count to count the number of lost packets. If the conditions are not met, the message is not an attack message, and the message is allowed to enter the 4th or 7th layer load service. In this way, message detection is performed before the 4th or 7th layer load service, and the attack message can be quickly dropped. This can ensure that the device will not process these attack messages for a long time when processing the 4th and 7th layer load services, the CPU utilization will not be greatly improved, and the service can be normal.
[0069] In the message processing method of the load balancing device of the present application, a multi-mark bit protection measure is adopted to prevent normal business messages from entering the virtual IP protection process and being lost.
[0070] In one embodiment, a first number of request messages with the identifier may be counted; a second number of discarded request messages may be counted; and the first number and the second number may be compared to determine the packet loss accuracy rate. In the message processing method of the load balancing device of the present application, by counting the packet loss statistics, it is also possible to understand whether the load service is attacked by the attack message. By checking the count, further measures can be taken to ensure the normal operation of the device.
[0071] In S210, when the virtual service configuration is matched, the request message is forwarded to the layer 4 or layer 7 load service for processing.
[0072] In the message processing method of the load balancing device of the present application, both the 4-layer load service and the 7-layer load service are detected and processed through the same message detection interface, thereby reducing the message detection processing flow. Since a unified message detection flow is adopted in the present application, the problem of different message detection processing flows due to different 4-layer and 7-layer load service processing flows is avoided.
[0073] In the message processing method of the load balancing device of the present application, the message is detected in advance before the service processing to avoid affecting the normal service processing.
[0074] According to the message processing method of the load balancing device of the present application, a request message from a client is obtained through the load balancing device; when the virtual service and the request message satisfy the policy, the five-tuple data of the request message is obtained; the five-tuple data and the virtual service configuration are matched; when the virtual service configuration is not matched, an identifier is set for the request message; and the request message is discarded based on the identifier. This enables the message load balancing device to perform a packet discard operation in a timely manner when an attack message is received, thereby ensuring the normal operation of the load balancing device.
[0075] It should be clearly understood that the present application describes how to form and use specific examples, but the principles of the present application are not limited to any details of these examples. On the contrary, based on the teaching of the content disclosed in the present application, these principles can be applied to many other embodiments.
[0076] Figure 3 The present invention is a flowchart of a method for processing messages of a load balancing device according to another exemplary embodiment. Figure 3 The process 30 shown is for Figure 2 A detailed description of S204 "obtaining five-tuple data of the request message when the virtual service and the request message satisfy the policy" in the process shown.
[0077] like Figure 3 As shown, in S302, it is determined whether the virtual service function of the load balancing device is enabled.
[0078] In one embodiment, for example, a configuration switch for virtual IP protection can be provided on the user setting page of the load balancing device. Since the protection function will affect the performance of the device when it is turned on, a switch is designed so that the virtual IP protection switch can be turned on to enter the protection process when the device needs protection. At the same time, a configuration detection count is added to count the number of device virtual services that are enabled and have the virtual IP protection function turned on. If the count is 0, even if all disabled virtual services turn on the virtual IP protection function, the device will not enter the virtual IP protection process to ensure the performance of the device.
[0079] In S304, when the virtual service function is enabled, a virtual IP protection process is performed.
[0080] In S306, it is determined whether the request message meets a preset condition.
[0081] In one embodiment, for example, when there is no session corresponding to the request message, it is determined that the message meets the preset condition; and / or when there is no preset service corresponding to the request message, it is determined that the message meets the preset condition.
[0082] In one embodiment, for example, when there is a session corresponding to the request message, it is determined that the message does not meet the preset condition; and / or when there is a preset service corresponding to the request message, it is determined that the message does not meet the preset condition.
[0083] The premise of developing the virtual IP protection function is that it cannot affect the normal business process. Before entering the protection process, the message will be checked. If the message already has a normal session, it will not enter the protection process. Some special business messages cannot match the configuration of the virtual service, but they are not attack messages. Such messages also need to be released. For example, the virtual service IP address is 0.0.0.0. In such a special configuration, the protection operation will not be performed; there is also an application layer gateway service (ALG). Such business messages may not match the virtual service, but the ALG service will parse and convert the message information at the application layer. Such special services can be directly released.
[0084] In S308, when the request message meets the preset condition, it is determined that the virtual service and the request message meet the policy.
[0085] In S310, when the request message does not meet the preset condition, the request message is forwarded to the layer 4 or layer 7 load service for processing.
[0086] In the message processing method of the load balancing device of the present application, a virtual IP protection switch is designed, and the virtual IP protection function can be turned off in a safe environment to reduce the consumption of device performance.
[0087] In the message processing method of the load balancing device of the present application, multiple virtual IP protection processing marking bits are designed to prevent normal business messages from being mistakenly regarded as attack messages and thus being discarded.
[0088] In the message processing method of the load balancing device of the present application, message detection is performed in advance before the 4th and 7th layer load service processing. If an attack message is identified, the packet is directly discarded and the service processing flow is not entered.
[0089] Figure 4 The present invention is a flowchart of a method for processing messages of a load balancing device according to another exemplary embodiment. Figure 4 The process 40 shown is for Figure 2 Detailed description of the process shown.
[0090] like Figure 4 As shown, in S402, start.
[0091] In S404, the load balancing device receives a request message sent by the client.
[0092] In S406, it is determined whether the virtual service is enabled and whether the virtual IP protection switch is turned on.
[0093] In S408, the virtual IP protection process is entered.
[0094] In S410, it is detected whether the message has a normal session and whether there is a special service.
[0095] In S412, the five-tuple of the message is obtained.
[0096] In S414, a to-be-matched flag is set for the quintuple.
[0097] In S416, whether it matches the virtual service configuration.
[0098] In S418, the five-tuple virtual IP protection is turned on and the virtual service IP is not matched.
[0099] In S420, it is identified whether a packet loss condition is met.
[0100] In S422, the message is discarded.
[0101] In S424, the layer 4 or layer 7 load service is carried out normally.
[0102] The message processing method of the load balancing device of the present application and the proposed virtual IP protection function detect the message before it enters the 4th or 7th layer load. If it is detected to be an attack message, it immediately enters the packet loss process to ensure the normal operation of the device business and prevent the device from increasing the CPU usage rate due to the long-term processing of the attack message packet loss, affecting the performance of the device and normal business. A variety of detection mechanisms are designed to prevent the normal business messages from being affected, and a method for detecting whether the device has been attacked is also provided: if the packet loss count of the virtual IP protection is found to increase, it can be determined that the device has been attacked, and further measures can be taken to block the attack source from accessing the device to ensure the normal and stable operation of the device.
[0103] Those skilled in the art will appreciate that all or part of the steps for implementing the above embodiments are implemented as a computer program executed by a CPU. When the computer program is executed by the CPU, the above functions defined by the above method provided in the present application are executed. The program may be stored in a computer-readable storage medium, which may be a read-only memory, a disk, or an optical disk, etc.
[0104] In addition, it should be noted that the above figures are only schematic illustrations of the processes included in the method according to the exemplary embodiments of the present application, and are not intended to be limiting. It is easy to understand that the processes shown in the above figures do not indicate or limit the time sequence of these processes. In addition, it is also easy to understand that these processes can be performed synchronously or asynchronously, for example, in multiple modules.
[0105] The following is an embodiment of the device of the present application, which can be used to execute the embodiment of the method of the present application. For details not disclosed in the embodiment of the device of the present application, please refer to the embodiment of the method of the present application.
[0106] Figure 5 FIG. 1 is a block diagram of a message processing device of a load balancing device according to an exemplary embodiment. Figure 5 As shown, the message processing device 50 of the load balancing device includes: a message module 502 , a policy module 504 , a matching module 506 , an identification module 508 , a discarding module 510 , and a processing module 512 .
[0107] The message module 502 is used for the load balancing device to obtain the request message from the client;
[0108] The policy module 504 is used to obtain the five-tuple data of the request message when the virtual service and the request message meet the policy; the policy module 504 is also used to determine whether the virtual service function of the load balancing device is enabled; when the virtual service function is enabled, perform the virtual IP protection process; determine whether the request message meets the preset conditions; and when the request message meets the preset conditions, determine whether the virtual service and the request message meet the policy.
[0109] The matching module 506 is used to match the five-tuple data with the virtual service configuration;
[0110] The identification module 508 is used to set an identification for the request message when no virtual service configuration is matched;
[0111] The discarding module 510 is used to discard the request message based on the identifier. The discarding module 510 is also used to obtain the request message to be discarded during the packet loss phase; when the request message contains the identifier, the request message is discarded.
[0112] The processing module 512 is used to forward the request message to the layer 4 or layer 7 load service for processing when the virtual service configuration is matched.
[0113] According to the message processing device of the load balancing device of the present application, a request message from a client is obtained through the load balancing device; when the virtual service and the request message satisfy the policy, the five-tuple data of the request message is obtained; the five-tuple data is matched with the virtual service configuration; when the virtual service configuration is not matched, an identifier is set for the request message; and the request message is discarded based on the identifier. This enables the message load balancing device to perform a packet discard operation in a timely manner when an attack message is received, thereby ensuring the normal operation of the load balancing device.
[0114] Optionally, the matching module also forwards the request message to the fourth layer or seventh layer load service for processing when matching the virtual service configuration. The policy module determines that the virtual service and the request message meet the policy, including: judging whether the virtual service function of the load balancing device is turned on; when the virtual service function is turned on, performing the virtual IP protection process; determining whether the request message meets the preset conditions; when the request message meets the preset conditions, determining that the virtual service and the request message meet the policy. When the policy module determines that the request message does not meet the preset conditions, the request message is forwarded to the fourth layer or seventh layer load service for processing. The policy module determines whether the request message meets the preset conditions, including: when there is no session corresponding to the request message, determining that the message meets the preset conditions; and / or when there is no preset service corresponding to the request message, determining that the message meets the preset conditions. The policy module obtains the five-tuple data of the request message, including: setting a matching mark for the five-tuple data of the request message. The policy module sets an identifier for the request message, including: setting a virtual IP protection on identifier for the request message; and / or setting an unmatched identifier for the request message. The discard module discards the request message based on the identifier, including: obtaining the request message to be discarded during the packet loss phase; discarding the request message when the request message contains the identifier. It also includes a statistical module (not shown) for counting a first number of request messages with the identifier; counting a second number of discarded request messages; and comparing the first number with the second number to determine the packet loss accuracy rate.
[0115] Figure 6 It is a block diagram of an electronic device according to an exemplary embodiment.
[0116] Refer to the following Figure 6 The electronic device 600 according to this embodiment of the present application is described. Figure 6 The electronic device 600 shown is merely an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.
[0117] like Figure 6 As shown, the electronic device 600 is in the form of a general computing device. The components of the electronic device 600 may include, but are not limited to: at least one processing unit 610, at least one storage unit 620, a bus 630 connecting different system components (including the storage unit 620 and the processing unit 610), a display unit 640, etc.
[0118] The storage unit stores a program code, which can be executed by the processing unit 610, so that the processing unit 610 performs the steps described in this specification according to various exemplary embodiments of the present application. For example, the processing unit 610 can perform the following steps: Figure 2 , Figure 3 , Figure 4 Follow the steps shown in .
[0119] The storage unit 620 may include a readable medium in the form of a volatile storage unit, such as a random access memory unit (RAM) 6201 and / or a cache memory unit 6202 , and may further include a read-only memory unit (ROM) 6203 .
[0120] The storage unit 620 may also include a program / utility 6204 having a set (at least one) of program modules 6205, such program modules 6205 including but not limited to: an operating system, one or more application programs, other program modules and program data, each of which or some combination may include the implementation of a network environment.
[0121] Bus 630 may represent one or more of several types of bus structures, including a memory unit bus or memory unit controller, a peripheral bus, an accelerated graphics port, a processing unit, or a local bus using any of a variety of bus architectures.
[0122] The electronic device 600 may also communicate with one or more external devices 600' (e.g., keyboards, pointing devices, Bluetooth devices, etc.) to enable a user to communicate with the electronic device 600, and / or any device (e.g., routers, modems, etc.) that the electronic device 600 can communicate with one or more other computing devices. Such communication may be performed via an input / output (I / O) interface 650. In addition, the electronic device 600 may also communicate with one or more networks (e.g., a local area network (LAN), a wide area network (WAN), and / or a public network, such as the Internet) via a network adapter 660. The network adapter 660 may communicate with other modules of the electronic device 600 via a bus 630. It should be understood that, although not shown in the figure, other hardware and / or software modules may be used in conjunction with the electronic device 600, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.
[0123] In general, the message processing method and device of the load balancing device disclosed in the present invention is also a method and device for preventing the load balancing service from being attacked. When the load balancing device is processing the service, a large number of attack messages are received in a short period of time. The characteristics of these attack messages are that the destination address is the IP of the virtual service, but the protocol is different from the virtual service. If the device fails to process the packet loss in time before processing the service, a large number of attack messages will enter the packet loss process because they do not match the configuration of the virtual service. The CPU of the device is occupied by the packet loss program for a long time, resulting in an increase in the utilization rate, even reaching 100%, which seriously affects the normal operation of the device and paralyzes the service. The method for preventing the load balancing service from being attacked disclosed in the present invention provides a protection solution, allowing the device to execute the packet loss operation in time to ensure that the device can operate normally. Specifically, a virtual IP protection switch is provided on the device page. Since the protection function will affect the performance of the device when it is turned on, a switch is designed. When the device needs protection, the virtual IP protection switch can be turned on to enter the protection process. At the same time, a new detection count is configured to count the number of virtual services in the device that are enabled and have the virtual IP protection function enabled. If the count is 0, even if all disabled virtual services have the virtual IP protection function enabled, the device will not enter the virtual IP protection process to ensure the performance of the device. When the virtual IP protection function is executed normally, the device receives a request message from the client and performs a protection function test before entering the device's layer 4 or layer 7 load service. The device first securely obtains the source IP address, destination IP address, source port, destination port and message protocol of the client request message; when the five-tuple of the client message is successfully obtained, the five-tuple is marked with need_match_flag, indicating that the five-tuple needs to enter the virtual IP tag configuration process; then enters the virtual service configuration matching process (five-tuple matching process), the attack message will not match the configuration of the virtual service (the protocol type of the virtual service is TCP protocol, and the protocol of the attack message is UDP). When the virtual service configuration is not matched, the virtual IP protection configuration mark and the mark that matches the virtual service IP will be marked, and the packet loss stage of the virtual IP protection will be entered. In the packet loss phase of virtual IP protection, it will detect whether the message matches the virtual service configuration of the device, whether it has been marked with the virtual IP protection configuration tag, and whether it has been marked with the tag matching the virtual service IP. If all the conditions are met, it will directly enter the packet loss process and increase the statistical count to count the number of lost packets. If the conditions are not met, the message is not an attack message, and the message is allowed to enter the 4th or 7th layer load service. In this way, message detection is performed before the 4th or 7th layer load service, and the attack message can be quickly dropped. This can ensure that the device will not process these attack messages for a long time when processing the 4th and 7th layer load services, the CPU utilization will not be greatly improved, and the service can be normal.The premise of the development of the virtual IP protection function is that it cannot affect the normal business process. Before entering the protection process, the message will be verified. If the message already has a normal session, it will not enter the protection process. Some special business messages cannot match the configuration of the virtual service, but they are not attack messages, and such messages also need to be released. For example, the virtual service IP address is 0.0.0.0. In such a special configuration, the protection operation will not be performed; there is also an application layer gateway service (ALG). Such business messages may not match the virtual service, but the ALG service will parse and convert the message information at the application layer. Such special services are directly released. The virtual IP protection function proposed in the present disclosure detects the message before it enters the 4th or 7th layer load. If it is detected to be an attack message, it immediately enters the packet loss process to ensure the normal operation of the equipment service and prevent the equipment from increasing the CPU utilization rate due to the long-term processing of attack message packet loss, affecting the performance of the equipment and normal business. A variety of detection mechanisms are designed to prevent normal business messages from being affected. A method is also provided to detect whether the device has been attacked: if the packet loss count of the virtual IP protection increases, it can be determined that the device has been attacked, and further measures can be taken to block the attack source from accessing the device to ensure the normal and stable operation of the device.
[0124] Through the above description of the implementation, it is easy for those skilled in the art to understand that the example implementation described here can be implemented by software, or by combining software with necessary hardware. Figure 7 As shown, the technical solution according to the implementation mode of the present application can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.) or on a network, and includes a number of instructions to enable a computing device (which can be a personal computer, a server, or a network device, etc.) to execute the above method according to the implementation mode of the present application.
[0125] The software product may be any combination of one or more readable media. The readable medium may be a readable signal medium or a readable storage medium. The readable storage medium may be, for example, but not limited to, a system, device or component of electricity, magnetism, light, electromagnetic, infrared, or semiconductor, or any combination thereof. More specific examples (non-exhaustive list) of readable storage media include: an electrical connection with one or more wires, a portable disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination thereof.
[0126] The computer readable storage medium may include a data signal propagated in a baseband or as part of a carrier wave, wherein a readable program code is carried. This propagated data signal may take a variety of forms, including but not limited to an electromagnetic signal, an optical signal, or any suitable combination of the above. The readable storage medium may also be any readable medium other than a readable storage medium, which may send, propagate, or transmit a program for use by an instruction execution system, an apparatus, or a device or used in combination with it. The program code contained on the readable storage medium may be transmitted with any appropriate medium, including but not limited to wireless, wired, optical cable, RF, etc., or any suitable combination of the above.
[0127] Program code for performing the operations of the present application may be written in any combination of one or more programming languages, including object-oriented programming languages such as Java, C++, etc., and conventional procedural programming languages such as "C" or similar programming languages. The program code may be executed entirely on the user computing device, partially on the user device, as a separate software package, partially on the user computing device and partially on a remote computing device, or entirely on a remote computing device or server. In the case of a remote computing device, the remote computing device may be connected to the user computing device through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computing device (e.g., using an Internet service provider to connect through the Internet).
[0128] The above-mentioned computer-readable medium carries one or more programs. When the above-mentioned one or more programs are executed by a device, the computer-readable medium implements the following functions: the load balancing device obtains a request message from the client; when the virtual service and the request message meet the policy, obtains the five-tuple data of the request message; matches the five-tuple data with the virtual service configuration; when the virtual service configuration is not matched, sets an identifier for the request message; and discards the request message based on the identifier.
[0129] Those skilled in the art will appreciate that the above modules can be distributed in the device according to the description of the embodiment, or can be changed accordingly and only used in one or more devices different from the embodiment. The modules of the above embodiments can be combined into one module, or further divided into multiple sub-modules.
[0130] Through the description of the above embodiments, it is easy for those skilled in the art to understand that the example embodiments described here can be implemented by software, or by software combined with necessary hardware. Therefore, the technical solution according to the embodiment of the present application can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.) or on a network, including several instructions to enable a computing device (which can be a personal computer, a server, a mobile terminal, or a network device, etc.) to execute the method according to the embodiment of the present application.
[0131] The exemplary embodiments of the present application are specifically shown and described above. It should be understood that the present application is not limited to the detailed structures, configurations or implementations described herein; on the contrary, the present application is intended to cover various modifications and equivalent configurations included in the spirit and scope of the appended claims.
Claims
1. A message processing method for a load balancing device, characterized in that: include: The load balancing device obtains the request message from the client; Determine whether the virtual service function of the load balancing device is enabled; When the virtual service function is enabled, the virtual IP protection process is performed; When there is no session corresponding to the request message, determining that the message meets a preset condition; and / or when there is no preset service corresponding to the request message, determining that the message meets a preset condition; When the request message meets the preset condition, obtaining the five-tuple data of the request message; Matching the five-tuple data with the virtual service configuration includes: first securely obtaining the five-tuple data and the message protocol of the client request message; in the case of successfully obtaining the five-tuple of the client message, marking the five-tuple data with a need_match_flag, and matching the virtual service configuration with the five-tuple data, wherein the attack message will not match the virtual service; When the virtual service configuration is not matched, setting an identifier for the request message; The request message is discarded based on the identifier.
2. The method according to claim 1, characterized in that Also includes: When the virtual service configuration is matched, the request message is forwarded to the layer 4 or layer 7 load service for processing.
3. The method according to claim 1, characterized in that Also includes: When the request message does not meet the preset condition, the request message is forwarded to the layer 4 or layer 7 load service for processing.
4. The method according to claim 1, characterized in that Acquiring the five-tuple data of the request message also includes: A matching mark is set for the five-tuple data of the request message.
5. The method according to claim 4, characterized in that Setting an identifier for the request message includes: Setting a virtual IP protection enable flag for the request message; and / or An unmatched flag is set for the request message.
6. The method according to claim 1, characterized in that The step of discarding the request message based on the identifier includes: In the packet loss phase, obtain the request message to be discarded; When the request message contains the identifier, the request message is discarded.
7. The method according to claim 6, characterized in that Also includes: Counting a first number of request messages with the identifier; Counting a second number of discarded request messages; The first number and the second number are compared to determine the packet loss accuracy rate.
8. A message processing device for a load balancing device, characterized in that: include: The message module is used for the load balancing device to obtain the request message from the client; A policy module, used to determine whether the virtual service function of the load balancing device is enabled, and when the virtual service function is enabled, to perform a virtual IP protection process, and when there is no session corresponding to the request message, to determine that the message meets a preset condition, and / or when there is no preset service corresponding to the request message, to determine that the message meets the preset condition, and when the request message meets the preset condition, to obtain quintuple data of the request message; A matching module, used for matching the five-tuple data with the virtual service configuration, including: first securely obtaining the five-tuple data and the message protocol of the client request message; in the case of successfully obtaining the five-tuple of the client message, marking the five-tuple data with a need_match_flag, and matching the virtual service configuration for the five-tuple data, wherein the attack message will not match the virtual service; An identification module, used for setting an identification for the request message when no virtual service configuration is matched; A discarding module is used to discard the request message based on the identifier.
