Method for fully automatically optimizing rule of'over-open permission 'in firewall by utilizing traffic log hit by rule of'over-open permission' of firewall

Through the fully automated traffic log collection and optimization process, the problem of low optimization efficiency of the 'open permission policy' rules in the firewall is solved, fast and accurate policy optimization and security management are achieved, and network security and operational efficiency are improved.

CN118869332APending Publication Date: 2024-10-29交通银行股份有限公司辽宁省分行
View PDF 0 Cites 2 Cited by

Patent Information

Application Number
CN202411142743.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-20
Publication Date
2024-10-29

AI Technical Summary

Technical Problem

In the existing technology, the optimization of the 'excessive open permission policy' rules in firewalls mainly relies on manual operations, resulting in high labor intensity, low efficiency, and poor accuracy. Moreover, due to time and cost reasons, many network managers failed to handle it in time, resulting in Security risks increase.

Method used

By collecting the traffic logs hit by the firewall's "excessive open permission policy" rule, extract key elements, merge and remove duplications, add network segment optimization, and generate reasonable firewall policy rule configuration files to achieve fully automatic optimization and distribution, reducing manual intervention.

Benefits of technology

It realizes the rapid and accurate optimization of the firewall's "excessive open permission policy" rules, shortens the processing time from hours to tens of seconds, reduces labor costs, and improves firewall operation and maintenance efficiency and network security management capabilities.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118869332A_ABST
    Figure CN118869332A_ABST
Patent Text Reader

Abstract

The invention relates to a method for fully automatically optimizing a'over-open permission 'rule in a firewall by utilizing a traffic log hit by the'over-open permission' rule of the firewall, which comprises the following steps of: setting a firewall traffic log acquisition period, extracting key elements, and optimizing a source address, a target address and a protocol port in the key elements, so as to realize the full-automatic optimization of the'over-open permission 'rule in the firewall. And the optimized strategy rule configuration is automatically issued to the firewall, and then the rule of the'open permission overlarge strategy 'in the firewall is deleted, so that the method for fully automatically optimizing the rule of the'open permission overlarge strategy' in the enterprise firewall is realized. Manual operation is replaced by an automatic program, manual participation is not needed in the whole process, the time and energy of operation and maintenance personnel are saved, and the working efficiency is improved. According to the method, the enterprise firewall can meet the fine management requirement and the protocol port minimum authorization principle, the difficulty and the pain point of firewall operation and maintenance in an enterprise are solved, the management capability of the enterprise on the firewall is improved, and the method is of great significance to the network security and operation management of the enterprise.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention relates to the field of computer networks, and is specifically a method for fully automatically optimizing a "policy for excessive open permissions" rule in a firewall by utilizing a traffic log of a firewall "policy for excessive open permissions" rule hit. Background Art

[0002] A firewall is a network security device that determines which network traffic can pass and which needs to be blocked or monitored by formulating rules. It effectively monitors any activities on the intranet and extranet and ensures the security of the internal network. With the development of corporate business, the number of corporate firewall policy rules has also increased. There is a high probability that there will be some non-compliant "open permission too large policy" rules. The "open permission too large policy" rule refers to the fact that in network security management, the policy rules or access control rules are set too broadly or loosely, and fail to effectively restrict access to network resources and systems. In this case, unauthorized users, devices or programs may obtain network resources that should not be accessed, thereby increasing the possibility of network systems being subject to security risks such as unauthorized access, malicious activities or data leakage. The "open permission too large policy" rule can be divided into any of the "open permission too large policy" rules of the source IP address, target IP address, and target protocol port, or a policy rule that is greater than any of these situations. The "open permission too large policy" rule in the firewall is a non-compliant firewall policy rule and is the focus of the audit department. Most methods to optimize the firewall "open permissions too large policy" rule are manual, which is time-consuming and inaccurate. Some network administrators even simply ignore it and let it exist. The long-term existence of the firewall "open permissions too large network policy" rule is very harmful. Enterprises may suffer network attacks and cause losses to the enterprise. Summary of the invention

[0003] The present invention creates a method for fully automatically optimizing the "open permission excessive strategy" rule in the firewall by utilizing the traffic log of the firewall "open permission excessive strategy" rule hit, thereby solving the technical problems existing in the prior art such as high manual labor intensity, low work efficiency and low accuracy performance.

[0004] The invention is realized by the following technical scheme: a method for fully automatically optimizing the firewall "open permission too large strategy" rule by using the traffic log of the firewall "open permission too large strategy" rule hit, and the steps are:

[0005] s1. Set the value of the single collection cycle of the traffic log hit by the firewall "Open Permission Excessive Strategy" rule λ TS , collect the total cycle value λ TT , the optimization rule value λ of the source IP address and the target IP address A、 λB、 λ C , first set the single acquisition cycle value λ TS The collected traffic logs that are hit by the firewall's "open permissions too large policy" rule are uploaded to the firewall policy optimization server, and then the collection cycle value λ is deleted. TS The traffic logs that are hit will be received again, and the traffic logs that are hit by the new "Open Permission Excessive Policy" rule will be received again.

[0006] s2. Extract the key elements of the traffic log hit by the firewall "open permissions too large policy" rule to form a new firewall policy rule record: each traffic log hit by a valid firewall policy rule represents a real network access record, and the extracted traffic log key elements are: 32-bit source IP address, source security zone, 32-bit target IP address, and target protocol port. First, the 4 key elements are combined into a record, and then duplicate records are removed. Then, a firewall policy rule name consisting of the current time plus a number is added to each non-duplicate record to form a complete firewall policy rule record. The 5 elements contained in the firewall policy rule record are: [policy name, source IP address, source security zone, target IP address, target protocol port].

[0007] s3. Optimize traffic log source IP address:

[0008] s3-1. Split out the 32-bit source IP address: Combine the "source security zone, 32-bit target IP address, and target protocol port" in the firewall policy rule record obtained in s2 into a "python programming language" string data type format: ["policy name a", "source IP address a", "source security zone a, target IP address a, target protocol port a"]; then group multiple firewall policy rule records according to the string composed of "source security zone, target IP address, and target protocol port", and combine one or more 32-bit source IP address elements in the group ..."]; Language" list data type format, only retain one policy name in the group and remove the repeated "source security zone, target IP address, target protocol port" string, add a subnet mask to each 32-bit source IP address to form a standard IP address format, and get a complete firewall policy rule data table: ["Policy name a", ["32-bit source IP address 1 + subnet mask, 32-bit source IP address 2 + subnet mask, ..., 32-bit source IP address m + subnet mask"], "Source security zone a, target IP address a, target protocol port a"], and name the data table "SRC_IP_A".

[0009] s3-2. Merge and deduplicate source IP addresses: Extract data from the database source IP address optimization strategy data table "SRC_IP_OPTI", add it to the data table "SRC_IP_A" to form the data table "SRC_IP_B", and operate the data table "SRC_IP_B" according to step s3-1 to form the data table "SRC_IP_C".

[0010] s3-3. Optimize the source IP address by adding a network segment:

[0011] s3-3-1. Preset source IP address to add network segment optimization value: Preset to add Class C network segment optimization rule value λ C , add the value λ of the Class B network segment optimization rule B , add the value λ of the Class A network segment optimization rule A The Class A network segment, Class B network segment, and Class C network segment are standard IP address classifications.

[0012] s3-3-2. Optimize the rationality and compliance of source IP addresses:

[0013] When there are K 32-bit source IP addresses with the same first 24 bits in the same packet in "SRC_IP_C", when K < λ C When the 32-bit source IP address is added to the network segment for optimization, the source IP address in the firewall policy rule record is the actual 32-bit source IP address.

[0014] When there are K 32-bit source IP addresses with the same first 24 bits in the same packet in "SRC_IP_C", when λ C ≤K<3λ C , add a Class C network segment with the same first 24 bits in the same group. If there are multiple 32-bit source IP addresses of Class K, add multiple Class C network segments with the same first 24 bits to form the data table "SRC_IP_D".

[0015] When there are L 32-bit source IP addresses with the same first 24 bits in the same packet in "SRC_IP_D", when 3λ C When ≤L, a Class B network segment with the same first 16 bits is added to the same group. If there are multiple 32-bit source IP addresses of Class L, multiple Class B network segments with the same first 16 bits are added to form the data table "SRC_IP_E".

[0016] When there are M Class C network segments with the same first 16 bits in the same group in "SRC_IP_E", when λ B ≤M, add a Class B network segment with the same first 16 bits in the same group. If there are multiple Class C network segments of M number, add multiple Class B network segments with the same first 16 bits to form the data table "SRC_IP_F".

[0017] When there are N number of Class B network segments with the same first 8 bits in the same group in "SRC_IP_F", when λ A ≤N, add a Class A network segment with the same first 8 bits in the same group. If there are multiple Class B network segments of N numbers, add multiple Class A network segments with the same first 8 bits to form the data table "SRC_IP_G".

[0018] s3-4. Deduplication and storage of source IP address inclusion relationships: Use the IP address calculation module to deduplicate and optimize the 32-bit source IP address and network segment inclusion relationships in the data table "SRC_IP_G". For example, if the data table contains 32-bit source IP addresses with the same first 24 bits and Class C network segments with the same first 24 bits, retain the Class C network segments and delete the 32-bit source IP addresses; the method for retaining Class B and Class A network segments is the same as the method for retaining Class C network segments; name the data table after deduplication of the inclusion relationship "SRC_IP_H", and update the database source IP address optimization strategy data table "SRC_IP_OPTI": first clear the source IP address optimization strategy data table "SRC_IP_OPTI" information in the database, and then write the data table "SRC_IP_H" information into the database source IP address optimization strategy data table "SRC_IP_OPTI".

[0019] s4. Optimize the traffic log target IP address; the method for optimizing the traffic log target IP address is the same as the method for optimizing the traffic log source IP address; update the database target IP address optimization strategy data table "DST_IP_OPTI" with the final data table.

[0020] s5. Optimize the traffic log target protocol port;

[0021] s5-1. Extract data from the database target IP address optimization strategy data table "DST_IP_OPTI", merge "source security zone, source IP address, target IP address" into a "python programming language" string data type format, and then group them according to the string composed of "source security zone, source IP address, target IP address", merge one or more target protocol ports in the group into a "python programming language" list data type format, and retain a policy name and remove repeated strings composed of "source security zone, source IP address, target IP address", and obtain the data table: ["Policy Name i", ["Target Protocol Port 1", "Target Protocol Port 2", ..., "Target Protocol Port j"], "Source Security Zone i, Source IP Address i / / Source IP Address i+1 / / ... / / Source IP Address i+j, Target IP Address i / / Target IP Address i+1 / / ... / / Target IP Address i+j"], and name the data table "PRO_PORT_A".

[0022] s5-2. Multiple protocol ports and multiple target IP address firewall policy rules in the split data table "PRO_PORT_A": when the value of the target protocol port optimization counter P is less than the total collection period value λ TT When the policy rules of multiple protocol ports in the data table "PRO_PORT_A" are split into multiple single-protocol port policy rules to form the data table "PRO_PORT_B"; then the multiple target IP address policy rules in the single-protocol port policy rules in the data table "PRO_PORT_B" are split into single-protocol port and single target IP address policy rules to form the data table "PRO_PORT_C"; the target protocol port optimization counter P has an initial value of 0, and the P value is accumulated once each time the optimization program is executed.

[0023] s5-3. Update the database source IP address optimization data table "SRC_IP_OPTI": first clear the database source IP address optimization data table "SRC_IP_OPTI", and rewrite the data table "PRO_PORT_C" into the database source IP address optimization data table "SRC_IP_OPTI"; delete the traffic log files hit by the "Open Permission Excessive Strategy" rule on the firewall policy optimization server hard disk.

[0024] s6. Re-execute the "Open permissions too large strategy" rule optimization program: re-obtain the traffic log that the "Open permissions too large strategy" rule hits; execute the "Open permissions too large strategy" rule optimization program again.

[0025] s7. Generate firewall policy rule configuration file, automatically log in to the firewall to send policy rule configuration: when the target protocol port optimization counter P is greater than the total collection cycle value λ TT When optimizing the target protocol port, the data table "PRO_PORT_A" data is obtained, and the firewall policy rule configuration file is automatically generated using the jinja2 module template language. The netmiko module is used to automatically log in to the firewall to issue policy rule records, delete the firewall "open permissions too large policy" rule records, and complete the automatic optimization of the firewall "open permissions too large policy" rule operation.

[0026] The beneficial effects of the invention are as follows: the invention obtains the real traffic log of the "open authority too large strategy" in the firewall, fully automatically and intelligently analyzes and optimizes the effective traffic log of the network firewall "open authority too large strategy" rule, and automatically generates reasonable and compliant firewall policy rule configuration and sends it to the firewall while ensuring the normal access of the original access business, and deletes the "open authority too large strategy" rule. The processing time of each fully automatic optimization of the "open authority too large strategy" rule is shortened from several hours of manual optimization to tens of seconds of automatic execution of the program, and the labor cost is almost 0, which realizes a major leap from manual optimization to full automatic optimization, and greatly improves the efficiency of firewall operation and maintenance. It solves the long-standing problem of non-compliance of firewall policy rules faced by enterprises, makes the configuration of enterprise firewall policy rules more reasonable and compliant, and improves the management ability of enterprises to firewalls. This is of great significance for enterprises to improve the level of network security protection and operation management efficiency, and has broad application prospects and commercial value. BRIEF DESCRIPTION OF THE DRAWINGS

[0027] Figure 1 Optimize the firewall "open permissions too large policy" rule diagram;

[0028] Figure 2 Optimize the program system network topology diagram for the firewall's "open permissions too large policy" rule;

[0029] Figure 3 Optimize the system database data table relationship diagram for the firewall "open permissions too large policy" rule;

[0030] Figure 4 Automatically optimize the flowchart for the firewall's "open permissions too large policy" rule. DETAILED DESCRIPTION

[0031] The following will be combined with the drawings in the embodiments of the invention to clearly and completely describe the technical solutions in the embodiments of the invention. Obviously, the described embodiments are only part of the embodiments of the invention, not all of them. Based on the embodiments in the invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the invention.

[0032] A method for fully automatically optimizing a firewall's "open permission too large policy" rule by using a traffic log of a firewall's "open permission too large policy" rule hit, the steps of which are:

[0033] s1. Set the value of the single collection cycle of the traffic log hit by the firewall "Open Permission Excessive Strategy" rule λ TS , collect the total cycle value λ TT, the optimization rule value λ of the source IP address and the target IP address A、 λ B、 λ C , first set the single acquisition cycle value λ TS The collected traffic logs that are hit by the firewall's "open permissions too large policy" rule are uploaded to the firewall policy optimization server, and then the collection cycle value λ is deleted. TS The traffic logs that are hit will be received again, and the traffic logs that are hit by the new "Open Permission Excessive Policy" rule will be received again.

[0034] s2. Extract the key elements of the traffic log hit by the firewall "open permissions too large policy" rule to form a new firewall policy rule record: each traffic log hit by a valid firewall policy rule represents a real network access record, and the extracted traffic log key elements are: 32-bit source IP address, source security zone, 32-bit target IP address, and target protocol port. First, the 4 key elements are combined into a record, and then duplicate records are removed. Then, a firewall policy rule name consisting of the current time plus a number is added to each non-duplicate record to form a complete firewall policy rule record. The 5 elements contained in the firewall policy rule record are: [policy name, source IP address, source security zone, target IP address, target protocol port].

[0035] s3. Optimize traffic log source IP address:

[0036] s3-1. Split out the 32-bit source IP address: Combine the "source security zone, target IP address, target protocol port" in the firewall policy rule record obtained in s2 into a "python programming language" string data type format: ["policy name a", "source IP address a", "source security zone a, target IP address a, target protocol port a"]; then group multiple firewall policy rule records according to the string composed of "source security zone, target IP address, target protocol port", and combine one or more 32-bit source IP address elements in the group into a "python programming language" "List data type format, only retain one policy name in the group and remove the repeated "source security zone, target IP address, target protocol port" string, add a subnet mask to each 32-bit source IP address to form a standard IP address format, and get a complete firewall policy rule data table: ["Policy name a", ["32-bit source IP address 1 + subnet mask, 32-bit source IP address 2 + subnet mask, ..., 32-bit source IP address m + subnet mask"], "Source security zone a, target IP address a, target protocol port a"], and name the data table "SRC_IP_A".

[0037] s3-2. Merge and deduplicate 32-bit source IP addresses: extract data from the database source IP address optimization strategy data table "SRC_IP_OPTI", add it to the data table "SRC_IP_A" to form the data table "SRC_IP_B", and operate the data table "SRC_IP_B" according to step s3-1 to form the data table "SRC_IP_C".

[0038] s3-3. Optimize the source IP address by adding a network segment:

[0039] s3-3-1. Preset source IP address to add network segment optimization value: Preset to add Class C network segment optimization rule value λ C , add the value λ of the Class B network segment optimization rule B , add the value λ of the Class A network segment optimization rule A The Class A network segment, Class B network segment, and Class C network segment are standard IP address classifications.

[0040] s3-3-2. Optimize the rationality and compliance of source IP addresses:

[0041] When there are K 32-bit source IP addresses with the same first 24 bits in the same packet in "SRC_IP_C", when K < λ C When the 32-bit source IP address is added to the network segment for optimization, the source IP address in the firewall policy rule record is the actual 32-bit source IP address.

[0042] When there are K 32-bit source IP addresses with the same first 24 bits in the same packet in "SRC_IP_C", when λ C ≤K<3λ C , add a Class C network segment with the same first 24 bits in the same group. If there are multiple 32-bit source IP addresses of Class K, add multiple Class C network segments with the same first 24 bits to form the data table "SRC_IP_D".

[0043] When there are L 32-bit source IP addresses with the same first 24 bits in the same packet in "SRC_IP_D", when 3λ C When ≤L, a Class B network segment with the same first 16 bits is added to the same group. If there are multiple 32-bit source IP addresses of Class L, multiple Class B network segments with the same first 16 bits are added to form the data table "SRC_IP_E".

[0044] When there are M Class C network segments with the same first 16 bits in the same group in "SRC_IP_E", when λ B ≤M, add a Class B network segment with the same first 16 bits in the same group. If there are multiple Class C network segments of M number, add multiple Class B network segments with the same first 16 bits to form the data table "SRC_IP_F".

[0045] When there are N number of Class B network segments with the same first 8 bits in the same group in "SRC_IP_F", when λ A ≤N, add a Class A network segment with the same first 8 bits in the same group. If there are multiple Class B network segments of N numbers, add multiple Class A network segments with the same first 8 bits to form the data table "SRC_IP_G".

[0046] s3-4. Deduplication and storage of source IP address inclusion relationships: Use the IP address calculation module to deduplicate and optimize the 32-bit source IP address and network segment inclusion relationships in the data table "SRC_IP_G". For example, if the data table contains 32-bit source IP addresses with the same first 24 bits and Class C network segments with the same first 24 bits, retain the Class C network segments and delete the 32-bit source IP addresses; the method for retaining Class B and Class A network segments is the same as the method for retaining Class C network segments; name the data table after deduplication of the inclusion relationship "SRC_IP_H", and update the database source IP address optimization strategy data table "SRC_IP_OPTI": first clear the source IP address optimization strategy data table "SRC_IP_OPTI" information in the database, and then write the data table "SRC_IP_H" information into the database source IP address optimization strategy data table "SRC_IP_OPTI".

[0047] s4. Optimize the traffic log target IP address; the method for optimizing the traffic log target IP address is the same as the method for optimizing the traffic log source IP address; update the database target IP address optimization strategy data table "DST_IP_OPTI" with the final data table.

[0048] s5. Optimize the traffic log target protocol port;

[0049] s5-1. Extract data from the database target IP address optimization strategy data table "DST_IP_OPTI", merge "source security zone, source IP address, target IP address" into a "python programming language" string data type format, and then group them according to the string composed of "source security zone, source IP address, target IP address", merge one or more target protocol ports in the group into a "python programming language" list data type format, and retain a policy name and remove repeated strings composed of "source security zone, source IP address, target IP address", and obtain the data table: ["Policy Name i", ["Target Protocol Port 1", "Target Protocol Port 2", ..., "Target Protocol Port j"], "Source Security Zone i, Source IP Address i / / Source IP Address i+1 / / ... / / Source IP Address i+j, Target IP Address i / / Target IP Address i+1 / / ... / / Target IP Address i+j"], and name the data table "PRO_PORT_A".

[0050] s5-2. Multiple protocol ports and multiple target IP address firewall policy rules in the split data table "PRO_PORT_A": when the value of the target protocol port optimization counter P is less than the total collection period value λ TT When the policy rules of multiple protocol ports in the data table "PRO_PORT_A" are split into multiple single-protocol port policy rules to form the data table "PRO_PORT_B"; then the multiple target IP address policy rules in the single-protocol port policy rules in the data table "PRO_PORT_B" are split into single-protocol port and single target IP address policy rules to form the data table "PRO_PORT_C"; the target protocol port optimization counter P has an initial value of 0, and the P value is accumulated once each time the optimization program is executed.

[0051] s5-3. Update the database source IP address optimization data table "SRC_IP_OPTI": first clear the database source IP address optimization data table "SRC_IP_OPTI", and rewrite the data table "PRO_PORT_C" into the database source IP address optimization data table "SRC_IP_OPTI"; delete the traffic log files hit by the "Open Permission Excessive Strategy" rule on the firewall policy optimization server hard disk.

[0052] s6. Re-execute the "Open permissions too large strategy" rule optimization program: re-obtain the traffic log that the "Open permissions too large strategy" rule hits; execute the "Open permissions too large strategy" rule optimization program again.

[0053] s7. Generate firewall policy rule configuration file, automatically log in to the firewall to send policy rule configuration: when the target protocol port optimization counter P is greater than the total collection cycle value λ TT When optimizing the protocol port, the data table "PRO_PORT_A" data is obtained, and the firewall policy rule configuration file is automatically generated using the jinja2 module template language. The netmiko module is used to automatically log in to the firewall to issue firewall policy rule records, delete the firewall "open permissions too large policy" rule records, and complete the automatic optimization of the firewall "open permissions too large policy" rule operation.

[0054] Embodiment 1:

[0055] 1. Determine the name of the "Open Permission Excessive Policy" rule to be optimized in the firewall, for example: 20230823_1720_1, and enable the policy rule logging function on the firewall. Configure the IP address of the syslog log server that receives the traffic log on the firewall.

[0056] 2. On the syslog log server, the python automation pyautogui module is used to control the log receiving and deleting operations. First, the single collection cycle value of the traffic log hit by the firewall "Open Permission Excessive Strategy" rule is set to λ TS = 168 hours, the total collection cycle value is 15 times, the source IP address and the target IP address add the network segment optimization rule value λ A =5,λ B =5,λ C =10.

[0057] 3. Enable the syslog log server service to automatically receive traffic logs sent by the firewall's "Open Permission Excessive Policy" rule.

[0058] 4. Receive traffic logs to reach the single collection cycle value λ TS =168 hours, the syslog server automatically stops receiving traffic logs, and uploads the traffic logs to the network policy optimization server hard disk via FTP. Then delete the single collection cycle value λ on the syslog server TS = Traffic log files generated by the node for 168 hours, and then restart the syslog log server service to receive new traffic logs again.

[0059] 5. When the network policy optimization server detects the traffic log file uploaded by the syslog log server, it first determines the traffic log file. When the file size no longer increases, it is considered that the traffic log file has been received. The network policy optimization server starts to execute the "Open Permission Excessive Policy" rule optimization program. When the protocol port optimization counter P = 0 times, and the P value is less than the total collection cycle value of 15 times, the traffic log file on the local hard disk is read. Each time the policy optimization program is executed, the P value is accumulated once.

[0060] 6. Each valid firewall traffic log represents a real network access record, including access time, 32-bit source IP address, source security zone, source port, 32-bit target IP address, target security zone, target protocol port, access hit rate and other elements. For example:

[0061] "Jun 05 16:43:37 192.22.9.84 2024-06-05 08:43:13F022-OA-001%%01SECLOG / 6 / SESSION_BUILT(l): IPVer=4, Protocol=tcp, SourceIP=192.22.22.113, DestinationIP=124.68.81.121, SourcePort=64023, DestinationPor t=9082, BeginTime=1717576994, EndTime=1717576994, SourceVpnID=0, DestinationVpnID=0, SourceZone=inside, DestinationZone=outside, PolicyName=YWACS_outside_131." The key elements of the traffic log are extracted, namely the 32-bit source IP address, the source security zone, the 32-bit destination IP address, and the destination protocol port. They are combined into a record, and then duplicate records are removed. Then, a firewall policy rule name automatically generated by adding a number to the current time is added to form a complete firewall policy rule record, which contains five elements. For example: ["202407191511_0", "192.22.22.113", "inside", "124.68.81.121", "tcp 9082"].

[0062] 7. Traffic log source IP address optimization, record the firewall policy rules, example: ["202407191511_0", "192.22.22.113", "inside", "124.68.81.121", "tcp 9082"], merge "source security zone, destination address, target protocol port" into a "python programming language" string data type format, example: ["202407191511_0", "192.22.22.113", "inside, 124.68.81.121, tcp 9082"], and then group them by the string consisting of "source security zone, destination address, and destination protocol port", merge the 32-bit source IP addresses in the group into a "python programming language" list data type format, retain one policy rule name in the group and remove the same string consisting of "source security zone, destination address, and destination protocol port", add the subnet mask to the 32-bit source IP address to form a standard IP address format, for example: ["202407191511_0", ["192.22.22.113 255.255.255.255", "192.22.22.118 255.255.255.255"], "inside, 124.68.81.121, tcp 9082"]. Name the data table after the 32-bit source IP addresses are merged "SRC_IP_A".

[0063] 8. Extract data from the database source IP address optimization strategy data table "SRC_IP_OPTI", add it to the data table "SRC_IP_A", form the data table "SRC_IP_B", and regroup the data table "SRC_IP_B" according to the string composed of "source security zone, destination address, target protocol port", merge the source IP address, and remove duplicate policy rule names to form the data table "SRC_IP_C". The data extracted from the data table "SRC_IP_OPTI" for the first time is null, which does not affect the execution of the optimization program.

[0064] 9. When there are K 32-bit source IP addresses with the same first 24 bits in the same packet in "SRC_IP_C", when K < λ C =10, the source IP address will not be optimized by adding network segments, and the source IP address in the firewall policy rule record is the actual 32-bit source IP address; when there are K 32-bit source IP addresses with the same first 24 bits in the same group in "SRC_IP_C", when λ C ≤K<3λ C=30, a Class C network segment with the same first 24 bits is added to the same group. If there are multiple K class 32-bit source IP addresses, multiple Class C network segments with the same first 24 bits are added to form the data table "SRC_IP_D"; example: ["202407191511_0", ["192.22.22.113 255.255.255.255", "192.22.22.118255.255.255.255", "192.22.22.0255.255.255.0"], "inside, 124.68.81.121, tcp 9082"]. When there are L 32-bit source IP addresses with the same first 24 bits in the same group in "SRC_IP_D", when 3λ C =30≤L, add a Class B network segment with the same first 16 bits in the same group. If there are multiple L-number of 32-bit source IP addresses of class, add multiple Class B network segments with the same first 16 bits to form the data table "SRC_IP_E"; example: ["202407191511_0", ["192.22.22.113 255.255.255.255", "192.22.22.118255.255.255.255", "192.22.22.0 255.255.255.0", "192.22.0.0255.255.0.0"], "inside, 124.68.81.121, tcp 9082"]. When there are M Class C network segments with the same first 16 bits in the same group in "SRC_IP_E", when λ B =5≤M, add a Class B network segment with the same first 16 bits in the same group. If there are multiple Class C network segments of M number, add multiple Class B network segments with the same first 16 bits to form the data table "SRC_IP_F"; example: ["202407191511_0", ["192.22.22.113 255.255.255.255", "192.22.22.118255.255.255.255", "192.22.22.0 255.255.255.0", "192.22.0.0255.255.0.0", "192.0.0.0 255.0.0.0"], "inside, 124.68.81.121, tcp 9082"]. When there are N number of Class B network segments with the same first 8 bits in the same group in "SRC_IP_F", when λ A=10≤N, add a Class A network segment with the same first 8 bits in the same group. If there are multiple Class B network segments of N numbers, add multiple Class A network segments with the same first 8 bits to form the data table "SRC_IP_G"; example: ["202407191511_0", ["192.0.0.0 255.0.0.0"], "inside, 124.68.81.121, tcp 9082"].

[0065] 10. Using the IP address calculation module, if the data table "SRC_IP_G" contains both a 32-bit source IP address with the same first 24 bits and a Class C network segment with the same first 24 bits, retain the Class C network segment and delete the 32-bit source IP address. The method for retaining Class B and Class A network segments is the same as the method for retaining Class C network segments. Name the data table after deduplication of the inclusion relationship "SRC_IP_H", for example: ["202407191511_0", ["192.0.0.0 255.0.0.0"], "inside, 124.68.81.121, tcp 9082"]. Clear the source IP address optimization strategy data table "SRC_IP_OPTI" in the database, and write the data table "SRC_IP_H" information into the source IP address optimization strategy data table "SRC_IP_OPTI" in the database to provide basic data for the next strategy optimization program.

[0066] 11. Extract the source IP address optimization strategy data table "SRC_IP_OPTI" from the database, and optimize the target IP address of the traffic log. The optimization method is the same as the source IP address optimization method. Finally, the data table "DST_IP_E" is obtained and written into the database target IP address optimization strategy data table "DST_IP_OPTI" to complete the traffic log target IP address optimization operation.

[0067] 12. Extract data from the database target IP address optimization strategy data table "DST_IP_OPTI". Combine the source security zone, source IP address, and target IP address into a "python programming language" string data type format. Example: ["202407191511_7", "tcp 443", "inside, 192.168.22.113255.255.255.255 / / 192.168.22.0 255.255.255.0, 172.68.81.121 255.255.255.255 / / 172.68.0.0255.255.0.0"], group by the string consisting of the source security zone, source IP address, and destination IP address, merge multiple (1) target protocol ports in the group into a "python programming language" list data type format, and remove redundant policy names and strings consisting of the same source security zone, source IP address, and destination IP address. Example: ["202407191511_7", ["tcp 80", "tcp 443"] "inside, 192.168.22.113255.255.255.255 / / 192.168.2.0 255.255.255.0, 172.68.81.121 The data table after the target protocol port is merged is named "PRO_PORT_A". The purpose of optimizing the target protocol port is to reduce the total number of firewall policy rules and facilitate the daily maintenance and management of the firewall.

[0068] 13. When the target protocol port optimization counter P value is less than 15 times of the total collection cycle, split the policy rules of multiple protocol ports in the data table "PRO_PORT_A" into multiple single protocol port policy rules to form the data table "PRO_PORT_B"; then split the multiple target IP address policy rules in the single protocol port policy rules in the data table "PRO_PORT_B" into single protocol port and single target IP address policy rules to form the data table "PRO_PORT_C"; clear the database data table "SRC_IP_OPTI" and rewrite the data table "PRO_PORT_C" into the database source IP address optimization policy data table "SRC_IP_OPTI" to provide basic data for the next policy optimization program. Then delete the traffic log file on the hard disk of the network policy optimization server. When the value of the next single collection cycle λ is obtained TS=When the traffic log file that hits the "open permission too large policy" rule uploaded in 168 hours is executed again, the "open permission too large policy" rule optimization program is executed again; according to the existing setting rule parameters, the fully automatic optimization firewall "open permission too large policy" rule program takes about 1 minute to execute once. If the same optimization operation is done manually, it will take at least 6 hours. The fully automatic optimization program improves work efficiency significantly.

[0069] 14. When the cumulative value of the target protocol port optimization counter P is greater than 15 times the total collection cycle value, the data table "PRO_PORT_A" data obtained by optimizing the protocol port will be used to automatically generate a firewall policy rule configuration file using the jinja2 module template language. The netmiko module will be used to automatically log in to the firewall to issue firewall policy rule records, delete the firewall "open permissions too large policy" rule records, and complete the automatic optimization of the firewall "open permissions too large policy" rule operation.

[0070] For security reasons, whether to delete the original "Open Permission Excessive Policy" rule or place the newly added firewall policy rule before the "Open Permission Excessive Policy" rule needs to be handled appropriately based on the traffic log data collection situation.

Claims

1. A method for fully automatically optimizing the "open permissions too large policy" rule in a firewall by using the traffic log of the firewall "open permissions too large policy" rule hit, characterized in that: The steps are: s1. Set the value of the single collection cycle of the traffic log hit by the firewall "Open Permission Excessive Strategy" rule λ TS , collect the total cycle value λ TT , the optimization rule value λ of the source IP address and the target IP address A、 λ B、 λ C , first set the single acquisition cycle value λ TS The collected traffic logs that are hit by the firewall "Open Permission Excessive Strategy" rule are uploaded to the firewall policy optimization server, and then the collection cycle value λ is deleted. TS Traffic logs that are hit, and traffic logs that are hit by the new "Open Permission Excessive Policy" rule are received again; s2. Extract the key elements of the traffic log hit by the firewall "open permission too large policy" rule to form a new firewall policy rule record: each traffic log hit by a valid firewall policy rule represents a real network access record, and the key elements of the traffic log are extracted as follows: 32-bit source IP address, source security zone, 32-bit target IP address, and target protocol port; first form a record with the four key elements, then remove duplicate records, and then add a firewall policy rule name consisting of the current time plus a number to each non-duplicate record to form a complete firewall policy rule record. The five elements contained in the firewall policy rule record are: [policy name, source IP address, source security zone, target IP address, target protocol port]; s3. Optimize traffic log source IP address: s3-1. Split out the 32-bit source IP address: merge the "source security zone, 32-bit target IP address, and target protocol port" in the firewall policy rule record obtained in s2 into a "python programming language" string data type format: ["policy name a", "source IP address a", "source security zone a, target IP address a, target protocol port a"]; then group multiple firewall policy rule records according to the string composed of "source security zone, target IP address, and target protocol port", and merge one or more 32-bit source IP address elements in the group ..."]; then group multiple firewall policy rule records according to the string composed of "source security zone, target IP address, and target protocol port", and merge one or more 32-bit source IP address elements in the group into a "python programming language" string data type format: ["policy name a", "source IP address a", "source security zone a, target IP address a, target protocol port"]; Language" list data type format, only retain one policy name in the group and remove the repeated "source security zone, target IP address, target protocol port" string, add a subnet mask to each 32-bit source IP address to form a standard IP address format, and get a complete firewall policy rule data table: ["Policy name a", ["32-bit source IP address 1 + subnet mask, 32-bit source IP address 2 + subnet mask, ..., 32-bit source IP address m + subnet mask"], "source security zone a, target IP address a, target protocol port a"], name the data table "SRC_IP_A"; s3-2. Merge and deduplicate source IP addresses: extract data from the database source IP address optimization strategy data table "SRC_IP_OPTI", add it to the data table "SRC_IP_A" to form the data table "SRC_IP_B", and operate the data table "SRC_IP_B" according to step s3-1 to form the data table "SRC_IP_C"; s3-3. Optimize the source IP address by adding a network segment: s3-3-1. Preset source IP address to add network segment optimization value: Preset to add Class C network segment optimization rule value λ C , add the value λ of the Class B network segment optimization rule B , add the value λ of the Class A network segment optimization rule A , the Class A network segment, Class B network segment, and Class C network segment are standard IP address classifications; s3-3-2. Optimize the rationality and compliance of source IP addresses: When there are K 32-bit source IP addresses with the same first 24 bits in the same packet in "SRC_IP_C", when K<λ C When the 32-bit source IP address is added to the network segment, the source IP address in the firewall policy rule record is the actual 32-bit source IP address; When there are K 32-bit source IP addresses with the same first 24 bits in the same packet in "SRC_IP_C", when λ C ≤K<3λ C , add a Class C network segment with the same first 24 bits in the same group. If there are multiple 32-bit source IP addresses of Class K, add multiple Class C network segments with the same first 24 bits to form the data table "SRC_IP_D"; When there are L 32-bit source IP addresses with the same first 24 bits in the same packet in "SRC_IP_D", when 3λ C ≤L, add a Class B network segment with the same first 16 bits in the same group. If there are multiple Class L 32-bit source IP addresses, add multiple Class B network segments with the same first 16 bits to form the data table "SRC_IP_E"; When there are M Class C network segments with the same first 16 bits in the same group in "SRC_IP_E", when λ B ≤M, add a Class B network segment with the same first 16 bits in the same group. If there are multiple Class C network segments of M number, add multiple Class B network segments with the same first 16 bits to form the data table "SRC_IP_F"; When there are N number of Class B network segments with the same first 8 bits in the same group in "SRC_IP_F", when λ A ≤N, add a Class A network segment with the same first 8 bits in the same group. If there are multiple Class B network segments of N numbers, add multiple Class A network segments with the same first 8 bits to form the data table "SRC_IP_G"; s3-4. Deduplication and storage of source IP address inclusion relations: Use the IP address calculation module to deduplicate and optimize the 32-bit source IP address and network segment inclusion relations in the data table "SRC_IP_G". For example, if the data table contains 32-bit source IP addresses with the same first 24 bits and Class C network segments with the same first 24 bits, retain the Class C network segments and delete the 32-bit source IP addresses; the method for retaining Class B and Class A network segments is the same as the method for retaining Class C network segments; name the data table after deduplication of the inclusion relations "SRC_IP_H", and update the database source IP address optimization strategy data table "SRC_IP_OPTI": first clear the source IP address optimization strategy data table "SRC_IP_OPTI" in the database, and then write the data table "SRC_IP_H" information into the database source IP address optimization strategy data table "SRC_IP_OPTI"; s4. Optimize traffic log target IP address; s5. Optimize the traffic log target protocol port; s6. Re-execute the "Open Permission Excessive Strategy" rule optimization procedure: re-obtain the traffic logs hit by the "Open Permission Excessive Strategy" rule; re-execute the "Open Permission Excessive Strategy" rule optimization procedure; s7. Generate firewall policy rule configuration file, automatically log in to the firewall to send policy rule configuration: when the target protocol port optimization counter P is greater than the total collection cycle value λ TT When optimizing the target protocol port, the data table "PRO_PORT_A" data is obtained, and the firewall policy rule configuration file is automatically generated using the jinja2 module template language. The netmiko module is used to automatically log in to the firewall to issue firewall policy rule records, delete the firewall "open permissions too large policy" rule records, and complete the automatic optimization of the firewall "open permissions too large policy" rule operation.

2. According to claim 1, a method for fully automatically optimizing the "open permissions too large strategy" rule in the firewall by using the traffic log of the firewall "open permissions too large strategy" rule hit, characterized in that: The method for optimizing the traffic log target IP address is the same as the method for optimizing the traffic log source IP address; the finally obtained data table updates the database target IP address optimization strategy data table "DST_IP_OPTI".

3. According to claim 1, a method for fully automatically optimizing the "open permission too large strategy" rule in the firewall by using the traffic log of the firewall "open permission too large strategy" rule hit, characterized in that: The s5 specific method is: s5-1. Extract data from the database target IP address optimization strategy data table "DST_IP_OPTI", merge "source security zone, source IP address, target IP address" into a "python programming language" string data type format, and then group them according to the string composed of "source security zone, source IP address, target IP address", merge one or more target protocol ports in the group into a "python programming language" list data type format, and retain a policy name and remove duplicate "source security zone, source IP address, target IP address" composed of strings to obtain the data table: ["Policy Name i", ["Target Protocol Port 1", "Target Protocol Port 2", ..., "Target Protocol Port j"], "Source Security Zone i, Source IP Address i / / Source IP Address i+1 / / ... / / Source IP Address i+j, Target IP Address i / / Target IP Address i+1 / / ... / / Target IP Address i+j"], name the data table "PRO_PORT_A"; s5-2. Multiple protocol ports and multiple target IP address firewall policy rules in the split data table "PRO_PORT_A": when the value of the target protocol port optimization counter P is less than the total collection period value λ TT When the policy rules of multiple protocol ports in the data table "PRO_PORT_A" are split into multiple single-protocol port policy rules to form the data table "PRO_PORT_B"; then the multiple target IP address policy rules in the single-protocol port policy rules in the data table "PRO_PORT_B" are split into single-protocol port and single target IP address policy rules to form the data table "PRO_PORT_C"; the target protocol port optimization counter P has an initial value of 0, and the value of P is accumulated once each time the optimization program is executed; s5-3. Update the database source IP address optimization data table "SRC_IP_OPTI": first clear the database source IP address optimization data table "SRC_IP_OPTI", and rewrite the data table "PRO_PORT_C" into the database source IP address optimization data table "SRC_IP_OPTI"; delete the traffic log files hit by the "Open Permission Excessive Strategy" rule on the firewall policy optimization server hard disk.

Citation Information

Cited By

  • Network policy optimization method and apparatus, and electronic device

    CN119728430A

  • Safety test method and system based on iptables

    CN119814347A