Network access control method and device, equipment and storage medium
By obtaining and utilizing the access information of the application and preset interception policies, combining kernel-level interception and server management, it solves the problem that traditional firewalls are difficult to achieve refined interception control, and improves the security of network resources and the accuracy of access control.
Patent Information
- Application Number
- CN202411108167.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-13
- Publication Date
- 2024-11-19
AI Technical Summary
Traditional firewall technology is difficult to achieve refined interception control when multiple applications access the same network resource at the same time, resulting in reduced network resource security.
By obtaining access information of each application and preset interception policy, determine the target interception policy of each application, including network segment interception policy and process identification interception policy, perform network access control, and use the kernel layer to intercept the target system call function to Get accurate access information and centrally store and manage interception policies through the server to improve the accuracy of access control.
Achieve finer granular and flexible network access control, improves the security of applications accessing network resources, enhances defense against malicious and unauthorized access, and ensures that only compliant applications can access target network resources.
Smart Images

Figure CN118984240A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the field of network security technology, and relate to but are not limited to a network access control method and apparatus, device, and storage medium. Background Art
[0002] Firewalls have always played a very important role in maintaining network security. However, traditional firewall technology uses global interception or simply disconnects the network to intercept unsafe access, which makes it difficult to achieve refined interception. For example, when multiple applications access the same network resource at the same time, it is difficult to distinguish the traffic of each application, and thus it is impossible to perform precise access control for each application or specific application. Therefore, using traditional firewall technology for network security protection cannot achieve precise access control, thereby reducing the security of network resources. Summary of the invention
[0003] In view of this, a network access control method, apparatus, device, and storage medium provided in an embodiment of the present application are implemented as follows:
[0004] An embodiment of the present application provides a network access control method, which is applied to an electronic device, and the method includes:
[0005] Acquire access information of each application upon detecting a network access request of at least one application, the access information including an application identification parameter, a login parameter, and a network environment parameter, the network access request being generated by the at least one application accessing a target network resource of the electronic device;
[0006] Determine the target interception strategy corresponding to each application according to the access information and the preset interception strategy, wherein the target interception strategy includes a network segment interception strategy and / or a process identifier interception strategy, and the preset interception strategy includes a correspondence between the access information and the interception strategy, and different access information corresponds to different interception strategies;
[0007] Network access control is performed on each application according to the target interception strategy corresponding to each application.
[0008] The embodiments of the present application achieve finer-grained and more flexible network access control. When multiple applications access the same network resource at the same time, the access of each application can be precisely controlled, thereby improving the security of the application's access to network resources.
[0009] In some embodiments, the electronic device includes a user layer and a kernel layer, the electronic device establishes a communication connection with a server, the server stores the preset interception strategy, and the method further includes:
[0010] Obtaining the preset interception strategy from the server through the preset main program of the user layer;
[0011] Sending the preset interception strategy from the user layer to the kernel layer through the read-write device descriptor between the user layer and the kernel layer;
[0012] The preset interception strategy is stored in the kernel layer.
[0013] In this embodiment, the preset interception strategy is centrally stored and managed by the server, which facilitates the unified update and maintenance of the strategy, and the latest interception strategy is dynamically obtained from the server by the user layer main program and sent to the kernel layer, thereby improving the accuracy of access control. At the same time, access control through the kernel layer can more effectively control and filter network traffic and enhance the defense capability against malicious access and unauthorized access.
[0014] In some embodiments, the network access request is generated by the at least one application program sending a network data packet to the target network resource by triggering a target system call function of the kernel layer, and obtaining access information of each application program includes:
[0015] The target system call function is intercepted to obtain access information of each application program through a preset interception program of the kernel layer, wherein the preset interception program corresponds to the access information.
[0016] In this embodiment, by intercepting the target system call function at the kernel layer, the access information of each application can be accurately obtained, so that the access control of the application to network resources can be timely and accurately performed, thereby improving the response speed of the network interception technology.
[0017] In some embodiments, the target system call function is intercepted by a hook function, and before intercepting the target system call function, the method further includes:
[0018] A preset kernel module is loaded into the kernel layer through a preset command line tool, wherein the preset kernel module is obtained by writing the preset interception program into the hook function.
[0019] In this embodiment, without affecting the interception function of the hook function, the user is allowed to customize the design of the interception program, which further improves the refined management and personalized management capabilities of multiple application programs and improves the security of network resources.
[0020] In some embodiments, performing network access control on each application according to the target interception policy corresponding to each application includes:
[0021] According to the type of the target interception strategy corresponding to each application, acquiring the target discrimination parameter corresponding to each application from the access information, wherein the target discrimination parameter corresponding to each application and the type of the target interception strategy corresponding to each application are in a one-to-one correspondence;
[0022] Network access control is performed on each application according to the target discrimination parameter corresponding to each application and the target interception strategy corresponding to each application.
[0023] In this embodiment, the discrimination parameters of each application program can be quickly determined through the types of different interception policies, thereby improving the response speed of network access control for each application program.
[0024] In some embodiments, when the type of the target interception policy is the network segment interception policy, the target discrimination parameter is the IP address corresponding to the application, when the type of the target interception policy is the process identifier interception policy, the target discrimination parameter is the process identifier corresponding to the application, and when the type of the target interception policy is the network segment interception policy and the process identifier interception policy, the target discrimination parameter is the IP address and process identifier corresponding to the application;
[0025] The process identifier is generated by each application triggering a target system call function of the kernel layer.
[0026] In this embodiment, by setting a variety of interception strategies and the corresponding relationship between the judgment parameters and the interception strategies, a finer-grained and more flexible network access control is achieved, the interception error rate is reduced, and malicious applications can be more effectively prevented from infringing on network resources.
[0027] In some embodiments, each interception strategy includes different preset interception parameters, and the network access control for each application is performed according to the target discrimination parameter corresponding to each application and the target interception strategy corresponding to each application, including:
[0028] Determine whether the target discrimination parameter corresponding to each application program hits the preset interception parameter of the target interception strategy corresponding to each application program, the preset interception parameter corresponding to the network segment interception strategy is a preset IP address, and the preset interception parameter corresponding to the process identifier interception strategy is a preset process identifier;
[0029] Control the network access request corresponding to the application program that does not hit the preset interception parameter in the target discrimination parameter corresponding to each application program to access the target network resource;
[0030] The network access request corresponding to the application program that hits the preset interception parameter in the target identification parameter corresponding to each application program is intercepted.
[0031] In this embodiment, by determining whether the target discrimination parameters match the preset interception parameters, precise control of the network access of each application is achieved, ensuring that only compliant applications can access the target network resources.
[0032] An embodiment of the present application provides a network access control device, which is applied to an electronic device. The device includes an acquisition module, a determination module, and a control module, wherein:
[0033] The acquisition module is used to acquire access information of each application program when a network access request of at least one application program is detected, wherein the access information includes an application identification parameter, a login parameter, and a network environment parameter, and the network access request is generated by the at least one application program accessing a target network resource of the electronic device;
[0034] The determination module is used to determine the target interception strategy corresponding to each application according to the access information and the preset interception strategy, the target interception strategy includes a network segment interception strategy and / or a process identifier interception strategy, the preset interception strategy includes a correspondence between the access information and the interception strategy, and different access information corresponds to different interception strategies;
[0035] The control module is used to perform network access control on each application according to the target interception strategy corresponding to each application.
[0036] The computer device provided in the embodiment of the present application includes a memory and a processor, wherein the memory stores a computer program that can be run on the processor, and when the processor executes the program, the method described in the embodiment of the present application is implemented.
[0037] The computer-readable storage medium provided in the embodiment of the present application stores a computer program thereon, and when the computer program is executed by a processor, the method described in the embodiment of the present application is implemented.
[0038] The computer program product provided in the embodiments of the present application includes a computer program, and when the computer program is executed by a processor, the method described in the embodiments of the present application is implemented. BRIEF DESCRIPTION OF THE DRAWINGS
[0039] The drawings herein are incorporated into the specification and constitute a part of the specification. These drawings illustrate embodiments consistent with the present application and are used together with the specification to illustrate the technical solution of the present application.
[0040] Figure 1 It is a flowchart of a network access control method disclosed in an embodiment of the present application;
[0041] Figure 2 is a schematic diagram of the system architecture of the electronic device disclosed in the embodiment of the present application;
[0042] Figure 3 It is a flowchart of another network access control method disclosed in an embodiment of the present application;
[0043] Figure 4 It is a schematic diagram of an application scenario for obtaining a preset interception strategy disclosed in an embodiment of the present application;
[0044] Figure 5 It is a flowchart of another network access control method disclosed in an embodiment of the present application;
[0045] Figure 6 It is a logical schematic diagram of network access control for at least one application program disclosed in an embodiment of the present application;
[0046] Figure 7 It is a structural diagram of a network access control device disclosed in an embodiment of the present application;
[0047] Figure 8 It is a structural schematic diagram of a computer device disclosed in an embodiment of the present application. DETAILED DESCRIPTION
[0048] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the specific technical solution of the present application will be further described in detail below in conjunction with the drawings in the embodiments of the present application. The following embodiments are used to illustrate the present application, but are not used to limit the scope of the present application.
[0049] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art to which this application belongs. The terms used herein are only for the purpose of describing the embodiments of this application and are not intended to limit this application.
[0050] In the following description, reference is made to “some embodiments”, which describe a subset of all possible embodiments, but it will be understood that “some embodiments” may be the same subset or different subsets of all possible embodiments and may be combined with each other without conflict.
[0051] It should be pointed out that the terms "first\second\third" involved in the embodiments of the present application are used to distinguish similar or different objects, and do not represent a specific ordering of the objects. It can be understood that "first\second\third" can be interchanged in a specific order or sequence where permitted, so that the embodiments of the present application described here can be implemented in an order other than that illustrated or described here.
[0052] As one of the best tools for protecting network security, firewalls have the ability to intercept and filter network traffic. They are often used to monitor and control data packets in and out of the network, allowing traffic that complies with security policies to pass through, and blocking or warning suspicious or malicious traffic. In the field of network security, by setting firewall interception policies, you can block unauthorized access to certain network segments or ports to manage network access rights, protect the network from malicious traffic, help prevent malicious attackers and bad elements from invading the network, and protect key network resources from damage. It can be seen that the role of firewalls in network security is indispensable and is an important part of maintaining network security.
[0053] However, traditional firewall technology often adopts a unified interception strategy, that is, a global interception method or a simple network disconnection method to intercept unsafe access, which results in the same interception strategy for all traffic. It can be seen that traditional firewall technology has limitations in achieving precise interception control. For example, when multiple applications use the same port to access the same network resource at the same time, the current TCP (transmission control protocol) network packet interception technology usually has difficulty distinguishing which application the traffic belongs to, and it is difficult to distinguish the traffic of each application, and thus it is impossible to perform precise access control for each application or specific application, which may lead to misinterception or ineffective control. Therefore, the traditional firewall technology is not detailed and flexible enough for network access control, which reduces the security of network resources.
[0054] Based on the above analysis, it can be seen that due to the limitation of existing firewall technology, when multiple applications access the same network resource at the same time, it is impossible to achieve refined interception control, thus failing to effectively ensure the security of network resources. Therefore, how to improve the security of network access has become an urgent problem to be solved.
[0055] In view of this, the embodiments of the present application provide a network access control method and apparatus, device, and storage medium. The method is applied to electronic devices. When a network access request of at least one application is detected, the target interception policy corresponding to each application is determined through the access information of each application and the preset interception policy, so that network access control is performed on each application according to the target interception policy corresponding to each application. The embodiments of the present application solve the technical problem that the related technology can only perform global interception or simply disconnect the system network, and realizes more fine-grained and flexible network access interception. When multiple applications access the same network resource at the same time, the access of each application can be precisely controlled, thereby improving the security of application access to network resources.
[0056] In order to make the purpose and technical solution of the present application clearer and more intuitive, a network access control method disclosed in the present application is described in detail below with reference to the accompanying drawings.
[0057] See also Figure 1 , Figure 1 Schematic diagram of a network access control method disclosed in the embodiment of the present application. Figure 1 The method shown is applied to an electronic device.
[0058] It should be understood that the electronic devices involved in the present application may be mobile phones, tablet computers, laptop computers, mobile Internet devices (MID), wearable devices, virtual reality (VR) devices, augmented reality (AR) devices, headphones, terminals in industrial control, terminals in self-driving, personal digital assistants (PDA), etc., and the embodiments of the present application are not limited to this.
[0059] For example, Figure 2 Schematic diagram of the system architecture of the electronic device disclosed in the embodiment of this application. Figure 2 As shown, the electronic device includes components such as a processor 201, a transceiver 202, a register 203, a memory 204, an input unit 205, a display unit 206, a sensor 207, and a power module 208. Although not shown, the electronic device may also include a camera. Optionally, the position of the camera on the electronic device may be front-mounted or rear-mounted, which is not limited in the embodiments of the present application.
[0060] It is to be understood that the structures illustrated in the embodiments of the present application do not constitute specific limitations on the electronic device. In other embodiments of the present application, the electronic device may include more or fewer components than shown in the figure, or combine certain components, or split certain components, or arrange the components differently. The components shown in the figure may be implemented in hardware, software, or a combination of software and hardware.
[0061] like Figure 1 The method shown may include the following steps:
[0062] Step 101, when a network access request of at least one application is detected, access information of each application is obtained, the access information including application identification parameters, login parameters and network environment parameters, and the network access request is generated by at least one application to access a target network resource of an electronic device.
[0063] Various applications can be installed on the electronic device involved in the present application. When a user uses at least one application and accesses a target network resource of the electronic device through the network, each application can send a network access request to the target network resource, that is, the network access request is generated by at least one application accessing the target network resource of the electronic device.
[0064] Optionally, the electronic device involved in the present application is installed with a network monitoring tool or network monitoring software, and the electronic device includes a network access interface, and a network access request of at least one application is detected, including: detecting a data packet passing through the network access interface through the network monitoring tool or network monitoring software of the electronic device, and when the data packet of the network access interface is detected as a preset data feature, determining that a network access request of at least one application to access a target network resource of the electronic device is detected, wherein the preset data feature includes that the source IP address of the data packet is related to at least one preset application, or, the target IP address of the data packet is related to at least one preset network resource, or, the protocol type used by the data packet (such as TCP, UDP, ICMP) complies with the communication protocol of at least one preset application.
[0065] In the embodiment of the present application, different applications have different permissions to access target network resources of the electronic device, and when different users use the same application, the application has different permissions to access target network resources of the electronic device, and for some target network resources with higher confidentiality, different access permissions can be set according to the security level of the network environment where the application is located. The security of the network resources of the electronic device can be improved through permission management.
[0066] Specifically, in order to improve the access security of network resources of electronic devices and accurately control the network access request of each application to access the target network resources, a corresponding target interception strategy can be configured in advance for each application. Specifically, the corresponding target interception strategy can be configured according to the preset access information corresponding to each application. The preset access information of each application includes the preset application identification parameters, preset login parameters and preset network environment parameters of each application.
[0067] It should be noted that the preset application identification parameters include the name, ID or version number of the application, etc., which are used to characterize different applications. The preset login parameters include the account number and password entered by the user when using the application, etc., to characterize the identity information of different users. The preset network environment parameters include the network security level, network bandwidth, delay or signal strength, etc., to characterize the operating environment of each application.
[0068] Exemplarily, preset application identification parameters of the applications that need to be controlled can be pre-set, and then the corresponding target interception policy can be configured for each application according to the preset login parameters of each user when using the application and the preset network environment parameters of each application when using the application. When a network access request of at least one application is detected, the access information of each application can be quickly obtained, and the target interception policy corresponding to each application can be determined according to the access information of each application.
[0069] In an embodiment of the present application, the network access request includes access information of each application, wherein the access information of each application includes an application identification parameter, a login parameter, and a network environment parameter of each application. When a network access request of at least one application is detected, the access information of each application can be obtained from the network access request.
[0070] For example, when a user uses the query function of a social software to search for images on a website, a network access request will be automatically generated. The network access request includes the access information of the social software, including the name of the social software, the user's account and password for logging into the social software, and the network security level and network bandwidth of the current social software.
[0071] Step 102, based on the access information and the preset interception strategy, determine the target interception strategy corresponding to each application, the target interception strategy includes the network segment interception strategy and / or the process identification interception strategy, the preset interception strategy includes the correspondence between the access information and the interception strategy, and different access information corresponds to different interception strategies.
[0072] In an embodiment of the present application, the electronic device involved in the present application stores at least one interception strategy. Exemplarily, at least one interception strategy may include a network segment interception strategy and a process identifier interception strategy. Among them, the network segment interception strategy refers to intercepting an IP address by preset, and identifying the IP address of the application. As long as the IP address is the same as the preset interception IP address, the network data packet sent or received by the IP address is intercepted, and network access control can be effectively performed based on the IP address. The process identifier interception strategy refers to intercepting the process PID identification information by preset, and identifying the process PID identification information of the application. As long as the process PID identification information is the same as the preset interception process PID identification information, the network data packet generated by the application corresponding to the process PID identification information is intercepted, and network access control can be effectively performed based on the process PID identification information.
[0073] It should be noted that the above-mentioned interception strategies include only one or more examples of the present application. Those skilled in the art may preset other different interception strategies according to actual needs, and the present application does not limit this.
[0074] In the embodiment of the present application, a corresponding target interception strategy can be pre-configured for each application according to the access information of each application to obtain a preset interception strategy. It can be understood that the preset interception strategy includes the corresponding relationship between the access information and the interception strategy, and different access information corresponds to different interception strategies.
[0075] Optionally, the electronic device pre-configures a corresponding target interception strategy for each application according to the access information of each application, obtains the preset interception strategy, and stores the preset interception strategy in the target storage location. The flexibility and efficiency of network access control can be improved by saving the preset interception strategy.
[0076] Furthermore, the target interception strategy corresponding to each application can be at least one of a network segment interception strategy and a process identification interception strategy. For example, the interception strategy of application 1 is preset as a network segment interception strategy, the interception strategy of application 2 is preset as a process identification interception strategy, and the interception strategy of application 3 is preset as a network segment interception strategy and a process identification interception strategy.
[0077] It should be noted that the present application can also pre-configure corresponding target interception policies only for specific applications, that is, only perform network access control on network access requests of specific applications.
[0078] In an embodiment of the present application, when a network access request of at least one application is detected and the access information of each application is obtained, a corresponding target interception strategy can be determined for each application according to the access information of each application and the preset interception strategy, and the target interception strategy includes a network segment interception strategy and / or a process identification interception strategy. Optionally, before determining the corresponding target interception strategy for each application according to the access information of each application and the preset interception strategy, the preset interception strategy can be obtained from the target storage location.
[0079] Step 103: Perform network access control on each application according to the target interception policy corresponding to each application.
[0080] In an embodiment of the present application, network access control is performed on each application according to the target interception policy corresponding to each application, including: controlling network access requests corresponding to applications that do not hit the target interception policy to access the target network resources; intercepting network access requests corresponding to applications that hit the target interception policy.
[0081] It can be seen that the implementation of the embodiments of the present application achieves finer-grained and more flexible network access control. When multiple applications access the same network resource at the same time, the access of each application can be precisely controlled, thereby improving the security of the application's access to network resources.
[0082] See also Figure 3 , Figure 3 A flowchart of another network access control method provided by an embodiment of the present application. Figure 3 The method shown may include the following steps:
[0083] Step 301, when a network access request of at least one application is detected, a target system call function is intercepted to obtain access information of each application through a preset interception program of the kernel layer, and the preset interception program corresponds to the access information.
[0084] Electronic devices include a user layer and a kernel layer. The user layer is the top layer of the operating system, where users can use various applications, and the kernel layer is responsible for important tasks such as managing and controlling electronic device hardware resources and providing key functions, such as intercepting applications and managing application processes.
[0085] In an embodiment of the present application, an application may initiate a call request to a system call function of a kernel layer through a system call function of a user layer, and the call request may be captured by the kernel layer so that the application may interact with the kernel layer.
[0086] Among them, the system call function of the user layer and the system call function of the kernel layer are in a one-to-one correspondence. The user layer of the electronic device includes at least one system call function (for example, send, recv, etc.). The kernel layer of the electronic device includes at least one system call function (for example, sys_sendto, sys_recvfrom, etc.). Further, at least one system call function of the kernel layer includes a target system call function. The target system call function is a target system call function of the kernel layer that needs to be called when at least one application accesses a target network resource.
[0087] In the embodiment of the present application, the network access request is generated by at least one application sending a network data packet to the target network resource by triggering the target system call function of the kernel layer. It is understandable that when at least one application network requests access to the target network resource, the network access request can be generated by triggering the target system call function of the kernel layer to send a network data packet to the target network resource.
[0088] For example, when an application sends a network access request to a target network resource, it will send and receive TCP network data packets. The application will call the user layer's send, recv and other system call functions to initiate a system call. The call request will be captured by the kernel layer, and the parameters passed through the system call will be obtained. The kernel layer will then use these parameters as the system call number to index and find the corresponding sys_sendto, sys_recvfrom and other system call functions in the system call table sys_call_table array to generate a network access request. Among them, the sys_sendto, sys_recvfrom and other system call functions have unique corresponding parameters (for example, parameter 0 can correspond to the sys_sendto function, and parameter 1 can correspond to the sys_recvfrom function), so that the corresponding function can be found through the parameters.
[0089] Optionally, the kernel layer of the electronic device includes a system call table, and the system function call table stores the entry addresses of various system call functions of the kernel layer. The entry address of the system call function indicates the location of the code that calls the system call function in the kernel. Specifically, when the application initiates a system call request to the target system call function of the kernel layer through the system call function of the user layer, the kernel layer can obtain the entry address of the target system call function from the system function call table through the system call number, and jump to the address to execute the operation of the target system call function to initiate a network access request to the target network resource, so as to generate a network access request.
[0090] In an embodiment of the present application, when a network access request of at least one application is detected, access information of each application can be obtained by intercepting a target system call function.
[0091] Optionally, the target system call function of the kernel layer can be intercepted by a hook hook function. The hook hook function includes a preset interception program, and the preset interception program is used to intercept the target system call function. Exemplarily, the hook hook function is stored in the system call table, and the target system call function of the kernel layer is intercepted by the hook hook function, including: intercepting the target system call function of the kernel layer by the hook hook function of the system call table; wherein the target system call function includes functions such as sys_sendto and sys_recvfrom.
[0092] As an optional implementation, before intercepting the target system call function, a preset kernel module is loaded into the kernel layer through a preset command line tool, and the preset kernel module is obtained by writing a preset interception program into a hook function.
[0093] It should be noted that the user can customize the preset interception program to be written into the hook function in advance according to the access information of the application program to obtain the preset kernel module, wherein the preset interception program corresponds to the access information.
[0094] Furthermore, a preset command line tool is used to load a preset kernel module into the kernel layer, so that the kernel layer includes a preset interception program. Since the preset interception program corresponds to the access information, the access information of each application can be obtained through the preset interception program of the kernel layer.
[0095] For example, a preset interception program can be written into a hook function in advance to obtain a preset kernel module (e.g., mykernel.ko kernel module), and the preset kernel module is loaded into the kernel layer through the insmod command. The preset kernel module includes a hook function in which the preset interception program has been written, and the hook function is used to intercept the target system call function of the kernel layer.
[0096] This implementation allows users to customize the design of interception programs without affecting the interception function of the hook function, further improving the refined and personalized management and control capabilities of multiple applications and improving the security of network resources.
[0097] Step 302, obtaining a preset interception strategy from a server through a preset main program of the user layer.
[0098] In the embodiment of the present application, the electronic device and the server establish a communication connection, and the server stores the preset interception strategy. The pre-configured preset interception strategy is stored in the server, which is convenient for the user to uniformly manage and update the preset interception strategy without occupying the storage space of the electronic device.
[0099] In an embodiment of the present application, a preset main program may be pre-written in the user layer, and the preset main program is used to obtain a preset interception strategy from a server and store the preset interception strategy in the user layer.
[0100] For example, a main program myMain module may be compiled at the user layer, and the preset interception strategy of the server may be obtained through the main program myMain module at the user layer.
[0101] Step 303: Send the preset interception policy from the user layer to the kernel layer by reading and writing the device descriptor between the user layer and the kernel layer.
[0102] The read-write device descriptor between the user layer and the kernel layer is used to complete data reading and writing between the user layer and the kernel layer. Exemplarily, the read-write device descriptor has data reading and writing functions, and the read-write device descriptor can be / dev / myDeviceDesc, which is not limited in this application.
[0103] In an embodiment of the present application, the preset interception policy of the user layer can be transmitted to the kernel layer through the read and write device descriptors between the user layer and the kernel layer, and the preset interception policy can be stored in the kernel layer.
[0104] For example, the preset interception policy of the user layer can be transferred to the kernel layer by reading and writing the device descriptor / dev / myDeviceDesc and stored in the kernel layer.
[0105] Step 304: store the preset interception strategy in the kernel layer.
[0106] Optionally, the preset interception strategy is stored in a preset kernel module of the kernel layer. For example, the preset interception strategy can be stored in the mykernel.ko kernel module of the kernel layer.
[0107] For example, see Figure 4 , Figure 4 Schematic diagram of the application scenario of obtaining the preset interception strategy disclosed in the embodiment of the present application. Figure 4 As shown, the application scenario may include a server 41, an electronic device 42, and the electronic device includes a user layer 421 and a kernel layer 422, wherein the user layer 421 includes a preset main program 4211. Specifically, the user layer 421 sends an instruction to obtain a preset interception strategy to the server 41 through the preset main program 4211, and the server 41 responds to the instruction and sends the preset interception strategy to the user layer 421; further, the user layer 421 of the electronic device sends the preset interception strategy obtained from the server 41 to the kernel layer 422 of the electronic device, so as to store the preset interception strategy in the kernel layer 422 of the electronic device.
[0108] Step 305, based on the access information and the preset interception strategy, determine the target interception strategy corresponding to each application, the target interception strategy includes the network segment interception strategy and / or the process identification interception strategy, the preset interception strategy includes the correspondence between the access information and the interception strategy, and different access information corresponds to different interception strategies.
[0109] Step 306: Perform network access control on each application according to the target interception policy corresponding to each application.
[0110] For other implementations of steps 305 to 306 , reference may be made to the contents of steps 102 to 103 , which will not be described in detail here.
[0111] It can be seen that the implementation of the embodiment of the present application realizes finer granularity and more flexible network access control. When multiple applications access the same network resource at the same time, the access of each application can be precisely controlled, thereby improving the security of the application's access to network resources. By intercepting the target system call function at the kernel layer, the access information of each application can be accurately obtained, so that the access control of the application to network resources can be timely and accurately performed, thereby improving the response speed of the network interception technology. The preset interception strategy is centrally stored and managed by the server, which facilitates the unified update and maintenance of the strategy, and the latest interception strategy is dynamically obtained from the server through the user layer main program and sent to the kernel layer, thereby improving the accuracy of access control. At the same time, by performing access control at the kernel layer, network traffic can be more effectively controlled and filtered, and the defense capability against malicious access and unauthorized access can be enhanced.
[0112] See also Figure 5 , Figure 5 A flowchart of another network access control method provided in an embodiment of the present application. Figure 5 The method shown may include the following steps:
[0113] Step 501, when a network access request of at least one application is detected, access information of each application is obtained, the access information including application identification parameters, login parameters and network environment parameters, and the network access request is generated by at least one application to access a target network resource of an electronic device.
[0114] Step 502, based on the access information and the preset interception strategy, determine the target interception strategy corresponding to each application, the target interception strategy includes the network segment interception strategy and / or the process identification interception strategy, the preset interception strategy includes the correspondence between the access information and the interception strategy, and different access information corresponds to different interception strategies.
[0115] For other implementations of steps 501 to 502 , reference may be made to the contents of steps 101 to 102 and steps 301 to 305 , which will not be described in detail here.
[0116] Step 503, according to the type of target interception policy corresponding to each application, the target discrimination parameter corresponding to each application is obtained from the access information, and the target discrimination parameter corresponding to each application is in a one-to-one correspondence with the type of target interception policy corresponding to each application.
[0117] In an embodiment of the present application, after determining the target interception policy corresponding to each application, the type of the target interception policy corresponding to each application is identified, and the type of the target interception policy includes a network segment interception policy and / or a process identifier interception policy.
[0118] In the embodiment of the present application, the access information of each application includes the target discrimination parameters corresponding to each application, and the target discrimination parameters include an IP address and / or a process identifier. The IP address is the IP address of each application sending a network data packet, and the process identifier is the process PID identification information corresponding to the process generated by the target system call function of the kernel layer triggered by each application.
[0119] It should be noted that the process PID identification information is usually automatically assigned a unique identifier to each process when the application triggers a target system call function in the kernel layer.
[0120] In order to achieve accurate access control for network access requests initiated by each application, a one-to-one correspondence is established in advance between the target discrimination parameter corresponding to each application and the type of target interception policy corresponding to each application. Therefore, the properties of the target discrimination parameter corresponding to each application can be determined according to the type of target interception policy corresponding to each application, and the target discrimination parameter corresponding to each application can be obtained from the access information.
[0121] In the embodiment of the present application, when the type of the target interception policy is the network segment interception policy, the target discrimination parameter is the IP address corresponding to the application program; when the type of the target interception policy is the process identifier interception policy, the target discrimination parameter is the process identifier corresponding to the application program; when the type of the target interception policy is the network segment interception policy and the process identifier interception policy, the target discrimination parameter is the IP address and process identifier corresponding to the application program;
[0122] The process ID is generated by each application triggering a target system call function in the kernel layer.
[0123] By adopting the embodiments of the present application, by setting multiple interception strategies and the correspondence between judgment parameters and interception strategies, finer-grained and more flexible network access control is achieved, the interception error rate is reduced, and malicious applications can be more effectively prevented from infringing on network resources.
[0124] Step 504: Perform network access control on each application program according to the target identification parameter corresponding to each application program and the target interception policy corresponding to each application program.
[0125] In an embodiment of the present application, each interception strategy includes different preset interception parameters. Among them, the preset interception parameters corresponding to the network segment interception strategy include a preset IP address. The preset interception parameters corresponding to the process identifier interception strategy include a preset process identifier. For example, the preset process identifier can be a process identifier of WeChat, Baidu, Google browser, etc. The preset IP address can be an IP network segment of 192.168.1.10 to 192.168.1.200.
[0126] It should be noted that those skilled in the art can set the preset IP address and the preset process identifier according to actual needs, and this application does not limit this.
[0127] As an optional implementation, network access control is performed on each application according to the target discrimination parameter corresponding to each application and the target interception strategy corresponding to each application, including:
[0128] Determine whether the target discrimination parameter corresponding to each application program hits the preset interception parameter of the target interception strategy corresponding to each application program, the preset interception parameter corresponding to the network segment interception strategy is the preset IP address, and the preset interception parameter corresponding to the process identifier interception strategy is the preset process identifier;
[0129] Control the network access request corresponding to the application program that does not hit the preset interception parameter in the target discrimination parameter corresponding to each application program to access the target network resource;
[0130] Intercept the network access request corresponding to the application program that hits the preset interception parameter in the target discrimination parameter corresponding to each application program.
[0131] It should be noted that if the target interception strategy corresponding to the application is the network segment interception strategy and the process ID interception strategy, it is necessary to make a comprehensive judgment on the IP address and process ID corresponding to the application and the preset IP address and preset process ID respectively. This combination strategy can provide a more detailed and flexible network access control method, which can not only perform large-scale access control based on IP addresses, but also perform precise process control based on process IDs, thereby improving the overall network security and management efficiency. For example, you can set up to intercept network access requests for the IP network segment of 192.168.1.10 to 192.168.1.200 on the Google browser.
[0132] It can be understood that when the target discrimination parameter of the application is the same as the preset interception parameter of the target interception policy corresponding to the application, it means that the target discrimination parameter corresponding to the application hits the preset interception parameter, and the application that hits the preset interception parameter needs to be intercepted and is not allowed to access the target network resource. When the target discrimination parameter of the application is different from the preset interception parameter of the target interception policy corresponding to the application, it means that the target discrimination parameter corresponding to the application does not hit the preset interception parameter, and the application that does not hit the preset interception parameter can be allowed to access the target network resource.
[0133] By adopting the above optional implementation mode, by determining whether the target identification parameter matches the preset interception parameter, precise control of the network access of each application is achieved, ensuring that only compliant applications can access the target network resources.
[0134] For example, see Figure 6 , Figure 6 Schematic diagram of the logic of controlling network access to at least one application program disclosed in the embodiment of the present application. Figure 6 As shown, it involves application 1, application 2 and application 3 (i.e., diagrams 601 to 603). Specifically:
[0135] Step 603, when a network access request from application 1, application 2 and application 3 is detected, step 604 is executed, and the network access request is generated for application 1, application 2 and application 3 to access the target network resource of the electronic device.
[0136] Step 604, intercepting the target system call function.
[0137] Step 605: Obtain access information of each application.
[0138] Step 606 may be executed before or after executing any of steps 604 to 605 .
[0139] Step 606 is a step of obtaining a preset interception strategy, which specifically includes:
[0140] Step 6061, obtain the preset interception strategy from the server through the preset main program of the user layer.
[0141] Step 6062, sending the preset interception policy from the user layer to the kernel layer.
[0142] Step 6063, store the preset interception strategy in the kernel layer.
[0143] After executing the above step 605, execute step 607.
[0144] Step 607: Determine the target interception strategy corresponding to each application program according to the access information and the preset interception strategy.
[0145] Step 608: Obtain target discrimination parameters corresponding to each application.
[0146] After executing the above step 608, according to the target identification parameters and target interception strategies corresponding to each application, steps 609 to 611 are respectively executed, specifically including:
[0147] If the target interception strategy of application 1 is the network segment interception strategy, and the target discrimination parameter of application 1 is the IP address corresponding to application 1, step 609 is executed to determine whether the IP address of application 1 hits the preset IP address of the network segment interception strategy.
[0148] If the target interception strategy of application 2 is the process identification strategy, and the target identification parameter of application 2 is the process identification corresponding to application 2, step 610 is executed to determine whether the process identification of application 2 hits the preset process identification of the process identification interception strategy.
[0149] If the target interception strategy of application 3 is the network segment interception strategy and the process ID interception strategy, and the target discrimination parameters of application 3 are the preset IP address and process ID corresponding to application 3, then execute step 611 to determine whether the IP address of application 3 hits the preset IP address of the network segment interception strategy, and whether the process ID hits the preset process ID of the process ID interception strategy.
[0150] After executing the above steps 609 to 611, when the IP address of application 1 does not hit the preset IP address of the network segment interception policy, step 612 is executed to allow application 1 to access the target network resource. When the process ID of application 2 does not hit the preset process ID of the process ID interception policy, step 622 is executed to allow application 2 to access the target network resource.
[0151] When the IP address of application 3 hits the preset IP address of the network segment interception policy, and when the process identifier of application 3 hits the preset process identifier of the process identifier interception policy, step 613 is executed to intercept the network access request corresponding to application 3.
[0152] It can be seen that the implementation of the embodiment of the present application realizes finer granularity and more flexible network access control. When multiple applications access the same network resource at the same time, the access of each application can be precisely controlled, thereby improving the security of the application accessing the network resource. The discrimination parameters of each application can be quickly determined by the types of different interception strategies, thereby improving the response speed of network access control for each application.
[0153] It should be understood that, although the steps in the above-mentioned flowcharts are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a part of the steps in the above-mentioned flowcharts may include a plurality of sub-steps or a plurality of stages, and these sub-steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these sub-steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the sub-steps or stages of other steps. In addition, the above-mentioned multiple embodiments can be implemented independently, and can also be combined with each other, which is not limited here.
[0154] Based on the foregoing embodiments, an embodiment of the present application provides a network access control device, which includes the modules included and the units included in the modules, which can be implemented by a processor; of course, it can also be implemented by a specific logic circuit; in the implementation process, the processor can be a central processing unit (CPU), a microprocessor (MPU), a digital signal processor (DSP) or a field programmable gate array (FPGA), etc.
[0155] See also Figure 7 , Figure 7 A schematic diagram of the structure of a network access control device provided in an embodiment of the present application is shown in FIG. Figure 7 The network access control device shown is applied to an electronic device, and the network access control device includes an acquisition module 701, a determination module 702 and a control module 703, wherein:
[0156] The acquisition module 701 is used to acquire access information of each application program when a network access request of at least one application program is detected, wherein the access information includes an application identification parameter, a login parameter, and a network environment parameter, and the network access request is generated by at least one application program accessing a target network resource of the electronic device;
[0157] Determining module 702, for determining a target interception strategy corresponding to each application according to the access information and the preset interception strategy, the target interception strategy including a network segment interception strategy and / or a process identifier interception strategy, the preset interception strategy including a correspondence between the access information and the interception strategy, and different access information corresponds to different interception strategies;
[0158] The control module 703 is used to perform network access control on each application according to the target interception policy corresponding to each application.
[0159] In some embodiments, the electronic device includes a user layer and a kernel layer, the electronic device establishes a communication connection with a server, the server stores a preset interception strategy, and the network access control device further includes a sending module and a storage module, wherein:
[0160] The acquisition module 701 is further used to acquire the preset interception strategy from the server through the preset main program of the user layer;
[0161] A sending module, used to send the preset interception strategy from the user layer to the kernel layer by reading and writing device descriptors between the user layer and the kernel layer;
[0162] The storage module is used to store the preset interception strategy in the kernel layer.
[0163] In some embodiments, the network access request is generated by at least one application program by triggering a target system call function of the kernel layer to send a network data packet to a target network resource.
[0164] The acquisition module 701 is specifically used to intercept the target system call function to obtain the access information of each application program through a preset interception program of the kernel layer, and the preset interception program corresponds to the access information.
[0165] In some embodiments, the target system call function is intercepted by a hook function.
[0166] The network access control device further includes a loading module, wherein:
[0167] The loading module is used to load a preset kernel module into the kernel layer through a preset command line tool before the acquisition module 701 executes the step of intercepting the target system call function. The preset kernel module is obtained by writing a preset interception program into a hook function.
[0168] In some embodiments, the control module 703 is specifically used to obtain the target discrimination parameters corresponding to each application from the access information according to the type of the target interception policy corresponding to each application, and the target discrimination parameters corresponding to each application and the type of the target interception policy corresponding to each application are in a one-to-one correspondence; based on the target discrimination parameters corresponding to each application and the target interception policy corresponding to each application, network access control is performed on each application.
[0169] In some embodiments, when the type of the target interception policy is a network segment interception policy, the target discrimination parameter is the IP address corresponding to the application program; when the type of the target interception policy is a process identifier interception policy, the target discrimination parameter is the process identifier corresponding to the application program; when the type of the target interception policy is a network segment interception policy and a process identifier interception policy, the target discrimination parameter is the IP address and process identifier corresponding to the application program;
[0170] The process ID is generated by each application triggering a target system call function in the kernel layer.
[0171] In some embodiments, each interception strategy includes different preset interception parameters. The preset interception parameter corresponding to the network segment interception strategy is a preset IP address, and the preset interception parameter corresponding to the process identifier interception strategy is a preset process identifier.
[0172] The control module 703 is also specifically used to determine whether the target discrimination parameters corresponding to each application hit the preset interception parameters of the target interception strategy corresponding to each application; control the network access requests corresponding to the applications that do not hit the preset interception parameters in the target discrimination parameters corresponding to each application to access the target network resources; and intercept the network access requests corresponding to the applications that hit the preset interception parameters in the target discrimination parameters corresponding to each application.
[0173] It should be noted that in the embodiments of this application Figure 7 The division of modules in the network access control device shown is schematic and is only a logical function division. There may be other division methods in actual implementation.
[0174] Please refer to Figure 8 , Figure 8 It is a structural schematic diagram of a computer device disclosed in an embodiment of the present application.
[0175] like Figure 8 As shown, the computer device includes:
[0176] A memory 801 storing executable program codes;
[0177] a processor 802 coupled to the memory 801;
[0178] The processor 802 calls the executable program code stored in the memory 801 to execute any one of the network access control methods in the above method embodiments.
[0179] An embodiment of the present application provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the steps of any one of the network access control methods provided in the above embodiments are implemented.
[0180] An embodiment of the present application provides a computer program product including instructions, which, when executed on a computer, enables the computer to execute the steps of any one of the network access control methods provided in the above method embodiments.
[0181] Those skilled in the art will understand that Figure 8 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0182] In one embodiment, a network access control device provided by the present application can be implemented in the form of a computer program. The computer program can be Figure 8 The computer device shown in the figure is run. The memory of the computer device can store various program modules constituting the above-mentioned device. The computer program composed of various program modules enables the processor to execute the steps in the method of each embodiment of the present application described in this specification.
[0183] It should be noted here that the description of the above device, storage medium and computer program product embodiments is similar to the description of the above method embodiment, and has similar beneficial effects as the method embodiment. For technical details not disclosed in the device, system, storage medium and computer program product embodiments of this application, please refer to the description of the method embodiment of this application for understanding.
[0184] It should be understood that "one embodiment" or "an embodiment" or "some embodiments" mentioned throughout the specification means that specific features, structures or characteristics related to the embodiment are included in at least one embodiment of the present application. Therefore, "in one embodiment" or "in one embodiment" or "in some embodiments" appearing throughout the specification may not necessarily refer to the same embodiment. In addition, these specific features, structures or characteristics can be combined in one or more embodiments in any suitable manner. It should be understood that in various embodiments of the present application, the size of the sequence number of the above-mentioned processes does not mean the order of execution, and the execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiment of the present application. The above-mentioned sequence numbers of the embodiments of the present application are only for description and do not represent the advantages and disadvantages of the embodiments. The above description of each embodiment tends to emphasize the differences between the various embodiments, and the same or similar aspects can be referenced to each other. For the sake of brevity, this article will not repeat them.
[0185] The term "and / or" in this article is only a description of the association relationship of associated objects, indicating that there may be three relationships. For example, object A and / or object B can represent three situations: object A exists alone, object A and object B exist at the same time, and object B exists alone.
[0186] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the existence of other identical elements in the process, method, article or device including the element.
[0187] In the several embodiments provided in the present application, it should be understood that the disclosed apparatus and method can be implemented in other ways. The embodiments described above are merely illustrative. For example, the division of the modules is only a logical function division. There may be other division methods in actual implementation, such as: multiple modules or components can be combined, or can be integrated into another system, or some features can be ignored, or not executed. In addition, the coupling, direct coupling, or communication connection between the components shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or modules, which can be electrical, mechanical or other forms.
[0188] Those skilled in the art will appreciate that all or part of the steps of the above method embodiments may be implemented by hardware associated with program instructions, and the aforementioned program may be stored in a computer-readable storage medium, which, when executed, executes the steps of the above method embodiments; and the aforementioned storage medium includes various media that can store program codes, such as mobile storage devices, read-only memories (ROM), magnetic disks or optical disks.
[0189] The methods disclosed in several method embodiments provided in this application can be arbitrarily combined without conflict to obtain new method embodiments.
[0190] The features disclosed in several device embodiments provided in this application can be arbitrarily combined without conflict to obtain new device embodiments.
[0191] The above is only an implementation method of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art who is familiar with the present technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
Claims
1. A network access control method, characterized in that: Applied to electronic equipment, the method comprises: Acquire access information of each application program upon detecting a network access request of at least one application program, the access information including an application identification parameter, a login parameter, and a network environment parameter, the network access request being generated by the at least one application program accessing a target network resource of the electronic device; Determine the target interception strategy corresponding to each application according to the access information and the preset interception strategy, wherein the target interception strategy includes a network segment interception strategy and / or a process identifier interception strategy, and the preset interception strategy includes a correspondence between the access information and the interception strategy, and different access information corresponds to different interception strategies; Network access control is performed on each application according to the target interception strategy corresponding to each application.
2. The method according to claim 1, characterized in that The electronic device includes a user layer and a kernel layer, the electronic device establishes a communication connection with a server, the server stores the preset interception strategy, and the method further includes: Obtaining the preset interception strategy from the server through the preset main program of the user layer; Sending the preset interception strategy from the user layer to the kernel layer through the read-write device descriptor between the user layer and the kernel layer; The preset interception strategy is stored in the kernel layer.
3. The method according to claim 2, characterized in that The network access request is generated by the at least one application program sending a network data packet to the target network resource by triggering a target system call function of the kernel layer, and the obtaining access information of each application program includes: The target system call function is intercepted to obtain access information of each application program through a preset interception program of the kernel layer, wherein the preset interception program corresponds to the access information.
4. The method according to claim 3, characterized in that The target system call function is intercepted by a hook function. Before intercepting the target system call function, the method further includes: A preset kernel module is loaded into the kernel layer through a preset command line tool, wherein the preset kernel module is obtained by writing the preset interception program into the hook function.
5. The method according to claim 2, characterized in that: The performing network access control on each application according to the target interception strategy corresponding to each application includes: According to the type of the target interception strategy corresponding to each application, acquiring the target discrimination parameter corresponding to each application from the access information, wherein the target discrimination parameter corresponding to each application and the type of the target interception strategy corresponding to each application are in a one-to-one correspondence; Network access control is performed on each application according to the target discrimination parameter corresponding to each application and the target interception strategy corresponding to each application.
6. The method according to claim 5, characterized in that In the case where the type of the target interception policy is the network segment interception policy, the target discrimination parameter is the IP address corresponding to the application; in the case where the type of the target interception policy is the process identifier interception policy, the target discrimination parameter is the process identifier corresponding to the application; in the case where the type of the target interception policy is the network segment interception policy and the process identifier interception policy, the target discrimination parameter is the IP address and process identifier corresponding to the application; The process identifier is generated by each application triggering a target system call function of the kernel layer.
7. The method according to claim 6, characterized in that Each interception strategy includes different preset interception parameters. The network access control for each application is performed according to the target discrimination parameter corresponding to each application and the target interception strategy corresponding to each application, including: Determine whether the target discrimination parameter corresponding to each application program hits the preset interception parameter of the target interception strategy corresponding to each application program, the preset interception parameter corresponding to the network segment interception strategy is a preset IP address, and the preset interception parameter corresponding to the process identifier interception strategy is a preset process identifier; Control the network access request corresponding to the application program that does not hit the preset interception parameter in the target discrimination parameter corresponding to each application program to access the target network resource; The network access request corresponding to the application program that hits the preset interception parameter in the target identification parameter corresponding to each application program is intercepted.
8. A network access control device, characterized in that: Applied to electronic equipment, the device includes an acquisition module, a determination module and a control module, wherein: The acquisition module is used to acquire access information of each application program when a network access request of at least one application program is detected, wherein the access information includes an application identification parameter, a login parameter, and a network environment parameter, and the network access request is generated by the at least one application program accessing a target network resource of the electronic device; The determination module is used to determine the target interception strategy corresponding to each application according to the access information and the preset interception strategy, the target interception strategy includes a network segment interception strategy and / or a process identifier interception strategy, the preset interception strategy includes a correspondence between the access information and the interception strategy, and different access information corresponds to different interception strategies; The control module is used to perform network access control on each application according to the target interception strategy corresponding to each application.
9. A computer device comprising a memory and a processor, wherein the memory stores a computer program executable on the processor, wherein: When the processor executes the program, the steps of the method according to any one of claims 1 to 7 are implemented.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.
