A method for calculating security policy granularity
By connecting to the firewall and calculating the policy granularity, the problem of missing granularity evaluation in firewall policy management is solved, and the rationality and flexibility of policy configuration is improved, ensuring the strictness and adaptability of the policy.
Patent Information
- Application Number
- CN202210206720.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-03-04
- Publication Date
- 2024-12-03
- Estimated Expiration
- 2042-03-04
AI Technical Summary
The existing firewall policy management products fail to effectively evaluate the granularity of the policy, resulting in confusion in policy configuration, lack of rationality and flexibility, and the inability to fully play the security role of the policy.
Provide a security policy granularity calculation method. By connecting firewalls of different brands, obtaining and correlating resources and policy data, and dividing the policy granularity into 5 levels based on the definition scope and protocol information of the policy elements, and calculating the policy's granularity through the algorithm. Granularity, implemented using JAVA language, and stored and managed by mysql database.
Accurate granularity evaluation of firewall policies is achieved, the rationality and flexibility of policy configuration is improved, and operation and maintenance personnel are helped to optimize policy configuration and ensure policy strictness and adaptability.
Smart Images

Figure CN114465809B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a method for calculating security policy granularity. Background Art
[0002] The firewall system is the most important device to ensure network security. It is usually deployed at the network boundary and regional boundary. In a small network, only one firewall is deployed at the network boundary. In a large network, firewalls are usually deployed at multiple network boundaries, multiple regional boundaries, and multiple business system boundaries. The firewall's policy (access control) is the most important function of the firewall. Through the policy, it controls whether the network session inside and outside the firewall can pass through the firewall. The policy mainly includes the source area, destination area, source address, destination address, transport layer protocol, source port, destination port and other elements. The network session mainly includes the source address, destination address, transport layer protocol, source port, destination port and other elements. When a network session is generated, the network path is determined according to the routing of each device (routers, switches, firewalls and other gateway devices), so as to determine the location of the firewall that needs to be passed. When the network session passes through the firewall, the firewall determines whether the network session is allowed according to the policy. If it is allowed, it passes. If not, the network session is blocked. Based on the above functions, with the increase of various application systems and business systems, the policies on the firewall are becoming more and more numerous and chaotic. At the same time, there are unstable operation and maintenance personnel, no unified standards and guidance manuals, and some policies are strictly configured to strictly limit the passage of a certain source IP address, destination IP address and corresponding port, but most policies are configured loosely, with a large number of "authorities" released, which cannot play the role that the policy should play. Therefore, a calculation method for policy granularity is needed to help policy operation and maintenance personnel evaluate and calculate existing policies or future configuration policies, judge their granularity, and try to make the policies more strict.
[0003] Through the current investigation and research on firewalls and firewall policy management related products, the following conclusions are drawn: the existing firewalls mainly consider the flexibility of policy configuration, and in order to improve the adaptability of policy configuration, the policy configuration on the general firewall can be configured at will, and will not prohibit overly loose policy configuration (similar to any address to any address, any port is open) and will not consider whether the policy configuration is reasonable. There is no rule or algorithm to evaluate and calculate the granularity of the configured policy; the firewall policy management products on the market are mainly reflected in the functions of policy relationship judgment, policy path visualization, policy delivery, etc., and there is no relevant technology for policy granularity calculation and evaluation. In view of this, we propose a calculation method for security policy granularity. Summary of the invention
[0004] The purpose of the present invention is to provide a method for calculating the granularity of a security policy to solve the problems raised in the above background technology.
[0005] In order to solve the above technical problems, one of the objectives of the present invention is to provide a method for calculating the granularity of a security policy, comprising the following steps:
[0006] S1. Prepare a variety of common domestic brands of firewalls, set up a test and development environment, and build a test and development server;
[0007] S2. Investigate the customer's on-site firewall policy data, policy scale, policy configuration habits, policy configuration internal regulations and other information, and use the investigated policy configuration on the test firewall;
[0008] S3, carry out development work such as firewall connection, brand adaptation, data formatting, and policy granularity calculation;
[0009] S4. Verify the calculation results and summarize any problems that arise.
[0010] As a further improvement of the technical solution, in S3, the specific method for performing development work such as firewall docking, brand adaptation, data formatting, and policy granularity calculation includes the following steps:
[0011] S3.1. Use different firewall connection methods for different brands of firewalls;
[0012] S3.2. Choose different ways to obtain resource data and strategy data according to different docking methods;
[0013] S3.3, put the acquired resources and policies into the memory, and associate the resources referenced by the policies based on the uniqueness of the resource names on the same firewall;
[0014] S3.4, define the granularity of the policy based on the size range of the policy source address and destination address, the number of policy source areas and destination areas, the range of protocols and ports defined by the policy service, and divide the policy granularity into 5 levels, where level 1 is the most lenient and level 5 is the most rigorous;
[0015] S3.5. First calculate the address resource type corresponding to the policy source address and destination address, then calculate the service resource type corresponding to the policy service, and finally calculate the granularity of the policy by combining them.
[0016] As a further improvement of the technical solution, in S3.1, the specific method of using different firewall connection methods for firewalls of different brands includes the following steps:
[0017] S3.1.1. Use the simulated manual login SSH method to connect to most common firewalls;
[0018] S3.1.2. Use API to log in and connect to individual firewalls with open interfaces;
[0019] S3.1.3. For firewalls that cannot be connected using the above two methods, use the method of simulating manual login to the web interface for connection.
[0020] As a further improvement of the technical solution, in S3.2, the specific method of selecting different methods to obtain resource data and policy data according to different docking methods includes the following steps:
[0021] S3.2.1. For the SSH login method, after successful login, simulate the manual execution of commands, execute the corresponding commands on the firewall, capture the results returned by the commands, parse the captured data, and extract useful data;
[0022] S3.2.2. For API login, the corresponding result is obtained by requesting the corresponding path and passing the corresponding parameters;
[0023] S3.2.3. For the WEB login method, the data of the corresponding page is obtained through crawlers.
[0024] As a further improvement of the technical solution, in S3.3, the specific method of associating the resources referenced by the policy includes the following steps:
[0025] S3.3.1. Store the address resources in the database in the format of ID, internal number, name, number of citations, specific address, etc.;
[0026] S3.3.2, store the service resources in the database in the format of ID, internal number, name, protocol, port, reference count, etc.;
[0027] S3.3.3, store time, area, etc. in a certain format into the database;
[0028] S3.3.4. Store the policy in the database in the format of ID, policy name, internal number, source address, destination address, service, source area, destination area, time and other fields.
[0029] As a further improvement of the present technical solution, in S3.3, MySQL is used as the database.
[0030] As a further improvement of the technical solution, in S3.4, the specific rules for dividing the policy granularity into 5 levels are as follows (the policy granularity levels are from high to low):
[0031] Policy granularity level 5: source and destination addresses are defined to a single IP address, and services are defined to protocols and ports;
[0032] Policy granularity level 4: source address is defined as a single IP, range, or subnet; destination address is defined as a single IP, range, or subnet; services are defined as protocols and ports or port ranges;
[0033] Policy granularity level 3:
[0034] (a) The source address is defined as any or empty, the destination address is not defined as any or empty, and the service is not defined as empty or TCP, UDP, or ICMP;
[0035] (b) The destination address is defined as any or empty, the source address is not defined as any or empty, and the service is not defined as empty or TCP, UDP, or ICMP;
[0036] (c) The service definition is empty or TCP, UDP, or ICMP, the source address is not defined as any or is empty, and the destination address is not defined as any or is empty;
[0037] Policy granularity level 2:
[0038] (a) The source address is defined as any or empty, the destination address is defined as any or empty, and the service is not defined as empty or TCP, UDP, or ICMP;
[0039] (b) The destination address is defined as any or empty, the service is defined as empty or TCP, UDP, or ICMP, and the source address is not defined as any or empty;
[0040] (c) The service definition is empty or TCP, UDP, or ICMP, the source address is defined as any or empty, and the destination address is not defined as any or empty;
[0041] Policy granularity level 1: The source address is defined as any or empty, the destination address is defined as any or empty, and the service is defined as empty or TCP, UDP, or ICMP.
[0042] As a further improvement of the technical solution, in S3.4, the specific calculation formulas for calculating the defined targets of the calculation strategy granularity include the following:
[0043] First, set the level of address definition. The algorithm is:
[0044] The address is empty or any is assigned a value of 0;
[0045] The address is a range or subnet, and the value is 2;
[0046] The address is assigned a value of 3 for a single address;
[0047] Second, set the level of service definition. The algorithm is:
[0048] The service is empty or TCP, UDP, ICMP is assigned a value of 0;
[0049] The service assigns a value of 2 to the range;
[0050] The service is a single protocol plus port with a value of 3;
[0051] Third, take the source address of the policy and count its source address level, and assign the source address level to sl. The method is:
[0052] Count the levels of each source address separately, sl1, sl2, ..., sln, and find the source address with the smallest level as the minimum total source address level, that is, sl:
[0053] sl=min(sl1,sl2,...,sln);
[0054] Fourth, take the destination address of the policy and count its destination address level, and assign the destination address level to dl. The method is:
[0055] Count the levels of each destination address separately, namely dl1, dl2, ..., dln, and find the lowest level of all destination addresses as the lowest total level of destination addresses, that is, dl:
[0056] dl=min(dl1,dl2,...,dln);
[0057] Fifth, take the service count of the policy and assign the service level to pl. The method is:
[0058] Count the levels of each service separately as pl1, pl2, ..., pln, and find the minimum level of all services as the minimum level of the total service, that is, pl:
[0059] pl=min(pl1,pl2,...,pln);
[0060] Seventh, the granularity of the final counting strategy is assigned to pg as follows:
[0061] Add the source address level sl, destination address level dl, and service level, divide by 2, round down, and add 1, that is:
[0062]
[0063] As a further improvement of the present technical solution, in S3.4, various algorithms are implemented by using JAVA language.
[0064] As a further improvement of the technical solution, in S3.5, the specific method for calculating the policy granularity includes the following steps:
[0065] S3.5.1. First, calculate the address resource type corresponding to the policy source address and destination address, and assign values according to different types. A single IP address is assigned a value of 3, a range or network segment is assigned a value of 2, any is assigned a value of 1, and null is assigned a value of 0. If the source address or destination address contains multiple types of addresses, assign the lowest value.
[0066] S3.5.2. Calculate the service resource type corresponding to the policy service, assign the protocol and port value to 3, assign the protocol and port range value to 2, assign TCP, UDP, ICMP value to 1, and assign null value to 0. If there are multiple services in the policy, assign the lowest value.
[0067] S3.5.3. Finally, according to the specific rules of the policy granularity defined in step S3.4, the granularity of the policy is calculated by combination.
[0068] The second object of the present invention is to provide an operating system and an operating device for a method for calculating the granularity of a security policy, including a processor, a memory, and a computer program stored in the memory and running on the processor, wherein the processor is used to implement the steps of the method for calculating the granularity of the security policy when executing the computer program.
[0069] A third object of the present invention is that the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the above-mentioned method for calculating the security policy granularity are implemented.
[0070] Compared with the prior art, the present invention has the following beneficial effects:
[0071] 1. The calculation method of the security policy granularity can be configured by connecting to the firewall. After connecting to the firewall, the method of obtaining resource data and policy data can be configured. The obtained resource data and policy data can be associated, and the resource and policy data can be formatted and stored in the library. A policy granularity judgment rule is formulated. Through relevant algorithms and rules, the granularity of the policy is calculated according to the constituent elements of the policy, including but not limited to the source address, destination address, protocol, port, source area, destination area, etc., and the policy granularity is divided into 5 levels;
[0072] 2. The calculation method of the security policy granularity is implemented through the JAVA language algorithm, using MySQL as the database, simulating and adapting firewalls of various brands, simulating the firewall policies of various industry customers, and performing granular calculation and evaluation on the obtained policy data. It can fully achieve the set goals and the calculation results are accurate;
[0073] 3. The calculation method of the security policy granularity can configure a more standard and unified firewall policy, helping policy operation and maintenance personnel to evaluate and calculate the firewall policy, thereby improving the adaptability of the policy configuration, improving the rationality of the policy configuration, and improving the functionality of the policy configuration while ensuring the flexibility of the policy configuration. BRIEF DESCRIPTION OF THE DRAWINGS
[0074] Figure 1 is a flow chart of the overall method in the present invention;
[0075] Figure 2 It is one of the partial method flow charts in the present invention;
[0076] Figure 3 This is the second flow chart of the local method in the present invention;
[0077] Figure 4 This is the third flow chart of the local method in the present invention;
[0078] Figure 5 This is the fourth flow chart of the local method in the present invention;
[0079] Figure 6 This is the fifth flow chart of the local method in the present invention;
[0080] Figure 7 It is a schematic diagram of the structure of an exemplary electronic computer product device in the present invention. DETAILED DESCRIPTION
[0081] 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.
[0082] Example 1
[0083] like Figure 1-Figure 6 As shown, this embodiment provides a method for calculating the granularity of a security policy, comprising the following steps:
[0084] S1. Prepare a variety of common domestic brands of firewalls, set up a test and development environment, and build a test and development server;
[0085] S2. Investigate the customer's on-site firewall policy data, policy scale, policy configuration habits, policy configuration internal regulations and other information, and use the investigated policy configuration on the test firewall;
[0086] S3, carry out development work such as firewall connection, brand adaptation, data formatting, and policy granularity calculation;
[0087] S4. Verify the calculation results and summarize any problems that arise.
[0088] In this embodiment, in S3, the specific method for performing development work such as firewall connection, brand adaptation, data formatting, and policy granularity calculation includes the following steps:
[0089] S3.1. Use different firewall connection methods for different brands of firewalls;
[0090] S3.2. Choose different ways to obtain resource data and strategy data according to different docking methods;
[0091] S3.3, put the acquired resources and policies into the memory, and associate the resources referenced by the policies based on the uniqueness of the resource names on the same firewall;
[0092] S3.4, define the granularity of the policy based on the size range of the policy source address and destination address, the number of policy source areas and destination areas, the range of protocols and ports defined by the policy service, and divide the policy granularity into 5 levels, where level 1 is the most lenient and level 5 is the most rigorous;
[0093] S3.5. First calculate the address resource type corresponding to the policy source address and destination address, then calculate the service resource type corresponding to the policy service, and finally calculate the granularity of the policy by combining them.
[0094] In this embodiment, in S3.1, the specific method of using different firewall connection modes for firewalls of different brands includes the following steps:
[0095] S3.1.1. Use the simulated manual login SSH method to connect to most common firewalls;
[0096] S3.1.2. Use API to log in and connect to individual firewalls with open interfaces;
[0097] S3.1.3. For firewalls that cannot be connected using the above two methods, use the method of simulating manual login to the web interface for connection.
[0098] In this embodiment, in S3.2, the specific method of selecting different methods to obtain resource data and policy data according to different docking methods includes the following steps:
[0099] S3.2.1. For the SSH login method, after successful login, simulate the manual execution of commands, execute the corresponding commands on the firewall, capture the results returned by the commands, parse the captured data, and extract useful data;
[0100] S3.2.2. For API login, the corresponding result is obtained by requesting the corresponding path and passing the corresponding parameters;
[0101] S3.2.3. For the WEB login method, the data of the corresponding page is obtained through crawlers.
[0102] In this embodiment, in S3.3, the specific method of associating the resources referenced by the policy includes the following steps:
[0103] S3.3.1. Store the address resources in the database in the format of ID, internal number, name, number of citations, specific address, etc.;
[0104] S3.3.2, store the service resources in the database in the format of ID, internal number, name, protocol, port, reference count, etc.;
[0105] S3.3.3, store time, area, etc. in a certain format into the database;
[0106] S3.3.4. Store the policy in the database in the format of ID, policy name, internal number, source address, destination address, service, source area, destination area, time and other fields.
[0107] Specifically, in S3.3, MySQL is used as the database.
[0108] In this embodiment, in S3.4, the specific rules for dividing the policy granularity into 5 levels are as follows (the policy granularity levels are from high to low):
[0109] Policy granularity level 5: source and destination addresses are defined to a single IP address, and services are defined to protocols and ports;
[0110] Policy granularity level 4: source address is defined as a single IP, range, or subnet; destination address is defined as a single IP, range, or subnet; services are defined as protocols and ports or port ranges;
[0111] Policy granularity level 3:
[0112] (a) The source address is defined as any or empty, the destination address is not defined as any or empty, and the service is not defined as empty or TCP, UDP, or ICMP;
[0113] (b) The destination address is defined as any or empty, the source address is not defined as any or empty, and the service is not defined as empty or TCP, UDP, or ICMP;
[0114] (c) The service definition is empty or TCP, UDP, or ICMP, the source address is not defined as any or is empty, and the destination address is not defined as any or is empty;
[0115] Policy granularity level 2:
[0116] (a) The source address is defined as any or empty, the destination address is defined as any or empty, and the service is not defined as empty or TCP, UDP, or ICMP;
[0117] (b) The destination address is defined as any or empty, the service is defined as empty or TCP, UDP, or ICMP, and the source address is not defined as any or empty;
[0118] (c) The service definition is empty or TCP, UDP, or ICMP, the source address is defined as any or empty, and the destination address is not defined as any or empty;
[0119] Policy granularity level 1: The source address is defined as any or empty, the destination address is defined as any or empty, and the service is defined as empty or TCP, UDP, or ICMP.
[0120] Furthermore, in S3.4, the specific calculation formulas for each defined target of the calculation strategy granularity include the following:
[0121] First, set the level of address definition. The algorithm is:
[0122] The address is empty or any is assigned a value of 0;
[0123] The address is a range or subnet, and the value is 2;
[0124] The address is assigned a value of 3 for a single address;
[0125] Second, set the level of service definition. The algorithm is:
[0126] The service is empty or TCP, UDP, ICMP is assigned a value of 0;
[0127] The service assigns a value of 2 to the range;
[0128] The service is a single protocol plus port with a value of 3;
[0129] Third, take the source address of the policy and count its source address level, and assign the source address level to sl. The method is:
[0130] Count the levels of each source address separately, sl1, sl2, ..., sln, and find the source address with the smallest level as the minimum total source address level, that is, sl:
[0131] sl=min(sl1,sl2,...,sln);
[0132] Fourth, take the destination address of the policy and count its destination address level, and assign the destination address level to dl. The method is:
[0133] Count the levels of each destination address separately, namely dl1, dl2, ..., dln, and find the lowest level of all destination addresses as the lowest total level of destination addresses, that is, dl:
[0134] dl=min(dl1,dl2,...,dln);
[0135] Fifth, take the service count of the policy and assign the service level to pl. The method is:
[0136] Count the levels of each service separately as pl1, pl2, ..., pln, and find the minimum level of all services as the minimum level of the total service, that is, pl:
[0137] pl=min(pl1,pl2,...,pln);
[0138] Eighth, the granularity of the final counting strategy is assigned to pg as follows:
[0139] Add the source address level sl, destination address level dl, and service level, divide by 2, round down, and add 1, that is:
[0140]
[0141] Specifically, in S3.4, various algorithms are implemented using the JAVA language.
[0142] In this embodiment, in S3.5, the specific method for calculating the policy granularity includes the following steps:
[0143] S3.5.1. First, calculate the address resource type corresponding to the policy source address and destination address, and assign values according to different types. A single IP address is assigned a value of 3, a range or network segment is assigned a value of 2, any is assigned a value of 1, and null is assigned a value of 0. If the source address or destination address contains multiple types of addresses, assign the lowest value.
[0144] S3.5.2. Calculate the service resource type corresponding to the policy service, assign the protocol and port value to 3, assign the protocol and port range value to 2, assign TCP, UDP, ICMP value to 1, and assign null value to 0. If there are multiple services in the policy, assign the lowest value.
[0145] S3.5.3. Finally, according to the specific rules of the policy granularity defined in step S3.4, the granularity of the policy is calculated by combination.
[0146] like Figure 7 As shown, this embodiment also provides an operating system and an operating device for a method for calculating security policy granularity, and the device includes a processor, a memory, and a computer program stored in the memory and running on the processor.
[0147] The processor includes one or more processing cores, the processors are connected to each other through a bus, the memory is used to store program instructions, and the processor implements the above-mentioned security policy granularity calculation method when executing the program instructions in the memory.
[0148] Optionally, the memory can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic storage, flash memory, magnetic disk or optical disk.
[0149] In addition, the present invention also provides a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, the steps of the above-mentioned security policy granularity calculation method are implemented.
[0150] Optionally, the present invention also provides a computer program product comprising instructions, which, when executed on a computer, enables the computer to execute the steps of the above-mentioned methods for calculating the security policy granularity.
[0151] A person of ordinary skill in the art can understand that the process of implementing all or part of the steps of the above-mentioned embodiments can be completed by hardware, or can be completed by instructing related hardware through a program, and the program can be stored in a computer-readable storage medium, and the above-mentioned storage medium can be a read-only memory, a disk or an optical disk, etc.
[0152] The above shows and describes the basic principles, main features and advantages of the present invention. Those skilled in the art should understand that the present invention is not limited by the above embodiments. The above embodiments and descriptions are only preferred examples of the present invention and are not intended to limit the present invention. Without departing from the spirit and scope of the present invention, the present invention may have various changes and improvements, which fall within the scope of the present invention. The scope of protection of the present invention is defined by the attached claims and their equivalents.
Claims
1. A method for calculating security policy granularity, characterized in that: The steps include: S1. Prepare firewalls of various brands, set up test and development environments, and build test and development servers; S2. Investigate the firewall policy data, policy scale, policy configuration habits, and internal policy configuration information at the customer site, and use the investigated policy configuration on the test firewall; S3, carry out firewall connection, brand adaptation, data formatting, and policy granularity calculation development; S4. Verify the calculation results and summarize the problems that arise; In S3, the specific method for firewall connection, brand adaptation, data formatting, and policy granularity calculation development includes the following steps: S3.
1. Use different firewall connection methods for different brands of firewalls; S3.
2. Choose different ways to obtain resource data and strategy data according to different docking methods; S3.3, put the acquired resources and policies into the memory, and associate the resources referenced by the policies based on the uniqueness of the resource names on the same firewall; S3.4, define the policy granularity according to the size range of the policy source address and destination address, the number of policy source areas and destination areas, and the range of protocols and ports defined by the policy service, and divide the policy granularity into 5 levels, where level 1 is the most lenient and level 5 is the most strict; S3.5, first calculate the address resource type corresponding to the policy source address and destination address, then calculate the service resource type corresponding to the policy service, and finally calculate the granularity of the policy by combining them; In S3.1, the specific method of using different firewall connection methods for firewalls of different brands includes the following steps: S3.1.
1. Use the simulated manual login SSH method to connect to most common firewalls; S3.1.
2. Use API to log in and connect to individual firewalls with open interfaces; S3.1.
3. For firewalls that cannot be connected using the above two methods, use the method of simulating manual login to the web interface for connection; In S3.2, the specific method of selecting different methods to obtain resource data and policy data according to different docking methods includes the following steps: S3.2.
1. For the SSH login method, after successful login, simulate the manual execution of commands, execute the corresponding commands on the firewall, capture the results returned by the commands, parse the captured data, and extract useful data; S3.2.
2. For API login, the corresponding result is obtained by requesting the corresponding path and passing the corresponding parameters; S3.2.
3. For web login, the data of the corresponding page is obtained by crawling; In S3.3, the specific method of associating the resources referenced by the policy includes the following steps: S3.3.
1. Store the address resource in the database in the format of ID, internal number, name, reference count, and specific address fields; S3.3.2, store the service resources in the database in the format of ID, internal number, name, protocol, port, and reference count fields; S3.3.3, store the time and area in a certain format in the database; S3.3.4, store the policy in the database in the format of ID, policy name, internal number, source address, destination address, service, source area, destination area, and time field; In S3.4, the specific rules for dividing the policy granularity into 5 levels are as follows, from high to low: Policy granularity level 5: source and destination addresses are defined to a single IP address, and services are defined to protocols and ports; Policy granularity level 4: source address is defined as a single IP, range, or subnet; destination address is defined as a single IP, range, or subnet; services are defined as protocols and ports or port ranges; Policy granularity level 3: (a) The source address is defined as any or empty, the destination address is not defined as any or empty, and the service is not defined as empty or TCP, UDP, or ICMP; (b) The destination address is defined as any or empty, the source address is not defined as any or empty, and the service is not defined as empty or TCP, UDP, or ICMP; (c) The service definition is empty or TCP, UDP, or ICMP, the source address is not defined as any or is empty, and the destination address is not defined as any or is empty; Policy granularity level 2: (a) The source address is defined as any or empty, the destination address is defined as any or empty, and the service is not defined as empty or TCP, UDP, or ICMP; (b) The destination address is defined as any or empty, the service is defined as empty or TCP, UDP, or ICMP, and the source address is not defined as any or empty; (c) The service definition is empty or TCP, UDP, or ICMP, the source address is defined as any or empty, and the destination address is not defined as any or empty; Policy granularity level 1: source address is defined as any or empty, destination address is defined as any or empty, service is defined as empty or TCP, UDP, ICMP; In S3.4, the specific calculation formulas for the calculation strategy granularity and the definition targets are as follows: First, set the level of address definition. The algorithm is: The address is empty or any is assigned a value of 0; The address is a range or subnet, and the value is 2; The address is assigned a value of 3 for a single address; Second, set the level of service definition. The algorithm is: The service is empty or TCP, UDP, ICMP is assigned a value of 0; The service assigns a value of 2 to the range; The service is a single protocol plus port with a value of 3; Third, take the source address of the policy and count its source address level, and assign the source address level to sl. The method is: Count the levels of each source address separately, sl1, sl2, ..., sln, and find the source address with the smallest level as the minimum total source address level, that is, sl: sl=min(sl1,sl2,...,sln); Fourth, take the destination address of the policy and count its destination address level, and assign the destination address level to dl. The method is: Count the levels of each destination address separately, namely dl1, dl2, ..., dln, and find the lowest level of all destination addresses as the lowest total level of destination addresses, that is, dl: dl=min(dl1,dl2,...,dln); Fifth, take the service count of the policy and assign the service level to pl. The method is: Count the levels of each service separately as pl1, pl2, ..., pln, and find the minimum level of all services as the minimum level of the total service, that is, pl: pl=min(pl1,pl2,...,pln); Sixth, the granularity of the final counting strategy is assigned to pg as follows: Add the source address level sl, destination address level dl, and service level, divide by 2, round down, and add 1, that is: In S3.4, all algorithms are implemented using JAVA language; In S3.5, the specific method for calculating the policy granularity includes the following steps: S3.5.
1. First, calculate the address resource type corresponding to the policy source address and destination address, and assign values according to different types. A single IP address is assigned a value of 3, a range or network segment is assigned a value of 2, any is assigned a value of 1, and null is assigned a value of 0. If the source address or destination address contains multiple types of addresses, assign the lowest value. S3.5.
2. Calculate the service resource type corresponding to the policy service, assign the protocol and port value to 3, assign the protocol and port range value to 2, assign TCP, UDP, ICMP value to 1, and assign null value to 0. If there are multiple services in the policy, assign the lowest value. S3.5.
3. Finally, according to the specific rules of the policy granularity defined in step S3.4, the granularity of the policy is calculated by combination.
2. The method for calculating the security policy granularity according to claim 1, characterized in that: In S3.3, MySQL is used as the database.
