Firewall rule configuration method and device and storage medium

The method and device automate iptables firewall rule management across servers using ipset and iptables, addressing inefficiencies and errors in manual configurations by implementing centralized management and version control, enhancing efficiency and accuracy.

CN119094195APending Publication Date: 2024-12-06广州市申迪计算机系统有限公司
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411197846.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-29
Publication Date
2024-12-06

AI Technical Summary

Technical Problem

The management of iptables firewall rules across multiple servers is inefficient and prone to errors due to manual configuration, lacking centralized management and standardization, leading to difficulty in handling large numbers of rules and increased risk of configuration errors.

Method used

A method and device for configuring firewall rules that involves loading a target configuration file on a server, modifying IP address sets and firewall rules based on user input, and using tools like ipset and iptables for automated management and control, ensuring accurate rule placement and version control through a centralized approach.

Benefits of technology

Enhances the efficiency and accuracy of firewall rule configuration by enabling automated centralized management, simplifying rule management, and reducing errors through precise rule positioning and version control, thereby improving the management of large-scale firewall configurations.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119094195A_ABST
    Figure CN119094195A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of computers, and discloses a firewall rule configuration method and device and a storage medium, and the method comprises the steps: obtaining user input data when an interaction instruction for an operation rule of a target server is received, and loading a target configuration file on the target server; correspondingly modifying an IP address set, a rule or a version of the target configuration file according to the interaction instruction and user input data; performing operation management control on a first tool and a second tool of the target machine based on the modified target configuration file so as to complete configuration of a preset IP address firewall rule; wherein the first tool is used for IP configuration management, and the second tool is used for firewall rule management and access control management of a target server port. By means of the technical scheme, the firewall rules can be managed in a centralized mode, and the firewall rule configuration efficiency and accuracy are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present invention relate to the field of computer technology, and in particular to a method, device, equipment and computer-readable storage medium for configuring firewall rules. Background Art

[0002] In a large network environment, as the business grows, the number of managed servers also increases. The management of the iptables firewall of each server becomes increasingly inconvenient, and the firewall rules of thousands of servers increasingly need to be centrally managed.

[0003] However, the current management of firewalls is mostly limited to manual maintenance of iptables firewall configuration by operation and maintenance personnel. The iptables firewall rules of each server are usually different. When using large-scale IP configuration, a large number of rules will be generated. Often, a machine has hundreds or thousands of rules, which makes management difficult for a single machine. The existing technology for the management of iptables rules mostly relies on manual writing and saving of configuration files, and it is impossible to centrally manage iptables rules. The rule management is not standardized, and there is a risk of configuration errors when manually writing rules. Therefore, the efficiency and accuracy of the iptables firewall rule configuration method using manual maintenance are low. Summary of the invention

[0004] In view of the above problems, the embodiments of the present invention provide a method, apparatus, device and computer-readable storage medium for configuring firewall rules, so as to achieve centralized management of firewall rules and improve the efficiency and accuracy of firewall rule configuration.

[0005] According to one aspect of an embodiment of the present invention, there is provided a method for configuring firewall rules, the method comprising: when receiving an interactive instruction for operating rules for a target server, obtaining user input data, and loading a target configuration file on the target server;

[0006] The target configuration file stores the firewall rules currently running on the target server and its firewall rule ID and IP address set;

[0007] According to the interactive instruction and the user input data, modify one or more of the IP address set, firewall rules and version of the target configuration file accordingly;

[0008] Based on the modified target configuration file, the first tool and the second tool of the target machine are operated, managed and controlled to complete the configuration of the preset IP address firewall rules;

[0009] The first tool is used for IP configuration management, and the second tool is used for firewall rule management and access control management of the target server port.

[0010] In an optional manner, before loading the target configuration file on the target machine, the method further includes:

[0011] If the target machine does not have the first tool or the second tool installed, the corresponding tool is installed in the target machine.

[0012] In an optional manner, according to the interactive instruction and the user input data, one or more of the IP address set, firewall rules and version of the target configuration file are modified accordingly, including:

[0013] If the interactive instruction is an operation of adding a target rule, the user input data includes a first IP address set, a target rule, and a target rule ID;

[0014] Writing the first IP address set into a target configuration file;

[0015] Based on a preset field in a preset table in the target configuration file, a writing position of the target rule is determined; and according to the writing position, the target rule is written into the preset table.

[0016] In an optional manner, the operation management control of the first tool and the second tool of the target machine based on the modified target configuration file to complete the configuration of the preset IP address firewall rule includes:

[0017] If the interactive instruction is an operation of adding a target rule, the first tool is reloaded, the second tool is restarted, and the modified target configuration file is loaded for access by the machine corresponding to the first IP address set.

[0018] In an optional manner, according to the interactive instruction and the user input data, one or more of the IP address set, firewall rules and version of the target configuration file are modified accordingly, further comprising:

[0019] If the interactive instruction is an operation to modify a rule version, a corresponding configuration file is obtained from a database according to the user input data as a modified target configuration file; the target configuration file includes a second IP address set;

[0020] The database is used to store configuration files of all versions.

[0021] In an optional manner, the operation management control of the first tool and the second tool of the target machine based on the modified target configuration file to complete the configuration of the preset IP address firewall rule includes:

[0022] If the interactive instruction is an operation to modify a rule version, the first tool is reloaded, the second tool is restarted, and the modified target configuration file is loaded for access by the machine corresponding to the second IP address set.

[0023] In an optional manner, according to the interactive instruction and the user input data, one or more of the IP address set, firewall rules and version of the target configuration file are modified accordingly, including:

[0024] If the interactive instruction is an operation of modifying or deleting a target rule, the port access control state of the preset IP address set of the target configuration file is modified according to the user input data, and the position of the target rule is located in the target configuration file according to the target rule ID to modify or delete the target rule.

[0025] In an optional manner, the operation management control of the first tool and the second tool of the target machine based on the modified target configuration file to complete the configuration of the preset IP address firewall rule includes:

[0026] If the interactive instruction is an operation of modifying or deleting a target rule, the second tool is restarted and the modified target configuration file is loaded for access by a machine corresponding to the preset IP address set.

[0027] Specifically, the present invention increases rules by modifying the target configuration file, accurately locates the rule writing position, and improves the rule management efficiency; the present invention realizes version control of rules through version configuration of the target configuration file, and improves the rule management efficiency; the present invention introduces rule IDs in the target configuration file to accurately locate the rules for modification and deletion operations, and improves the rule management efficiency. Therefore, the present invention improves the efficiency and accuracy of configuring a large number of firewall rules on a single machine through automated centralized management of the target configuration file.

[0028] According to another aspect of an embodiment of the present invention, a firewall rule configuration device is provided, comprising: a processor, a memory, a communication interface and a communication bus, wherein the processor, the memory and the communication interface communicate with each other via the communication bus; the memory is used to store at least one executable instruction, wherein the executable instruction enables the processor to perform the operation of the firewall rule configuration method as described in any one of the above items.

[0029] According to another aspect of an embodiment of the present invention, a computer-readable storage medium is provided, wherein the storage medium stores at least one executable instruction, wherein the executable instruction enables a firewall rule configuration device / apparatus to perform the operation of the firewall rule configuration method as described in any one of the above.

[0030] The above description is only an overview of the technical solution of the embodiment of the present invention. In order to more clearly understand the technical means of the embodiment of the present invention, it can be implemented in accordance with the contents of the specification. In order to make the above and other purposes, features and advantages of the embodiment of the present invention more obvious and easy to understand, the specific implementation methods of the present invention are listed below. BRIEF DESCRIPTION OF THE DRAWINGS

[0031] The accompanying drawings are only used to illustrate the embodiments and are not to be considered as limiting the present invention. In addition, the same reference symbols are used to represent the same components throughout the accompanying drawings. In the accompanying drawings:

[0032] Figure 1 A schematic diagram showing a flow chart of a first embodiment of a method for configuring firewall rules provided by the present invention;

[0033] Figure 2 A flowchart of a first embodiment of modifying a target configuration file according to the present invention is shown;

[0034] Figure 3 A flowchart of a second embodiment of modifying a target configuration file according to the present invention is shown;

[0035] Figure 4 A flowchart of a third embodiment of modifying a target configuration file according to the present invention is shown;

[0036] Figure 5 A schematic diagram showing the structure of an embodiment of a device for configuring firewall rules provided by the present invention;

[0037] Figure 6 A structural schematic diagram of an embodiment of a firewall rule configuration device provided by the present invention is shown. DETAILED DESCRIPTION

[0038] Exemplary embodiments of the present invention will be described in more detail below with reference to the accompanying drawings. Although exemplary embodiments of the present invention are shown in the drawings, it should be understood that the present invention can be implemented in various forms and should not be limited to the embodiments set forth herein.

[0039] Figure 1 FIG. 1 is a flowchart of a first embodiment of a method for configuring firewall rules of the present invention, and the method is executed by a firewall rule configuration device. Figure 1 As shown, the method comprises the following steps:

[0040] Step 110: when receiving an interactive instruction for the operation rule of the target server, loading a target configuration file on the target server;

[0041] The target configuration file stores the firewall rules currently running on the target server and its firewall rule ID and IP address set;

[0042] Specifically, the interactive instructions for the operation rules of the target server are input by the user on the software operation and maintenance platform, and are sent by the software operation and maintenance platform to the configuration device of the firewall rules.

[0043] The software operation and maintenance platform is a Java-based operation and maintenance platform with functions such as server asset management, iptables firewall management, one-click software deployment, and one-click software start and stop. Among them, the iptables firewall management module mainly manages iptables by calling mysql database, playbook, host command, script, ipset and other tools through java.

[0044] Specifically, the first tool is ipset, and the second tool is iptables.

[0045] Iptables is a command-line tool used in the Linux operating system to configure and manage IP packet filtering rules. It allows administrators to define rules to control the ingress and egress of network traffic, usually by controlling the configuration files in the Linux operating system.

[0046] Ipset is a tool for Linux systems and an extension of iptables for creating, managing, and using IP address sets. These sets can be used in iptables rules to simplify and optimize the management of large-scale IP addresses, ports, and networks.

[0047] Playbook is an important concept in the ansible automated operation and maintenance tool. Playbook is a file written in YAML format that defines a series of tasks and actions that will be automatically executed to automate system configuration, software installation, and other management tasks.

[0048] In some embodiments of the present invention, the user writes the rules and rule IDs that need to be added or modified, and inputs the machine IP to which the rules need to be issued, and the software operation and maintenance platform generates corresponding interactive instructions.

[0049] In some embodiments of the present invention, the user specifies the rule or rule ID to be deleted, and inputs the machine IP to which the rule needs to be issued, and the software operation and maintenance platform generates corresponding interactive instructions.

[0050] The configuration device uses iptables-management to receive the interactive instructions. Iptables-management is a Java project for managing iptables, which is used to process the distribution of iptables / ipet rules, call mysql and ansible to install iptables / ipset, modify iptables / ipset rules, and restart iptables / ipset.

[0051] In some embodiments of the present invention, before loading the target configuration file on the target machine, the method further includes:

[0052] If the target machine does not have the first tool or the second tool installed, the corresponding tool is installed in the target machine.

[0053] Specifically, determine whether iptables and ipset are installed on the target machine (192.168.1.2). If not, configure the device to use iptables-management to call the playbook on mysql to install ipset and iptables. After ipset and iptables are installed, the rules running on the target server will be obtained and saved to the / etc / sysconfig / iptables file and mysql of the target server.

[0054] Specifically, the target configuration files include: ipset configuration files and iptables configuration files.

[0055] Among them, the / etc / sysconfig / iptables file of the target server is used as the iptables configuration file, and the iptables configuration file is automatically loaded when iptables is started.

[0056] The ipset configuration file is defined in / etc / sysconfig / ipset.

[0057] Step 120: According to the interactive instruction and the user input data, one or more of the IP address set, firewall rules and version of the target configuration file are modified accordingly.

[0058] Step 130: Based on the modified target configuration file, the first tool and the second tool of the target machine are operated, managed and controlled to complete the configuration of the preset IP address firewall rules;

[0059] The first tool is used for IP configuration management, and the second tool is used for firewall rule management and access control management of the target server port.

[0060] In some embodiments of the present invention, according to the interactive instruction and the user input data, one or more of the IP address set, firewall rules and version of the target configuration file are modified accordingly, including:

[0061] If the interactive instruction is an operation of adding a target rule, the user input data includes a first IP address set, a target rule, and a target rule ID;

[0062] Writing the first IP address set into a target configuration file;

[0063] Based on a preset field in a preset table in the target configuration file, a writing position of the target rule is determined; and according to the writing position, the target rule is written into the preset table.

[0064] The operation management and control of the first tool and the second tool of the target machine based on the modified target configuration file to complete the configuration of the preset IP address firewall rules includes:

[0065] If the interactive instruction is an operation of adding a target rule, the first tool is reloaded, the second tool is restarted, and the modified target configuration file is loaded for access by the machine corresponding to the first IP address set.

[0066] Figure 2 FIG. 2 shows a flow chart of a first embodiment of modifying a target configuration file according to the present invention. Figure 2 As shown, the method comprises the following steps:

[0067] Step 221: If the interactive instruction is an operation of adding a target rule, the user input data includes a first IP address set, a target rule, and a target rule ID;

[0068] Writing the first IP address set into a target configuration file;

[0069] Based on a preset field in a preset table in the target configuration file, a writing position of the target rule is determined; and according to the writing position, the target rule is written into the preset table.

[0070] In some embodiments of the present invention, according to the interactive instruction and the user input data, one or more of the IP address set, firewall rules and version of the target configuration file are modified accordingly, including:

[0071] If the interactive instruction is an operation of adding a target rule, the user input data includes a first IP address set, a target rule, and a target rule ID;

[0072] Writing the first IP address set into a target configuration file;

[0073] Based on a preset field in a preset table in the target configuration file, a writing position of the target rule is determined; and according to the writing position, the target rule is written into the preset table.

[0074] Specifically, the first IP address set is written into the ipset configuration file. Preferably, the ipset configuration file is loaded before the IP address set is written into the ipset configuration file. If the ipset configuration file does not exist or the set in the ipset configuration file has been loaded, it will be skipped. Loading the ipset configuration file is to ensure that the existing set in the ipset configuration file is always loaded and running.

[0075] For example, if the user enters 100 IP addresses 172.168.201.2-172.168.201.50, 172.168.201.51-172.168.201.101, an IP address set is created, all IP addresses are written into the IP address set, and saved in the ipset configuration file.

[0076] Specifically, the target rule and the target rule ID are written into the filter table in the iptables configuration file.

[0077] Specifically, the iptables configuration file starts with the table name and ends with the COMMIT field to confirm the write location of the rules of a certain table.

[0078] Therefore, if the user needs to add a target rule, the first COMMIT field under the filter table is confirmed as the rule writing position, and the target rule and target rule ID are written above the first COMMIT field under the filter table.

[0079] Step 222: Reload the first tool, restart the second tool, and load the modified target configuration file for access by the machine corresponding to the first IP address set.

[0080] Specifically, the target machine (192.168.1.2) reloads ipset and restarts iptables. When restarting iptables, the iptables configuration file is automatically loaded, and the new rules are sent to the 100 machines corresponding to the first IP address set.

[0081] In some embodiments of the present invention, according to the interactive instruction and the user input data, one or more of the IP address set, firewall rules and version of the target configuration file are modified accordingly, further comprising:

[0082] If the interactive instruction is an operation to modify a rule version, a corresponding configuration file is obtained from a database according to the user input data as a modified target configuration file; the target configuration file includes a second IP address set;

[0083] The database is used to store configuration files of all versions.

[0084] In some embodiments of the present invention, the operation management control of the first tool and the second tool of the target machine based on the modified target configuration file to complete the configuration of the preset IP address firewall rules includes:

[0085] If the interactive instruction is an operation to modify a rule version, the first tool is reloaded, the second tool is restarted, and the modified target configuration file is loaded for access by the machine corresponding to the second IP address set.

[0086] Figure 3 FIG. 2 shows a flow chart of a second embodiment of modifying a target configuration file according to the present invention. Figure 3 As shown, the method comprises the following steps:

[0087] Step 321: If the interactive instruction is an operation to modify a rule version, a corresponding configuration file is obtained from a database according to the user input data as a modified target configuration file; the target configuration file includes a second IP address set; and the database is used to store all versions of configuration files.

[0088] Specifically, mysql will save each version of the iptables configuration file. If the user specifies a certain version of the rule in the input data, the configuration device will obtain the corresponding ipset configuration file and iptables configuration file in mysql. Among them, the ipset configuration file includes the second IP address set.

[0089] Step 322: Reload the first tool, restart the second tool, and load the modified target configuration file for access by the machine corresponding to the second IP address set.

[0090] Specifically, the target machine (192.168.1.2) reloads ipset, restarts iptables, automatically loads the iptables configuration file when restarting iptables, and sends new rules to the machine corresponding to the second IP address set.

[0091] In some embodiments of the present invention, according to the interactive instruction and the user input data, one or more of the IP address set, firewall rules and version of the target configuration file are modified accordingly, including:

[0092] If the interactive instruction is an operation of modifying or deleting a target rule, the port access control state of the preset IP address set of the target configuration file is modified according to the user input data, and the position of the target rule is located in the target configuration file according to the target rule ID to modify or delete the target rule.

[0093] In some embodiments of the present invention, the operation management control of the first tool and the second tool of the target machine based on the modified target configuration file to complete the configuration of the preset IP address firewall rules includes:

[0094] If the interactive instruction is an operation of modifying or deleting a target rule, the second tool is restarted and the modified target configuration file is loaded for access by a machine corresponding to the preset IP address set.

[0095] Figure 4 FIG. 4 is a flowchart showing a third embodiment of modifying a target configuration file according to the present invention. Figure 4 As shown, the method comprises the following steps:

[0096] Step 421: If the interactive instruction is an operation to modify or delete a target rule, the port access control state of the preset IP address set of the target configuration file is modified according to the user input data, and the position of the target rule is located in the target configuration file according to the target rule ID to modify or delete the target rule.

[0097] Specifically, modifying the rules does not involve modifying the IP address set, but only modifying the port opening or disabling of a certain IP address set. For example, set a is originally allowed to access port 80 of the local machine. The configuration device is modified to prohibit set a from accessing port 80; or to prohibit set a from accessing port 9090; or to allow set a to access port 8080.

[0098] The configuration device locates the target rule to be processed in the iptables configuration file by the rule ID, and deletes or modifies it.

[0099] Step 422: Restart the second tool and load the modified target configuration file for access by the machine corresponding to the preset IP address set.

[0100] Specifically, restart iptables, automatically load the iptables configuration file when restarting iptables, and send new rules to the machines corresponding to the preset IP address set.

[0101] The present invention simplifies the iptables configuration by calling ipset through java, making rule management more convenient; the present invention recognizes the ipables configuration through java service, realizes accurate positioning of the iptables rule writing position, and improves the rule management efficiency; the present invention obtains the iptables configuration through java and saves it to mysql to perform version control on the iptables rules, thereby improving the rule management efficiency; the present invention introduces id into the iptables configuration file, so that the java program can accurately locate the rules to perform modification and deletion operations, thereby improving the rule management efficiency. Therefore, the present invention realizes improving the efficiency and accuracy of a single machine for configuring a large number of firewall rules through automated centralized management of ipset configuration and iptables configuration.

[0102] Figure 5 FIG. 4 is a schematic diagram showing a structure of an embodiment of a configuration device for firewall rules of the present invention; Figure 3 As shown, the device 500 includes: a loading module 510, a modifying module 520 and an updating module 530;

[0103] The loading module 510 is used to obtain user input data and load the target configuration file on the target server when receiving an interactive instruction for the operation rule of the target server;

[0104] The target configuration file stores the firewall rules currently running on the target server and its firewall rule ID and IP address set;

[0105] The modification module 520 is used to modify one or more of the IP address set, firewall rules and version of the target configuration file according to the interactive instruction and the user input data;

[0106] The update module 530 is used to perform operation management and control on the first tool and the second tool of the target machine based on the modified target configuration file to complete the configuration of the preset IP address firewall rules;

[0107] The first tool is used for IP configuration management, and the second tool is used for firewall rule management and access control management of the target server port.

[0108] In an optional manner, before the target configuration file on the target machine is loaded in the loading module 510, the loading module 510 further includes:

[0109] If the target machine does not have the first tool or the second tool installed, the corresponding tool is installed in the target machine.

[0110] In an optional manner, the modification module 520, according to the interactive instruction and the user input data, performs corresponding modification on one or more of the IP address set, firewall rules and version of the target configuration file, including:

[0111] If the interactive instruction is an operation of adding a target rule, the user input data includes a first IP address set, a target rule, and a target rule ID;

[0112] Writing the first IP address set into a target configuration file;

[0113] Based on a preset field in a preset table in the target configuration file, a writing position of the target rule is determined; and according to the writing position, the target rule is written into the preset table.

[0114] If the interactive instruction is an operation to modify a rule version, a corresponding configuration file is obtained from a database according to the user input data as a modified target configuration file; the target configuration file includes a second IP address set;

[0115] The database is used to store configuration files of all versions.

[0116] If the interactive instruction is an operation of modifying or deleting a target rule, the port access control state of the preset IP address set of the target configuration file is modified according to the user input data, and the position of the target rule is located in the target configuration file according to the target rule ID to modify or delete the target rule.

[0117] In an optional manner, the updating module 530 performs operation management control on the first tool and the second tool of the target machine based on the modified target configuration file to complete the configuration of the preset IP address firewall rule, including:

[0118] If the interactive instruction is an operation of adding a target rule, the first tool is reloaded, the second tool is restarted, and the modified target configuration file is loaded for access by the machine corresponding to the first IP address set.

[0119] If the interactive instruction is an operation to modify a rule version, the first tool is reloaded, the second tool is restarted, and the modified target configuration file is loaded for access by the machine corresponding to the second IP address set.

[0120] If the interactive instruction is an operation of modifying or deleting a target rule, the second tool is restarted and the modified target configuration file is loaded for access by a machine corresponding to the preset IP address set.

[0121] As for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.

[0122] Figure 6 The schematic diagram of the structure of an embodiment of the firewall rule configuration device of the present invention is shown. The specific embodiment of the present invention does not limit the specific implementation of the firewall rule configuration device.

[0123] like Figure 6 As shown, the firewall rule configuration device may include: a processor (processor) 602, a communication interface (Communications Interface) 604, a memory (memory) 606, and a communication bus 608.

[0124] The processor 602, the communication interface 604, and the memory 606 communicate with each other via a communication bus 608. The communication interface 604 is used to communicate with other devices such as a client or other server network elements. The processor 602 is used to execute a program 610, which can specifically execute the relevant steps in the above-mentioned embodiment of the configuration method for firewall rules.

[0125] Specifically, the program 610 may include program code including computer executable instructions.

[0126] The processor 602 may be a central processing unit (CPU), or an application-specific integrated circuit (ASIC), or one or more integrated circuits configured to implement the embodiment of the present invention. The one or more processors included in the firewall rule configuration device may be processors of the same type, such as one or more CPUs; or may be processors of different types, such as one or more CPUs and one or more ASICs.

[0127] The memory 606 is used to store the program 610. The memory 606 may include a high-speed RAM memory, and may also include a non-volatile memory (non-volatile memory), such as at least one disk memory.

[0128] The algorithms or displays provided herein are not inherently related to any particular computer, virtual system or other device. In addition, the embodiments of the present invention are not directed to any particular programming language.

[0129] In the description provided herein, a large number of specific details are described. However, it is understood that embodiments of the present invention can be practiced without these specific details. Similarly, in order to simplify the present invention and help understand one or more of the various inventive aspects, in the above description of exemplary embodiments of the present invention, the various features of the embodiments of the present invention are sometimes grouped together into a single embodiment, figure, or description thereof. Wherein, the claims that follow the specific embodiment are hereby expressly incorporated into the specific embodiment, wherein each claim itself is a separate embodiment of the present invention.

[0130] Those skilled in the art will appreciate that the modules in the devices in the embodiments may be adaptively changed and arranged in one or more devices different from the embodiments. The modules or units or components in the embodiments may be combined into one module or unit or component, and further may be divided into a plurality of submodules or subunits or subcomponents. Except that at least some of such features and / or processes or units are mutually exclusive.

[0131] It should be noted that the above embodiments illustrate the present invention rather than limit it, and that those skilled in the art may devise alternative embodiments without departing from the scope of the appended claims. In the claims, any reference symbol between brackets shall not be construed as a limitation on the claims. The word "comprising" does not exclude the presence of elements or steps not listed in the claims. The word "one" or "an" preceding an element does not exclude the presence of a plurality of such elements. The present invention may be implemented by means of hardware comprising a number of different elements and by means of a suitably programmed computer. In a unit claim enumerating a number of devices, several of these devices may be embodied by the same hardware item. The use of the words first, second, and third, etc. does not indicate any order. These words may be interpreted as names. The steps in the above embodiments, unless otherwise specified, should not be understood as limitations on the order of execution.

Claims

1. A method for configuring firewall rules, characterized in that: The method comprises: When receiving an interactive instruction for the operation rule of the target server, obtaining user input data and loading a target configuration file on the target server; The target configuration file stores the firewall rules currently running on the target server and its firewall rule ID and IP address set; According to the interactive instruction and the user input data, modify one or more of the IP address set, firewall rules and version of the target configuration file accordingly; Based on the modified target configuration file, the first tool and the second tool of the target machine are operated, managed and controlled to complete the configuration of the preset IP address firewall rules; The first tool is used for IP configuration management, and the second tool is used for firewall rule management and access control management of the target server port.

2. The method for configuring firewall rules according to claim 1, characterized in that: Before loading the target configuration file on the target machine, the method further includes: If the target machine does not have the first tool or the second tool installed, the corresponding tool is installed in the target machine.

3. The method for configuring firewall rules according to claim 1, characterized in that: According to the interactive instruction and the user input data, one or more of the IP address set, firewall rules and version of the target configuration file are modified accordingly, including: If the interactive instruction is an operation of adding a target rule, the user input data includes a first IP address set, a target rule, and a target rule ID; Writing the first IP address set into a target configuration file; Based on a preset field in a preset table in the target configuration file, a writing position of the target rule is determined; and according to the writing position, the target rule is written into the preset table.

4. The method for configuring firewall rules according to claim 3, characterized in that: The operation management and control of the first tool and the second tool of the target machine based on the modified target configuration file to complete the configuration of the preset IP address firewall rules includes: Reload the first tool, restart the second tool, and load the modified target configuration file for access by the machine corresponding to the first IP address set.

5. The method for configuring firewall rules according to claim 1, characterized in that: According to the interactive instruction and the user input data, one or more of the IP address set, firewall rules and version of the target configuration file are modified accordingly, further comprising: If the interactive instruction is an operation to modify a rule version, a corresponding configuration file is obtained from a database according to the user input data as a modified target configuration file; the target configuration file includes a second IP address set; The database is used to store configuration files of all versions.

6. The method for configuring firewall rules according to claim 5, characterized in that: The operation management and control of the first tool and the second tool of the target machine based on the modified target configuration file to complete the configuration of the preset IP address firewall rules includes: Reload the first tool, restart the second tool, and load the modified target configuration file for access by the machine corresponding to the second IP address set.

7. The method for configuring firewall rules according to claim 1, characterized in that: According to the interactive instruction and the user input data, one or more of the IP address set, firewall rules and version of the target configuration file are modified accordingly, including: If the interactive instruction is an operation of modifying or deleting a target rule, the port access control state of the preset IP address set of the target configuration file is modified according to the user input data, and the position of the target rule is located in the target configuration file according to the target rule ID to modify or delete the target rule.

8. The method for configuring firewall rules according to claim 7, characterized in that: The operation management and control of the first tool and the second tool of the target machine based on the modified target configuration file to complete the configuration of the preset IP address firewall rules includes: Restart the second tool and load the modified target configuration file for access by the machine corresponding to the preset IP address set.

9. A firewall rule configuration device, characterized in that: The device comprises: a loading module, a modifying module and an updating module; The loading module is used to obtain user input data and load the target configuration file on the target server when receiving an interactive instruction for the operation rule of the target server; The target configuration file stores the firewall rules currently running on the target server and its firewall rule ID and IP address set; The modification module is used to modify one or more of the IP address set, firewall rules and version of the target configuration file accordingly according to the interactive instruction and the user input data; The update module is used to perform operation management and control on the first tool and the second tool of the target machine based on the modified target configuration file to complete the configuration of the preset IP address firewall rules; The first tool is used for IP configuration management, and the second tool is used for firewall rule management and access control management of the target server port.

10. A computer-readable storage medium, characterized in that: The storage medium stores at least one executable instruction. When the executable instruction is executed on a firewall rule configuration device / apparatus, the device / apparatus executes the operation of the firewall rule configuration method according to any one of claims 1 to 7.