A communication method and device based on dynamic port technology

By judging and processing OPC dynamic port information in the industrial firewall, creating dynamic port sessions and extending the idle delay, the problem of session destruction of the OPC protocol after being idle for a long time is solved, and the communication reliability of the OPC protocol through the firewall is improved.

CN114422239BActive Publication Date: 2024-08-27INSECTECH BEIJING CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202210056908.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-01-18
Publication Date
2024-08-27
Estimated Expiration
2042-01-18

AI Technical Summary

Technical Problem

Industrial firewalls cannot effectively implement access control to the OPC protocol through simple configuration of port policies, causing the OPC protocol session to be automatically destroyed after being idle for a long time, affecting communication reliability.

Method used

By determining whether the session request received by the TCP-135 port includes OPC dynamic port information, obtain and create a dynamic port session, and bind a delay function according to the destination IP address and operation content of the session request to extend the idle delay and prevent the session from automatically destroy.

Benefits of technology

It improves the reliability of OPC protocol communication across firewalls, ensuring that dynamic port sessions are not automatically destroyed during long-interval write operations, ensuring business continuity.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114422239B
    Figure CN114422239B
Patent Text Reader

Abstract

The embodiments of the present application provide a communication method and device based on dynamic port technology. The method includes determining whether the session request received by the TCP‑135 port includes OPC dynamic port information; if so, obtaining the OPC dynamic port information in the session request; creating a dynamic port session according to the OPC dynamic port information; binding a preset delay function to the dynamic port session, and determining the idle delay duration of the dynamic port session according to the OPC dynamic port information and the delay function. In this way, the firewall can perform port-level access control on the OPC protocol, and can also determine the idle delay duration of the dynamic port session according to the destination IP address of the session request and the operation content of the session request. When the operation content of the session request is special, the idle delay duration of the dynamic port session can be extended to improve the reliability of the OPC protocol communication through the firewall.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and more specifically, to a communication method and device based on dynamic port technology. Background Art

[0002] To ensure the security of industrial networks, more and more industrial firewalls are introduced into industrial systems. Firewalls are usually required to configure port-level access control policies to ensure basic communication security. The OPC industrial protocol uses dynamic ports and negotiates the communication interface of subsequent services through TCP port 135. The negotiated communication interface is random, so the firewall cannot achieve access control of the OPC protocol by simply configuring port policies. It must use dynamic port technology to achieve OPC protocol communication.

[0003] Currently, most industrial firewalls are state-based firewalls. Stateful firewalls maintain a session state for each communication connection, and each session state has a preset idle time. After a session is idle (no data exchange between the two parties) for a certain period of time, the stateful firewall will automatically destroy the session, and subsequent network messages belonging to the session will not be able to pass through the firewall. For the OPC protocol, such as a write operation, after a write operation, it may be idle for a long time before the next write operation. After the idle time exceeds the preset idle time, the stateful firewall will destroy the session, resulting in the inability to perform subsequent write operations, thereby affecting normal business. Summary of the invention

[0004] According to an embodiment of the present application, a communication solution based on dynamic port technology is provided.

[0005] In a first aspect of the present application, a communication method based on dynamic port technology is provided. The method comprises:

[0006] Determine whether the session request received by TCP-135 port includes OPC dynamic port information;

[0007] If yes, obtaining the OPC dynamic port information in the session request;

[0008] Creating a dynamic port session according to the OPC dynamic port information;

[0009] A preset delay function is bound to the dynamic port session, and the idle delay duration of the dynamic port session is determined according to the OPC dynamic port information and the delay function.

[0010] In a possible implementation, the dynamic port information includes a destination IP address and a destination TCP port number of the session request.

[0011] In a possible implementation, determining the idle delay duration of the dynamic port session according to the OPC dynamic port information and the delay function includes:

[0012] The idle delay duration of the dynamic port session is determined according to the IP address of the session request initiator and a preset hash table.

[0013] In a possible implementation, after determining the idle delay time of the dynamic port session according to the IP address of the session request initiator and a preset hash table, the method further includes:

[0014] A ctnl_timeout structure is created and bound to the ctnl_timeout structure and the dynamic port session. The ctnl_timeout structure is used to set the idle delay duration.

[0015] In a possible implementation manner, before determining the idle delay duration of the dynamic port session according to the OPC dynamic port information and the delay function, the method further includes:

[0016] Extracting a data message from the session request;

[0017] Determining whether the data message is a write operation;

[0018] If yes, the idle delay duration of the dynamic port session is determined according to the OPC dynamic port information and the delay function.

[0019] In a possible implementation manner, after determining whether the data message is a write operation, the method further includes:

[0020] If not, the session request is released.

[0021] In a possible implementation, after determining whether the session request received by the TCP-135 port includes the OPC dynamic port information, the method further includes:

[0022] If not, the session request is released.

[0023] In a second aspect of the present application, a communication device based on dynamic port technology is provided. The device comprises:

[0024] A first judging unit is used to judge whether the session request received by the TCP-135 port includes OPC dynamic port information;

[0025] an acquiring unit, configured to acquire the OPC dynamic port information in the session request when the session request includes the OPC dynamic port information;

[0026] A creating unit, used for creating a dynamic port session according to the OPC dynamic port information;

[0027] A binding unit is used to bind a preset delay function to the dynamic port session, and determine the idle delay duration of the dynamic port session according to the OPC dynamic port information and the delay function.

[0028] In a third aspect of the present application, an electronic device is provided, which includes a memory and a processor, wherein a computer program is stored in the memory, and when the processor executes the program, the method described above is implemented.

[0029] In a fourth aspect of the present application, a computer-readable storage medium is provided, on which a computer program is stored, and when the program is executed by a processor, the method according to the first aspect of the present application is implemented.

[0030] The present application provides a communication method based on dynamic port technology. After receiving a session request for TCP-135 port, the dynamic port information can be parsed according to the OPC protocol and a dynamic port session can be created, so that the firewall can perform port-level access control on the OPC protocol, and the idle delay duration of the dynamic port session can be determined according to the destination IP address of the session request and the operation content of the session request. When the operation content of the session request is a special operation, such as a write operation, the idle delay duration of the dynamic port session can be extended, so that when the interval between two write operations is long, the dynamic port session will not be automatically destroyed, thereby improving the reliability of OPC protocol communication through the firewall.

[0031] It should be understood that the contents described in the Summary of the Invention are not intended to limit the key or important features of the embodiments of the present application, nor are they intended to limit the scope of the present application. Other features of the present application will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS

[0032] The above and other features, advantages and aspects of the embodiments of the present application will become more apparent with reference to the following detailed description in conjunction with the accompanying drawings. In the accompanying drawings, the same or similar reference numerals represent the same or similar elements, wherein:

[0033] Figure 1 A flow chart of a communication method based on dynamic port technology according to an embodiment of the present application is shown;

[0034] Figure 2 A block diagram of a communication device based on dynamic port technology according to an embodiment of the present application is shown;

[0035] Figure 3 A schematic diagram of the structure of a terminal device or a server suitable for implementing an embodiment of the present application is shown. DETAILED DESCRIPTION

[0036] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0037] All terms (including technical terms or scientific terms) used in this application have the same meaning as those understood by ordinary technicians in the field to which this application belongs, unless otherwise specifically defined. It should also be understood that terms defined in general dictionaries should be interpreted as having a meaning consistent with their meaning in the context of the relevant technology, and should not be interpreted in an idealized or extremely formal sense, unless explicitly defined herein.

[0038] Technologies, methods, and equipment known to ordinary technicians in the relevant art may not be discussed in detail, but where appropriate, the technologies, methods, and equipment should be considered as part of the specification.

[0039] To ensure the security of industrial networks, more and more industrial firewalls are introduced into industrial systems. Firewalls are usually required to configure port-level access control policies to ensure basic communication security. The OPC industrial protocol uses dynamic ports and negotiates the communication interface of subsequent services through TCP port 135. The negotiated communication interface is random, so the firewall cannot achieve access control of the OPC protocol by simply configuring port policies. It must use dynamic port technology to achieve OPC protocol communication.

[0040] Currently, most industrial firewalls are state-based firewalls. Stateful firewalls maintain a session state for each communication connection, and each session state has a preset idle time. After a session is idle (no data exchange between the two parties) for a certain period of time, the stateful firewall will automatically destroy the session, and subsequent network messages belonging to the session will not be able to pass through the firewall. For the OPC protocol, such as a write operation, after a write operation, it may be idle for a long time before the next write operation. After the idle time exceeds the preset idle time, the stateful firewall will destroy the session, resulting in the inability to perform subsequent write operations, thereby affecting normal business.

[0041] In the present application, a communication method based on dynamic port technology is disclosed, which determines whether the session request received by the TCP-135 port includes OPC dynamic port information; if so, obtains the OPC dynamic port information in the session request, and the OPC dynamic information includes the destination IP address and the destination TCP port number of the session request; then creates a dynamic port session according to the OPC dynamic port information, binds a preset delay function to the dynamic port session, and determines the idle delay duration of the dynamic port session according to the OPC dynamic port information and the delay function. The present application can determine the idle delay duration of the dynamic port session according to the destination IP address of the session request and the operation content of the session request. When the operation content of the session request is a special operation, such as a write operation, the idle delay duration of the dynamic port session can be extended, so that when the interval between two write operations is long, the dynamic port session will not be automatically destroyed, thereby improving the reliability of OPC protocol communication through firewalls.

[0042] Figure 1 A flow chart of a communication method based on dynamic port technology according to an embodiment of the present application is shown. The method can be executed by an electronic device, and the method includes:

[0043] Step S100: Determine whether the session request received by the TCP-135 port includes OPC dynamic port information.

[0044] This application can be based on the Linux kernel netfilter framework, and implement the functions of OPC dynamic port and delay function in kernel module mode. Among them, the OPC dynamic port kernel module is bound to TCP-135 port through the netfilter dynamic port registration mechanism.

[0045] After the system starts, the OPC dynamic port kernel module is automatically loaded and bound to the TCP-135 port. Then the firewall release policy is configured, which can be to configure only the TCP-135 port to be released and all other ports to be blocked.

[0046] After receiving the session request at the TCP-135 port, the OPC protocol may be determined first, and then it may be determined whether the session request includes the OPC dynamic port information, if not, the session request is released. If yes, step S200 is executed.

[0047] Step S200: Obtain OPC dynamic port information in the session request.

[0048] Step S300: creating a dynamic port session according to the OPC dynamic port information;

[0049] Step S400: Bind a preset delay function to the dynamic port session, and determine the idle delay duration of the dynamic port session according to the OPC dynamic port information and the delay function.

[0050] In the embodiment of the present application, the OPC dynamic port information includes the destination IP address and the destination TCP port number of the session request. The method of creating a dynamic port session according to the OPC dynamic port information can be to create the kernel data structure nf_conntrack_expect of the dynamic port session through the OPC dynamic port kernel module API: nf_ct_expect_alloc, and then assign the delay function to the helper field in nf_conntrack_expect to realize the dynamic binding of the delay function and the dynamic port session. Finally, the dynamic port session data nf_conntrack_expect is registered to the OPC dynamic port kernel module through the OPC dynamic port kernel module API: nf_ct_expect_related.

[0051] After the delay function and the dynamic port session are bound, the datagram in the session request is extracted, and the OPC business operation contained in the datagram is determined, and the OPC business operation is matched with the OPC business operation in the database. If the match fails, the session request is released; if the match succeeds, the destination IP address of the session request is used as the key to query the idle delay duration matching the IP address in the hash table, and the idle delay duration is bound to the current dynamic port session. Specifically, a ctnl_timeout structure can be created and the ctnl_timeout structure and the current dynamic port session are bound. The ctnl_timeout structure can set the idle delay duration. Of course, the idle delay duration needs to be set based on the result of the query from the hash table.

[0052] The hash table can be an OPC host-idle delay comparison table. The correspondence between the OPC host and the idle delay can be set by a technician in this field based on experience or calculated based on big data, which is not limited here. The idle delay time must be greater than the idle time of a general dynamic port to meet the stable communication requirements of some special OPC business operations.

[0053] The present application discloses a communication method based on dynamic port technology. By parsing OPC port information and creating dynamic port sessions, it is possible to perform port-level access control on the OPC protocol. At the same time, idle time delay settings are set for specific OPC business operations, thereby reducing the impact on specific OPC business operations due to automatic destruction of dynamic port sessions and improving the reliability of OPC protocol communications through firewalls.

[0054] It should be noted that, for the aforementioned method embodiments, for the sake of simplicity, they are all expressed as a series of action combinations, but those skilled in the art should be aware that the present application is not limited by the described order of actions, because according to the present application, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all optional embodiments, and the actions and modules involved are not necessarily required by the present application.

[0055] The above is an introduction to the method embodiment. The following is a further explanation of the scheme described in this application through an apparatus embodiment.

[0056] Figure 2 A block diagram of a communication device based on dynamic port technology according to an embodiment of the present application is shown. The device includes:

[0057] The first judging unit 201 is used to judge whether the session request received by the TCP-135 port includes OPC dynamic port information;

[0058] The acquiring unit 202 is configured to acquire the OPC dynamic port information in the session request when the session request includes the OPC dynamic port information;

[0059] A creating unit 203, configured to create a dynamic port session according to the OPC dynamic port information;

[0060] The binding unit 204 is used to bind a preset delay function to the dynamic port session, and determine the idle delay duration of the dynamic port session according to the OPC dynamic port information and the delay function.

[0061] In a possible implementation, the dynamic port information includes a destination IP address and a destination TCP port number of the session request.

[0062] In a possible implementation, determining the idle delay duration of the dynamic port session according to the OPC dynamic port information and the delay function includes:

[0063] The idle delay duration of the dynamic port session is determined according to the IP address of the session request initiator and a preset hash table.

[0064] In a possible implementation, the method further includes a setting unit:

[0065] The setting unit is used to create a ctnl_timeout structure and bind the ctnl_timeout structure and the dynamic port session. The ctnl_timeout structure is used to set the idle delay time.

[0066] In one possible implementation, it also includes:

[0067] An extraction unit, configured to extract a data message in the session request before determining the idle delay duration of the dynamic port session according to the OPC dynamic port information and the delay function;

[0068] A second judging unit, used to judge whether the data message is a write operation;

[0069] The binding unit is used to determine the idle delay time length of the dynamic port session according to the OPC dynamic port information and the delay function when judging that the data message is a write operation.

[0070] In a possible implementation, the method further includes a release unit, configured to release the session request after the data message is a non-write operation.

[0071] It is also used to release the session request when it is determined that the session request received by the TCP-135 port does not include the OPC dynamic port information.

[0072] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process of the described module can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here.

[0073] Figure 3 A schematic diagram of the structure of an electronic device suitable for implementing the embodiments of the present application is shown.

[0074] like Figure 3 As shown, the electronic device includes a central processing unit (CPU) 301, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 302 or a program loaded from a storage part 308 into a random access memory (RAM) 303. In the RAM 303, various programs and data required for the operation of the system 300 are also stored. The CPU 301, the ROM 302, and the RAM 303 are connected to each other via a bus 304. An input / output (I / O) interface 305 is also connected to the bus 304.

[0075] The following components are connected to the I / O interface 305: an input section 306 including a keyboard, a mouse, etc.; an output section 307 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 308 including a hard disk, etc.; and a communication section 309 including a network interface card such as a LAN card, a modem, etc. The communication section 309 performs communication processing via a network such as the Internet. A drive 310 is also connected to the I / O interface 305 as needed. A removable medium 311, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 310 as needed, so that a computer program read therefrom is installed into the storage section 308 as needed.

[0076] In particular, according to an embodiment of the present application, the above reference flow chart Figure 1 The described process can be implemented as a computer software program. For example, an embodiment of the present application includes a computer program product, which includes a computer program carried on a machine-readable medium, and the computer program contains program code for executing the method shown in the flow chart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication part 309, and / or installed from the removable medium 311. When the computer program is executed by the central processing unit (CPU) 301, the above-mentioned functions defined in the system of the present application are executed.

[0077] It should be noted that the computer-readable medium shown in the present application may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer 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 of the above. In the present application, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, device or device. In the present application, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, which carries a computer-readable program code. This propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than computer-readable storage media, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer-readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, optical cable, RF, etc., or any suitable combination of the above.

[0078] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present application. In this regard, each box in the flow chart or block diagram can represent a module, a program segment or a part of the code, and the aforementioned module, program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or flow chart, and the combination of the boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs the specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0079] The units or modules involved in the embodiments described in the present application may be implemented by software or by hardware. The units or modules described may also be arranged in a processor, for example, they may be described as: a processor includes an acquisition unit, a creation unit, and a binding unit. The names of these units or modules do not constitute a limitation on the units or modules themselves in certain circumstances. For example, the acquisition unit may also be described as "a unit for acquiring OPC dynamic port information in the session request when the session request includes OPC dynamic port information".

[0080] As another aspect, the present application further provides a computer-readable storage medium, which may be included in the electronic device described in the above embodiment; or may exist independently without being assembled into the electronic device. The above computer-readable storage medium stores one or more programs, and when the above programs are used by one or more processors to execute a communication method based on dynamic port technology described in the present application.

[0081] The above description is only a preferred embodiment of the present application and an explanation of the technical principles used. Those skilled in the art should understand that the scope of application involved in the present application is not limited to the technical solution formed by a specific combination of the above technical features, but should also cover other technical solutions formed by any combination of the above technical features or their equivalent features without departing from the aforementioned application concept. For example, the above features are replaced with (but not limited to) technical features with similar functions applied in the present application.

Claims

1. A communication method based on dynamic port technology, characterized in that: include: Determine whether the session request received by TCP-135 port includes OPC dynamic port information; If yes, obtaining the OPC dynamic port information in the session request; Creating a dynamic port session according to the OPC dynamic port information; Bind a preset delay function to the dynamic port session, and determine the idle delay duration of the dynamic port session according to the OPC dynamic port information and the delay function, Determining the idle delay duration of the dynamic port session according to the OPC dynamic port information and the delay function comprises: The idle delay duration of the dynamic port session is determined according to the IP address of the session request initiator and a preset hash table.

2. A communication method based on dynamic port technology according to claim 1, characterized in that: The dynamic port information includes the destination IP address and destination TCP port number of the session request.

3. A communication method based on dynamic port technology according to claim 1, characterized in that: After determining the idle delay duration of the dynamic port session according to the IP address of the session request initiator and a preset hash table, the method further includes: A ctnl_timeout structure is created and bound to the ctnl_timeout structure and the dynamic port session. The ctnl_timeout structure is used to set the idle delay duration.

4. A communication method based on dynamic port technology according to claim 1, characterized in that: Before determining the idle delay duration of the dynamic port session according to the OPC dynamic port information and the delay function, the method further includes: Extracting a data message from the session request; Determining whether the data message is a write operation; If yes, the idle delay duration of the dynamic port session is determined according to the OPC dynamic port information and the delay function.

5. A communication method based on dynamic port technology according to claim 4, characterized in that: After determining whether the data message is a write operation, the method further includes: If not, the session request is released.

6. A communication method based on dynamic port technology according to claim 1, characterized in that: After determining whether the session request received by the TCP-135 port includes the OPC dynamic port information, the method further includes: If not, the session request is released.

7. A communication device based on dynamic port technology, characterized in that: include: A first judging unit (201) is used to judge whether the session request received by the TCP-135 port includes OPC dynamic port information; An acquiring unit (202) is used to acquire the OPC dynamic port information in the session request when the session request includes the OPC dynamic port information; A creating unit (203), configured to create a dynamic port session according to the OPC dynamic port information; A binding unit (204) is used to bind a preset delay function to the dynamic port session, and determine the idle delay duration of the dynamic port session according to the OPC dynamic port information and the delay function. Determining the idle delay duration of the dynamic port session according to the OPC dynamic port information and the delay function comprises: The idle delay duration of the dynamic port session is determined according to the IP address of the session request initiator and a preset hash table.

8. An electronic device comprising a memory and a processor, wherein a computer program is stored in the memory, wherein: When the processor executes the program, the method according to any one of claims 1 to 6 is implemented.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method according to any one of claims 1 to 6 is implemented.