Data protection method and device, equipment and storage medium
By placing the network equipment in transparent bridge mode, using the second layer of the protocol stack to achieve packet payload protection, it solves the problems of large bandwidth overhead and low data processing performance in satellite communications, and realizes efficient data protection and Low latency data transmission.
Patent Information
- Application Number
- CN202411368435.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-29
- Publication Date
- 2024-11-22
AI Technical Summary
Due to the large bandwidth overhead and low data processing performance in satellite communication, the existing IPSEC VPN technology increases network transmission costs when using data protection. The XFRM framework of the Linux kernel does not support separate protection of network message data payload parts, which affects the impact of Data transmission efficiency.
By placing the network device in transparent bridge mode, the second layer of the protocol stack is used to achieve packet payload protection, reducing the flow of data packets in the protocol stack and the packaging and decapsulation process, and improving data processing efficiency.
It reduces data transmission costs, improves the efficiency and performance of network data protection, and reduces data forwarding delay.
Smart Images

Figure CN119011285A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of information security, and in particular to a data protection method, device, equipment and storage medium. Background Art
[0002] With the popularization of satellite technology, the improvement of network security awareness of satellite communication users, and the gradual occurrence of network attacks on satellite communication users using satellite links in recent years. However, since it is difficult to reinforce satellite security communications, IPSEC VPN (Internet Protocol Security Virtual Private Network, a virtual private network technology) is often deployed between the headquarters base and remote stations to protect the network transmission of user communication data packets. Before the deployment of VPN gateways and VPN devices, the business data between the remote business system and the office system and business system of the headquarters base is transmitted in plain text in the network. After the deployment of VPN gateways and VPN devices, the network data between the headquarters base and the remote stations is protected to prevent eavesdropping and tampering.
[0003] The existing IPSEC VPN technology mainly adopts the IKE protocol (Internet Key Exchange) to use digital certificate protection for session key negotiation, adopts the Linux kernel XFRM framework to realize the encapsulation of secure data payload, and sends and receives data packets based on the Linux kernel protocol stack. Due to the current tight satellite communication bandwidth and expensive satellite communication charges, most of the data transmitted in the satellite link is short message data of about 100 bytes, but the format after VPN security encapsulation is 74 bytes longer than before encapsulation, which will increase the cost of existing satellite communication bandwidth by about 74%. This has caused the network transmission cost of enterprises to increase accordingly while using data protection, affecting the enthusiasm of enterprises to use security measures to protect data transmission. Therefore, a mode of encryption protection is needed only for the business payload part, such as TCP (Transmission Control Protocol) payload / UDP (User Datagram Protocol) payload, etc.
[0004] However, the standard XFRM framework of the Linux kernel does not support separate payload protection for the data load part of the network message, and only supports the tunnel mode or transmission mode of VPN. In addition, the processing process of XFRM is complicated. Since the IPSEC VPN tunnel mode will create a new IP (Internet Protocol) header, the processing flow of XFRM is carried out at the third layer of the protocol stack of the LINUX kernel. After the external IP header is encapsulated in the outgoing packet and the external IP header is removed in the incoming packet, the route creation and search will be performed. This leads to many processes of data packets in the LINUX kernel, a long time for encrypted data packet processing, and low data forwarding performance. A higher central processing unit is often required to provide higher encrypted data forwarding performance. However, if secondary development is carried out on the basis of the XFRM framework to support the data payload mode, a large number of modifications need to be made to XFRM. The modified XFRM framework no longer supports the IPSEC VPN function, which is not conducive to the expansion of product functions. Therefore, how to improve the effect of using the Linux kernel to protect the data load part is a problem to be solved in this field. Summary of the invention
[0005] In view of this, the purpose of the present invention is to provide a data protection method, device, equipment and storage medium, which improves the efficiency of network data protection by protecting the payload data of the data packet by placing the network device in transparent bridge mode, and improves the data processing efficiency by implementing the payload protection of the protocol payload part at the second layer of the protocol stack. The specific scheme is as follows:
[0006] In a first aspect, the present application provides a data protection method, which is applied to a data protection device, comprising:
[0007] The network interface of the data protection device is configured as a bridge mode, and an initial Ethernet data packet sent by a preset server is received through an input network port in the network interface;
[0008] Processing the initial Ethernet data packet through the BROUTING chain and the PREROUTING chain in sequence, and determining the destination Ethernet address of the target Ethernet data packet obtained after the processing, so as to judge whether the target Ethernet data packet is a local data packet of the data protection device through the destination Ethernet address;
[0009] If the target Ethernet data packet is not the local data packet, the target Ethernet data packet is transferred into the FORWARD chain, and data encryption or data decryption processing is performed on the target Ethernet data packet based on the preset security policy in the FORWARD chain;
[0010] The processed target Ethernet data packet is forwarded to the output network port in the network interface through the FORWARD chain and the POSTING chain for output.
[0011] Optionally, after determining whether the target Ethernet data packet is a local data packet of the data protection device according to the destination Ethernet address, the method further includes:
[0012] If the target Ethernet data packet is the local data packet, after the target Ethernet data packet is transmitted to the preset local data processing tool of the data protection device, the processed target Ethernet data packet is directly forwarded to the output network port in the network interface through the POSTING chain for output.
[0013] Optionally, after the target Ethernet data packet is transferred into the FORWARD chain, the method further includes:
[0014] Traversing each of the preset security policies in the FORWARD chain in turn to match the preset security policy with the target Ethernet data packet;
[0015] If the preset security policy corresponding to the target Ethernet data packet is matched, the step of performing data encryption or data decryption processing on the target Ethernet data packet based on the preset security policy in the FORWARD chain is executed;
[0016] If the preset security policy corresponding to the target Ethernet data packet is not matched, the target Ethernet data packet is processed according to the preset default processing policy in the FORWARD chain.
[0017] Optionally, before performing data encryption or data decryption processing on the target Ethernet data packet based on the preset security policy in the FORWARD chain, the method further includes:
[0018] Determine a corresponding hash value according to the data IP address, data protocol, and data transmission port in the preset security policy, construct a key chain table based on the hash value and a preset session key, and store the key chain table in the Linux kernel layer of the data protection device;
[0019] Accordingly, matching the preset security policy with the target Ethernet data packet includes:
[0020] The preset security policy is matched with the target Ethernet data packet. If there is a preset security policy corresponding to the target Ethernet data, the data IP address, the data protocol, the data transmission port and the target Ethernet data packet corresponding to the preset security policy are matched in sequence, so as to perform data encryption or data decryption processing on the target Ethernet data packet after a successful match; wherein, if there is no corresponding data transmission port in the target Ethernet data packet, it is determined that the target Ethernet data packet and the data transmission port are matched successfully.
[0021] Optionally, the performing data encryption or data decryption processing on the target Ethernet data packet includes:
[0022] The security identifier of the security attribute payload at the end of the target Ethernet data packet is determined, and data encryption or data decryption processing is performed on the target Ethernet data packet according to the security identifier.
[0023] Optionally, the performing data encryption or data decryption processing on the target Ethernet data packet according to the security identifier includes:
[0024] If it is determined according to the security identifier that data encryption processing is performed on the target Ethernet data packet, a target hash value of the target Ethernet data packet is determined according to the data IP address, the data protocol, and the data transmission port of the target Ethernet data packet;
[0025] Determine the preset session key corresponding to the target Ethernet data packet from the key chain table according to the target hash value, and encrypt the original payload data of the target Ethernet data packet according to the preset session key to obtain a ciphertext payload;
[0026] Determine a header checksum of the target Ethernet data packet, save the header checksum to the data tail of the ciphertext payload, and set a target security identifier of the target Ethernet data packet according to a preset identifier setting rule, so as to construct a security attribute payload of the target Ethernet data packet according to the header checksum and the target security identifier;
[0027] An Ethernet data payload is constructed according to the security attribute payload and the ciphertext payload, and a length field and a header checksum field of the target Ethernet data packet are updated according to the Ethernet data payload.
[0028] Optionally, the performing data encryption or data decryption processing on the target Ethernet data packet according to the security identifier includes:
[0029] If it is determined according to the security identifier that the target Ethernet data packet is to be decrypted, a target hash value of the target Ethernet data packet is determined according to the data IP address, the data protocol, and the data transmission port of the target Ethernet data packet;
[0030] Determine the preset session key corresponding to the target Ethernet data packet from the key chain table according to the target hash value, and decrypt the ciphertext payload of the target Ethernet data packet according to the preset session key to obtain target payload data;
[0031] Determining a first header checksum of the target payload data and comparing a second header checksum in the security attribute payload in the target Ethernet data packet;
[0032] If the first header checksum is equal to the second header checksum, the length field and the header checksum field of the target Ethernet data packet are updated according to the target payload data.
[0033] In a second aspect, the present application provides a data protection device, which is applied to a data protection device, including:
[0034] A data receiving module, used to configure the network interface of the data protection device to a bridge mode, and receive an initial Ethernet data packet sent by a preset server through an input network port in the network interface;
[0035] A data judgment module, used for processing the initial Ethernet data packet through the BROUTING chain and the PREROUTING chain in sequence, and determining the destination Ethernet address of the target Ethernet data packet obtained after the processing, so as to judge whether the target Ethernet data packet is a local data packet of the data protection device through the destination Ethernet address;
[0036] A data processing module, configured to transfer the target Ethernet data packet into a FORWARD chain if the target Ethernet data packet is not the local data packet, and perform data encryption or data decryption processing on the target Ethernet data packet based on a preset security policy in the FORWARD chain;
[0037] The data output module is used to forward the processed target Ethernet data packet to the output network port in the network interface through the FORWARD chain and the POSTING chain for output.
[0038] In a third aspect, the present application provides an electronic device, comprising a processor and a memory; wherein the memory is used to store a computer program, and the computer program is loaded and executed by the processor to implement the aforementioned data protection method.
[0039] In a fourth aspect, the present application provides a computer-readable storage medium for storing a computer program, which implements the aforementioned data protection method when executed by a processor.
[0040] In the present application, the network interface of the data protection device is first configured to the bridge mode, and the initial Ethernet data packet sent by the preset server is received through the input network port in the network interface, and then the initial Ethernet data packet is processed through the BROUTING chain and the PREROUTING chain in sequence, and the destination Ethernet address of the target Ethernet data packet obtained after processing is determined, so as to judge whether the target Ethernet data packet is a local data packet of the data protection device through the destination Ethernet address; if the target Ethernet data packet is not a local data packet, the target Ethernet data packet is passed to the FORWARD chain, and the target Ethernet data packet is encrypted or decrypted based on the preset security policy in the FORWARD chain, and then the processed target Ethernet data packet is forwarded to the output network port in the network interface through the FORWARD chain and the POSTING chain for output. In this way, when performing network data packet payload protection in the present application, the network device is in transparent bridge mode, and can implement encryption and other protections on the payload data portion of the network data packet, thereby improving the efficiency of network data protection. Moreover, by implementing the payload protection of the protocol payload portion in the second layer of the protocol stack, compared with the method of performing data processing in the three-layer protocol stack, the data packet has fewer flow links and data encapsulation and decapsulation processes in the protocol stack, thereby improving data processing efficiency and having lower data forwarding delay. BRIEF DESCRIPTION OF THE DRAWINGS
[0041] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying creative work.
[0042] Figure 1 A flow chart of a data protection method provided for this application;
[0043] Figure 2 A schematic diagram of a data protection device deployment method provided for this application;
[0044] Figure 3 A flow chart of Ethernet data packet processing provided by this application;
[0045] Figure 4 A security policy matching flow chart provided for this application;
[0046] Figure 5 A specific data protection method flow chart provided for this application;
[0047] Figure 6 A payload processing flow chart provided for this application;
[0048] Figure 7 A data encryption flow chart provided for this application;
[0049] Figure 8 A data decryption flow chart provided for this application;
[0050] Fig. 9 A schematic diagram of the structure of a data protection device provided for this application;
[0051] Fig.10 A structural diagram of an electronic device provided for this application. DETAILED DESCRIPTION
[0052] 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.
[0053] Currently, the standard XFRM framework of the Linux kernel does not support separate payload protection for the data payload part of the network message, and because the XFRM processing flow is performed at the third layer of the protocol stack of the LINUX kernel, there are many processes for data packets in the LINUX kernel, and the encrypted data packet processing takes a long time. In the present application, when performing network data packet payload protection, the network device is in transparent bridge mode, which can implement encryption and other protection for the payload data part of the network data packet, thereby improving the efficiency of network data protection. In addition, by implementing the payload protection of the protocol payload part in the second layer of the protocol stack, the data packet has fewer circulation links and data encapsulation and decapsulation processes in the protocol stack, thereby improving data processing efficiency.
[0054] See also Figure 1 As shown, an embodiment of the present invention discloses a data protection method, which is applied to a data protection device, including:
[0055] Step S11: configuring the network interface of the data protection device to be in bridge mode, and receiving an initial Ethernet data packet sent by a preset server through an input network port in the network interface.
[0056] The implementation of this embodiment requires configuring the two network interfaces of the data protection device into bridge mode, such as Figure 2As shown, a network port A is connected to the internal LAN, and a network port B is connected to the external router, so that the initial Ethernet data packet sent by the preset server is received through the input network port A in the network interface.
[0057] Step S12: Process the initial Ethernet data packet through the BROUTING chain and the PREROUTING chain in sequence, and determine the destination Ethernet address of the target Ethernet data packet obtained after processing, so as to judge whether the target Ethernet data packet is a local data packet of the data protection device through the destination Ethernet address.
[0058] In this embodiment, Figure 3 As shown, the initial Ethernet data packet obtained from the server needs to be processed through the BROUTING chain and the PREROUTING chain in sequence, and the destination Ethernet address of the target Ethernet data packet obtained after processing is determined, so as to determine whether the target Ethernet data packet is a local data packet of the data protection device through the destination Ethernet address. After the network interface receives the Ethernet data packet, it is first processed by the BROUTING chain and the PREROUTING chain, and then the destination MAC (Media Access Control Address) of the data packet, that is, the dst MAC, is determined to determine whether the Ethernet data packet is a local data packet. If it is not a local data packet, it enters the FORWARD chain for processing.
[0059] Step S13: If the target Ethernet data packet is not the local data packet, the target Ethernet data packet is transferred into the FORWARD chain, and data encryption or data decryption processing is performed on the target Ethernet data packet based on the preset security policy in the FORWARD chain.
[0060] In this embodiment, Figure 3As shown, if the target Ethernet data packet is not a local data packet, the target Ethernet data packet is passed into the FORWARD chain, and the target Ethernet data packet is encrypted or decrypted based on the preset security policy in the FORWARD chain. It should be pointed out that in this embodiment, the ebtables tool is used to extend the security policy and define new target actions on the FORWARD chain in the Ethernet Bridge Netfilter of the Linux kernel. The above-mentioned ebtables tool is a common network configuration tool in the Linux system. Through ebtables, ARP (Address Resolution Protocol) protection rules, NAT (Network Address Translation) rules, etc. can be configured. By modifying ebtables, the target action can be configured as a security policy for payload encryption. The security policy format is as follows:
[0061] ebtables -A FPRWARD -p ipv4 --ip-proto tcp or udp --ip-src source IP --ip-sport source port --ip-drc destination IP --ip-dport destination port -j JINGHE;
[0062] A specific FORWARD chain security strategy is as follows:
[0063] Example of outbound policy:
[0064] ebtables -A FPRWARD -p ipv4--ip-proto tcp--ip-src 10.1.1.10--ip-drc20.1.1.10--ip-dport 8888-j JINGHE;
[0065] Example of an inbound policy:
[0066] ebtables -A FPRWARD -p ipv4--ip-proto tcp--ip-src 20.1.1.10----ip-sport8888ip-drc 10.1.1.10-j JINGHE.
[0067] After the target Ethernet data packet is passed into the FORWARD chain, the preset security policy and the target Ethernet data packet can be matched by traversing each preset security policy in the FORWARD chain in turn; if the preset security policy corresponding to the target Ethernet data packet is matched, the step of encrypting or decrypting the target Ethernet data packet based on the preset security policy in the FORWARD chain is executed; if the preset security policy corresponding to the target Ethernet data packet is not matched, the target Ethernet data packet is processed according to the preset default processing policy in the FORWARD chain. Figure 4 As shown in the figure, when an Ethernet data packet reaches the FORWARD chain, it traverses each preset security policy on the FORWARD until a matching security policy is found and then enters the payload processing flow. Data packets that do not match any policy are processed according to the default processing method of the FORWARD chain (including but not limited to discarding and forwarding). It can be understood that in the above process, the Ethernet data packet mainly matches the source / destination IP, protocol and source / destination port in the policy. And in this process, Figure 3 As shown, when the Ethernet data packet is matched with the preset security policy through the FORWARD chain, when the data packet hits the security policy, it will enter the action function ebt_jinghe for processing, so as to realize the encryption or decryption processing of the Ethernet data packet through the ebt_jinghe function.
[0068] In another embodiment, if Figure 3 As shown, after determining whether the target Ethernet data packet is a local data packet of the data protection device through the destination Ethernet address, if the target Ethernet data packet is a local data packet, the target Ethernet data packet is transmitted to the preset local data processing tool of the data protection device, and the processed target Ethernet data packet is directly forwarded to the output network port in the network interface through the POSTING chain for output.
[0069] Step S14: forward the processed target Ethernet data packet to the output network port in the network interface through the FORWARD chain and the POSTING chain for output.
[0070] In this embodiment, Figure 3 As shown, the processed target Ethernet data packet is forwarded to the output network port in the network interface through the FORWARD chain and the POSTING chain for output to complete the current data protection process.
[0071] In this embodiment, the network interface of the data protection device is first configured to the bridge mode, and the initial Ethernet data packet sent by the preset server is received through the input network port in the network interface, and then the initial Ethernet data packet is processed through the BROUTING chain and the PREROUTING chain in sequence, and the destination Ethernet address of the target Ethernet data packet obtained after processing is determined, so as to judge whether the target Ethernet data packet is a local data packet of the data protection device through the destination Ethernet address; if the target Ethernet data packet is not a local data packet, the target Ethernet data packet is passed to the FORWARD chain, and data encryption or data decryption processing is performed on the target Ethernet data packet based on the preset security policy in the FORWARD chain, and then the processed target Ethernet data packet is forwarded to the output network port in the network interface through the FORWARD chain and the POSTING chain for output. Through the above technical solution, when performing network data packet payload protection, the network device can be placed in transparent bridge mode, and based on the bridge netfilter mechanism of the Linux kernel, the payload data part in the network data packet can be encrypted and protected, thereby improving the efficiency of network data protection and reducing the overhead of cryptographic resources and network bandwidth caused by network data protection; and by implementing the payload protection of the protocol payload part in the second layer of the protocol stack, compared with the method of performing data processing in the three-layer protocol stack, the data packet has fewer flow links and data encapsulation and decapsulation processes in the protocol stack, thereby improving data processing efficiency and having a lower data forwarding delay.
[0072] Based on the previous embodiment, it can be known that the present application can set the network device in the transparent bridge mode to implement encryption and other protection of the payload data part in the network data packet. Next, the process of data encryption and decryption will be described in detail in this embodiment. Figure 5 As shown, the embodiment of the present application discloses a specific data protection method, which is applied to a data protection device, including:
[0073] Step S21, determine the corresponding hash value according to the data IP address, data protocol, and data transmission port in the preset security policy, build a key chain table based on the hash value and the preset session key, and store the key chain table in the Linux kernel layer of the data protection device.
[0074] In this embodiment, the session key obtained by the application layer can be set to the kernel layer through the netlink mechanism. When storing, the session key is stored in the kernel in the form of KV in the key chain table. Among them, K is the hash value of the five-tuple of the security policy "source IP, destination IP, protocol number, source port, destination port". When calculating the K value, if a specific policy data in the security policy, such as the source port, does not exist, "0" is used instead when calculating the hash; V is the session key. Therefore, before processing the data, it is necessary to determine the corresponding hash value according to the data IP address, data protocol, and data transmission port in the preset security policy, and construct a key chain table based on the hash value and the preset session key, and store the key chain table in the Linux kernel layer of the data protection device.
[0075] Step S22, passing the target Ethernet data packet into the FORWARD chain, and matching the preset security policy with the target Ethernet data packet; if there is a preset security policy corresponding to the target Ethernet data packet, then sequentially matching the data IP address, the data protocol, the data transmission port corresponding to the preset security policy with the target Ethernet data packet; wherein, if there is no corresponding data transmission port in the target Ethernet data packet, it is determined that the target Ethernet data packet and the data transmission port match successfully.
[0076] In this embodiment, after the target Ethernet data packet is passed into the FORWARD chain, the preset security policy is matched with the target Ethernet data packet. If there is a preset security policy corresponding to the target Ethernet data packet, the data IP address, data protocol, data transmission port corresponding to the preset security policy and the target Ethernet data packet are matched in turn. Figure 4 As shown, it may happen that there is no data transmission port when matching. At this time, if it is determined that there is no corresponding data transmission port in the target Ethernet data packet, it is directly determined that the target Ethernet data packet and the data transmission port in the security policy match successfully.
[0077] Step S23: If the match is successful, determine the security identifier of the security attribute payload at the end of the target Ethernet data packet, and perform data encryption or data decryption processing on the target Ethernet data packet according to the security identifier.
[0078] In this embodiment, if the match is successful and it is determined that there is a corresponding security policy, the security identifier of the security attribute payload at the end of the target Ethernet data packet is determined, and data encryption or data decryption processing is performed on the target Ethernet data packet according to the security identifier. Figure 6As shown, by processing the Ethernet data packets that hit the rules through the preset payload processing function, it is possible to determine whether the current Ethernet data packet is an encrypted data packet based on the security identifier in the security attribute payload at the end of the data packet, so as to subsequently enter the encryption processing flow or the decryption processing flow and perform corresponding processing.
[0079] In a specific embodiment, Figure 7 As shown, if the target Ethernet data packet is to be encrypted according to the security identifier, the target hash value of the target Ethernet data packet is determined according to the data IP address, data protocol, and data transmission port of the target Ethernet data packet, and the preset session key corresponding to the target Ethernet data packet is determined from the key chain table according to the target hash value, and the original payload data of the target Ethernet data packet is encrypted according to the preset session key to obtain the ciphertext payload, and then the header checksum of the target Ethernet data packet is determined, and the header checksum is saved to the data tail of the ciphertext payload, and the target security identifier of the target Ethernet data packet is set according to the preset identifier setting rule, so as to construct the security attribute payload of the target Ethernet data according to the header checksum and the target security identifier, so as to construct the Ethernet data payload according to the security attribute payload and the ciphertext payload, and update the length field and header checksum field of the target Ethernet data packet according to the Ethernet data payload. In this embodiment, when encrypting the Ethernet data outbound direction, the key is first searched, and the session key corresponding to the hash can be searched in the key chain table by calculating the hash value of the data packet "source IP, destination IP, protocol number, source port, destination port", and if the session key cannot be found at this time, the Ethernet data packet is discarded. Then the payload is encrypted, and the original TCP / UDP payload is encrypted with the session key to obtain the ciphertext payload. After the payload is encrypted, the tail is padded. By saving the original TCP / UDP header checksum to the tail of the TCP / UDP ciphertext payload and setting the security flag, the security attribute payload can be formed through the above two fields. After the above process is completed, the header can be modified. The ciphertext payload and the security attribute payload are combined to form a new Ethernet data payload, and then the source port and destination port fields in the Ethernet data packet TCP / UDP header are kept unchanged. Only the length and header checksum fields in the original TCP / UDP header are modified according to the newly obtained payload, so as to update the IP data packet length in the IP header and recalculate the IP header checksum.
[0080] In another specific embodiment, Figure 8As shown, if the target Ethernet data packet is decrypted according to the security identifier, the target hash value of the target Ethernet data packet is determined according to the data IP address, data protocol, and data transmission port of the target Ethernet data packet, and then the preset session key corresponding to the target Ethernet data packet is determined from the key chain table according to the target hash value, and the ciphertext payload of the target Ethernet data packet is decrypted according to the preset session key to obtain the target payload data, and then the first header checksum of the target payload data is determined, and the second header checksum in the security attribute payload in the target Ethernet data packet is compared; if the first header checksum is equal to the second header checksum, the length field and the header checksum field of the target Ethernet data packet are updated according to the target payload data. In this embodiment, if the Ethernet data needs to be decrypted in the inbound direction, the key is first searched, and the session key corresponding to the hash can be searched in the key chain table by calculating the hash value of the data packet "source IP, destination IP, protocol number, source port, destination port", and if the session key is not found, the Ethernet data packet is discarded. Then the payload is decrypted, specifically by using the session key to decrypt the ciphertext payload part in the TCP / UDP payload to obtain the original TCP / UDP payload. After that, the payload needs to be verified. Specifically, the header checksum can be recalculated for the decrypted TCP / UDP payload, and the calculation result can be compared with the original protocol header checksum stored in the security attribute payload. If the two are not equal, it is considered that the data packet has been tampered with during transmission and is discarded accordingly. After the payload is verified, the header can be modified to keep the source port and destination port fields in the Ethernet data packet TCP / UDP header unchanged, and only the length and header checksum fields in the original TCP / UDP header can be modified according to the newly obtained payload. Specifically, the IP packet length in the IP header can be updated, and the IP header checksum can be recalculated.
[0081] In this embodiment, the corresponding hash value is first determined according to the data IP address, data protocol, and data transmission port in the security policy, and a key chain table is constructed based on the hash value and the session key to store the key chain table in the Linux kernel layer of the data protection device. Then, the preset security policy and the target Ethernet data packet are matched. If there is a preset security policy corresponding to the target Ethernet data, the data IP address, data protocol, data transmission port corresponding to the preset security policy and the target Ethernet data packet are matched in turn. If the match is successful, the security identifier of the security attribute payload at the end of the data packet of the target Ethernet data packet is determined, and data encryption or data decryption processing is performed on the target Ethernet data packet according to the security identifier. In this embodiment, only symmetric cryptographic operations are used for data protection. Compared with a large number of symmetric and asymmetric cryptographic clouds and hash operations and random number generation in existing VPN technologies, the required cryptographic resource overhead is reduced, and the conventional XFRM framework is avoided to implement VPN in the third layer of the protocol stack. Based on the kernel bridge netfilter framework, the payload protection of the protocol payload part is implemented in the second layer of the protocol stack. The data packet has fewer flow links in the protocol stack, fewer data encapsulation and decapsulation processes, and the length of the data encryption and decryption parts is short, which improves the data processing efficiency and has a lower data forwarding delay.
[0082] See also Fig. 9 As shown, the embodiment of the present application also discloses a data protection device, which is applied to a data protection device, including:
[0083] The data receiving module 11 is used to configure the network interface of the data protection device to a bridge mode, and receive an initial Ethernet data packet sent by a preset server through an input network port in the network interface;
[0084] The data judgment module 12 is used to process the initial Ethernet data packet through the BROUTING chain and the PREROUTING chain in sequence, and determine the destination Ethernet address of the target Ethernet data packet obtained after the processing, so as to judge whether the target Ethernet data packet is a local data packet of the data protection device through the destination Ethernet address;
[0085] The data processing module 13 is used for transferring the target Ethernet data packet into the FORWARD chain if the target Ethernet data packet is not the local data packet, and performing data encryption or data decryption processing on the target Ethernet data packet based on the preset security policy in the FORWARD chain;
[0086] The data output module 14 is used to forward the processed target Ethernet data packet to the output network port in the network interface through the FORWARD chain and the POSTING chain for output.
[0087] This embodiment first configures the network interface of the data protection device to the bridge mode, and receives the initial Ethernet data packet sent by the preset server through the input network port in the network interface, and then processes the initial Ethernet data packet through the BROUTING chain and the PREROUTING chain in sequence, and determines the destination Ethernet address of the target Ethernet data packet obtained after processing, so as to judge whether the target Ethernet data packet is a local data packet of the data protection device through the destination Ethernet address; if the target Ethernet data packet is not a local data packet, the target Ethernet data packet is passed into the FORWARD chain, and the target Ethernet data packet is encrypted or decrypted based on the preset security policy in the FORWARD chain, and then the processed target Ethernet data packet is forwarded to the output network port in the network interface through the FORWARD chain and the POSTING chain for output. Through the above technical solution, when performing network data packet payload protection, the network device can be placed in transparent bridge mode, and encryption and other protections can be implemented on the payload data part of the network data packet, thereby improving the efficiency of network data protection. Moreover, by implementing the payload protection of the protocol payload part in the second layer of the protocol stack, compared with the method of performing data processing in the three-layer protocol stack, the data packet has fewer flow links and data encapsulation and decapsulation processes in the protocol stack, thereby improving data processing efficiency and having a lower data forwarding delay.
[0088] In some specific embodiments, the data processing module 13 further includes:
[0089] A data forwarding unit is used for, if the target Ethernet data packet is the local data packet, transferring the target Ethernet data packet into the preset local data processing tool of the data protection device, and then directly forwarding the processed target Ethernet data packet through the POSTING chain to the output network port in the network interface for output.
[0090] In some specific embodiments, the data processing module 13 further includes:
[0091] A first data matching unit, configured to sequentially traverse each of the preset security policies in the FORWARD chain to match the preset security policy with the target Ethernet data packet;
[0092] A first data processing unit, configured to execute the step of performing data encryption or data decryption processing on the target Ethernet data packet based on the preset security policy in the FORWARD chain if the preset security policy corresponding to the target Ethernet data packet is matched;
[0093] The second data processing unit is configured to process the target Ethernet data packet according to a preset default processing policy in the FORWARD chain if the preset security policy corresponding to the target Ethernet data packet is not matched.
[0094] In some specific embodiments, the data processing module 13 further includes:
[0095] A key storage unit, used to determine a corresponding hash value according to the data IP address, data protocol, and data transmission port in the preset security policy, and to construct a key chain table based on the hash value and a preset session key, and to store the key chain table in the Linux kernel layer of the data protection device;
[0096] Accordingly, the data processing module 13 specifically includes:
[0097] A second data matching unit is used to match the preset security policy with the target Ethernet data packet. If the preset security policy corresponding to the target Ethernet data exists, the data IP address, the data protocol, the data transmission port and the target Ethernet data packet corresponding to the preset security policy are matched in sequence, so as to perform data encryption or data decryption processing on the target Ethernet data packet after a successful match; wherein, if the corresponding data transmission port does not exist in the target Ethernet data packet, it is determined that the target Ethernet data packet and the data transmission port are matched successfully.
[0098] In some specific embodiments, the data processing module 13 specifically includes:
[0099] The data processing submodule is used to determine the security identifier of the security attribute payload at the end of the target Ethernet data packet, and perform data encryption or data decryption processing on the target Ethernet data packet according to the security identifier.
[0100] In some specific embodiments, the data processing submodule specifically includes:
[0101] A first hash value determination unit is used to determine a target hash value of the target Ethernet data packet according to the data IP address, the data protocol, and the data transmission port of the target Ethernet data packet if it is determined that data encryption processing is performed on the target Ethernet data packet according to the security identifier;
[0102] a key determination unit, configured to determine the preset session key corresponding to the target Ethernet data packet from the key chain table according to the target hash value, and encrypt the original payload data of the target Ethernet data packet according to the preset session key to obtain a ciphertext payload;
[0103] A payload construction unit, configured to determine a header checksum of the target Ethernet data packet, save the header checksum to the data tail of the ciphertext payload, and set a target security identifier of the target Ethernet data packet according to a preset identifier setting rule, so as to construct a security attribute payload of the target Ethernet data packet according to the header checksum and the target security identifier;
[0104] The first data updating unit is used to construct an Ethernet data payload according to the security attribute payload and the ciphertext payload, and to update a length field and a header checksum field of the target Ethernet data packet according to the Ethernet data payload.
[0105] In some specific embodiments, the data processing submodule specifically includes:
[0106] A second hash value determination unit is used to determine a target hash value of the target Ethernet data packet according to the data IP address, the data protocol, and the data transmission port of the target Ethernet data packet if data decryption processing is performed on the target Ethernet data packet according to the security identifier;
[0107] A payload decryption unit, configured to determine the preset session key corresponding to the target Ethernet data packet from the key chain table according to the target hash value, and decrypt the ciphertext payload of the target Ethernet data packet according to the preset session key to obtain target payload data;
[0108] A data comparison unit, configured to determine a first header checksum of the target payload data, and compare a second header checksum in the security attribute payload in the target Ethernet data packet;
[0109] The second data updating unit is configured to update the length field and the header checksum field of the target Ethernet data packet according to the target payload data if the first header checksum is equal to the second header checksum.
[0110] Furthermore, the present application also discloses an electronic device. Fig.10 This is a structural diagram of an electronic device 20 according to an exemplary embodiment. The content in the diagram cannot be regarded as any limitation on the scope of use of the present application.
[0111] Fig.10A schematic diagram of the structure of an electronic device 20 provided in an embodiment of the present application. The electronic device 20 may specifically include: at least one processor 21, at least one memory 22, a power supply 23, a communication interface 24, an input / output interface 25, and a communication bus 26. The memory 22 is used to store a computer program, which is loaded and executed by the processor 21 to implement the relevant steps in the data protection method disclosed in any of the aforementioned embodiments. In addition, the electronic device 20 in this embodiment may specifically be an electronic computer.
[0112] In this embodiment, the power supply 23 is used to provide working voltage for each hardware device on the electronic device 20; the communication interface 24 can create a data transmission channel between the electronic device 20 and the external device, and the communication protocol it follows is any communication protocol that can be applied to the technical solution of the present application, and is not specifically limited here; the input and output interface 25 is used to obtain external input data or output data to the outside world, and its specific interface type can be selected according to specific application needs and is not specifically limited here.
[0113] In addition, the memory 22, as a carrier for storing resources, can be a read-only memory, a random access memory, a disk or an optical disk, etc. The resources stored thereon can include an operating system 221, a computer program 222, etc., and the storage method can be temporary storage or permanent storage.
[0114] The operating system 221 is used to manage and control the hardware devices and computer programs 222 on the electronic device 20, which can be Windows Server, Netware, Unix, Linux, etc. In addition to including a computer program that can be used to complete the data protection method performed by the electronic device 20 disclosed in any of the aforementioned embodiments, the computer program 222 can further include a computer program that can be used to complete other specific tasks.
[0115] Furthermore, the present application also discloses a computer-readable storage medium for storing a computer program; wherein the computer program, when executed by a processor, implements the aforementioned disclosed data protection method. The specific steps of the method can refer to the corresponding contents disclosed in the aforementioned embodiments, and will not be repeated here.
[0116] In this specification, each embodiment is described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or 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.
[0117] 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.
[0118] The steps of the method or algorithm described in conjunction with the embodiments disclosed herein may be implemented directly using hardware, a software module executed by a processor, or a combination of the two. The software module may be placed in a random access memory (RAM), a memory, a read-only memory (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.
[0119] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the presence of other identical elements in the process, method, article or device including the elements.
[0120] The technical solution provided by the present application is introduced in detail above. Specific examples are used in this article to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method of the present application and its core idea. At the same time, for general technicians in this field, according to the idea of the present application, there will be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.
Claims
1. A data protection method, characterized in that: Applied to data protection equipment, including: The network interface of the data protection device is configured as a bridge mode, and an initial Ethernet data packet sent by a preset server is received through an input network port in the network interface; Processing the initial Ethernet data packet through the BROUTING chain and the PREROUTING chain in sequence, and determining the destination Ethernet address of the target Ethernet data packet obtained after the processing, so as to judge whether the target Ethernet data packet is a local data packet of the data protection device through the destination Ethernet address; If the target Ethernet data packet is not the local data packet, the target Ethernet data packet is transferred into the FORWARD chain, and data encryption or data decryption processing is performed on the target Ethernet data packet based on the preset security policy in the FORWARD chain; The processed target Ethernet data packet is forwarded to the output network port in the network interface through the FORWARD chain and the POSTING chain for output.
2. The data protection method according to claim 1, characterized in that: After determining whether the target Ethernet data packet is a local data packet of the data protection device through the destination Ethernet address, the method further includes: If the target Ethernet data packet is the local data packet, after the target Ethernet data packet is transmitted to the preset local data processing tool of the data protection device, the processed target Ethernet data packet is directly forwarded to the output network port in the network interface through the POSTING chain for output.
3. The data protection method according to claim 1 or 2, characterized in that: After the target Ethernet data packet is transferred into the FORWARD chain, the method further includes: Traversing each of the preset security policies in the FORWARD chain in turn to match the preset security policy with the target Ethernet data packet; If the preset security policy corresponding to the target Ethernet data packet is matched, the step of performing data encryption or data decryption processing on the target Ethernet data packet based on the preset security policy in the FORWARD chain is executed; If the preset security policy corresponding to the target Ethernet data packet is not matched, the target Ethernet data packet is processed according to the preset default processing policy in the FORWARD chain.
4. The data protection method according to claim 3, characterized in that: Before performing data encryption or data decryption processing on the target Ethernet data packet based on the preset security policy in the FORWARD chain, the method further includes: Determine a corresponding hash value according to the data IP address, data protocol, and data transmission port in the preset security policy, construct a key chain table based on the hash value and a preset session key, and store the key chain table in the Linux kernel layer of the data protection device; Accordingly, matching the preset security policy with the target Ethernet data packet includes: The preset security policy is matched with the target Ethernet data packet. If there is a preset security policy corresponding to the target Ethernet data, the data IP address, the data protocol, the data transmission port and the target Ethernet data packet corresponding to the preset security policy are matched in sequence, so as to perform data encryption or data decryption processing on the target Ethernet data packet after a successful match; wherein, if there is no corresponding data transmission port in the target Ethernet data packet, it is determined that the target Ethernet data packet and the data transmission port are matched successfully.
5. The data protection method according to claim 4, characterized in that: The step of performing data encryption or data decryption processing on the target Ethernet data packet includes: The security identifier of the security attribute payload at the end of the target Ethernet data packet is determined, and data encryption or data decryption processing is performed on the target Ethernet data packet according to the security identifier.
6. The data protection method according to claim 5, characterized in that: The step of performing data encryption or data decryption processing on the target Ethernet data packet according to the security identifier includes: If it is determined according to the security identifier that data encryption processing is performed on the target Ethernet data packet, a target hash value of the target Ethernet data packet is determined according to the data IP address, the data protocol, and the data transmission port of the target Ethernet data packet; Determine the preset session key corresponding to the target Ethernet data packet from the key chain table according to the target hash value, and encrypt the original payload data of the target Ethernet data packet according to the preset session key to obtain a ciphertext payload; Determine a header checksum of the target Ethernet data packet, save the header checksum to the data tail of the ciphertext payload, and set a target security identifier of the target Ethernet data packet according to a preset identifier setting rule, so as to construct a security attribute payload of the target Ethernet data packet according to the header checksum and the target security identifier; An Ethernet data payload is constructed according to the security attribute payload and the ciphertext payload, and a length field and a header checksum field of the target Ethernet data packet are updated according to the Ethernet data payload.
7. The data protection method according to claim 5, characterized in that: The step of performing data encryption or data decryption processing on the target Ethernet data packet according to the security identifier includes: If it is determined according to the security identifier that the target Ethernet data packet is to be decrypted, a target hash value of the target Ethernet data packet is determined according to the data IP address, the data protocol, and the data transmission port of the target Ethernet data packet; Determine the preset session key corresponding to the target Ethernet data packet from the key chain table according to the target hash value, and decrypt the ciphertext payload of the target Ethernet data packet according to the preset session key to obtain target payload data; Determining a first header checksum of the target payload data and comparing a second header checksum in the security attribute payload in the target Ethernet data packet; If the first header checksum is equal to the second header checksum, the length field and the header checksum field of the target Ethernet data packet are updated according to the target payload data.
8. A data protection device, characterized in that: Applied to data protection equipment, including: A data receiving module, used to configure the network interface of the data protection device to a bridge mode, and receive an initial Ethernet data packet sent by a preset server through an input network port in the network interface; A data judgment module, used for processing the initial Ethernet data packet through the BROUTING chain and the PREROUTING chain in sequence, and determining the destination Ethernet address of the target Ethernet data packet obtained after the processing, so as to judge whether the target Ethernet data packet is a local data packet of the data protection device through the destination Ethernet address; A data processing module, configured to transfer the target Ethernet data packet into a FORWARD chain if the target Ethernet data packet is not the local data packet, and perform data encryption or data decryption processing on the target Ethernet data packet based on a preset security policy in the FORWARD chain; The data output module is used to forward the processed target Ethernet data packet to the output network port in the network interface through the FORWARD chain and the POSTING chain for output.
9. An electronic device, characterized in that: The electronic device comprises a processor and a memory; wherein the memory is used to store a computer program, and the computer program is loaded and executed by the processor to implement the data protection method as described in any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that: Used to store a computer program, which, when executed by a processor, implements the data protection method according to any one of claims 1 to 7.
Citation Information
Cited By
Secure tunneling mechanism and data handling protocol for peer-to-peer decentralized networking
US12712861B1
