Access control method, device, electronic device and storage medium for storage peripherals
By obtaining and detecting the description information and status change events of storage peripherals and configuring their access rights, the problem of complexity of storage peripheral access control in enterprise office scenarios is solved, and fine-grained access control and data security is achieved.
Patent Information
- Application Number
- CN202410741983.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-07
- Publication Date
- 2025-03-28
- Estimated Expiration
- 2044-06-07
AI Technical Summary
In the enterprise office scenario, when using devices from different operating systems for office work, the access control of storage peripherals is complex, there is a risk of data leakage and malicious program intrusion, and it is difficult to manage.
By obtaining the description information of the storage peripheral of the target device, detecting its status change event, determining the current status, and obtaining the mount path according to the preset status. Then, the target access permissions corresponding to the peripheral description information are queried, and the mounting path is configured to achieve fine-grained access control.
It effectively solves the compatibility and stability risks brought by custom device drivers, realizes accurate state management of storage peripherals, avoids the inconsistency of state caused by user manual mounts, and ensures data security and access control compliance.
Smart Images

Figure CN118708114B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a method and device for controlling access to storage peripherals, an electronic device and a storage medium. Background Art
[0002] Currently, in corporate office scenarios, operators use devices with different operating systems to work, so they often face complex usage scenarios for storage peripherals. For example, operators may use different types of storage peripherals to read and copy files, which poses a risk of corporate confidential data leakage and malicious program intrusion. At the same time, it is difficult to manage storage peripherals, which require security checks through corporate regulations or desktop management software, making management difficult. Summary of the invention
[0003] In view of this, an embodiment of the present invention provides an access control method, device, electronic device and storage medium for storage peripherals to solve the compatibility and stability risks brought by custom device drivers, as well as the problem of inconsistency caused by real-time change management status and user manual mounting in the automatic mounting process.
[0004] In a first aspect, an embodiment of the present invention provides an access control method for a storage peripheral, the method comprising:
[0005] Get the peripheral description information corresponding to the storage peripheral currently connected to the target device;
[0006] Detecting a state change event triggered by the storage peripheral on the target device, and determining the current target state of the storage peripheral based on the state change event, and if the target state is consistent with a preset state, obtaining a mount path of the storage peripheral;
[0007] The target access permission corresponding to the peripheral description information is queried, and the mount path is configured based on the target access permission.
[0008] In a second aspect, an embodiment of the present invention provides an access control device for a storage peripheral, the device comprising:
[0009] An acquisition module is used to acquire peripheral description information corresponding to the storage peripheral currently connected to the target device;
[0010] A detection module, configured to detect a state change event triggered by the storage peripheral on the target device, and determine the current target state of the storage peripheral based on the state change event, and if the target state is consistent with a preset state, obtain a mount path of the storage peripheral;
[0011] The processing module is used to query the target access rights corresponding to the peripheral description information, and configure the mounting path based on the target access rights.
[0012] In a third aspect, an embodiment of the present invention provides an electronic device, comprising: a memory and a processor, the memory and the processor being communicatively connected to each other, computer instructions being stored in the memory, and the processor executing the method of the first aspect or any corresponding embodiment thereof by executing the computer instructions.
[0013] In a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium having computer instructions stored thereon, the computer instructions being used to enable a computer to execute the method of the first aspect or any corresponding embodiment thereof.
[0014] The present disclosure can obtain the specific parameters and characteristics of the storage peripherals of the target device by obtaining the description information of the storage peripherals of the target device, and provide necessary information for subsequent operations. By detecting the state change event of the storage peripherals on the target device, the state of the storage peripherals can be accurately obtained. At the same time, by matching the target state with the preset state, if they are consistent, it means that the storage peripherals are correctly mounted, and then the mount path of the peripherals is obtained. In this way, the problem of inconsistent states caused by change management status and manual mounting by users is solved. Then, by querying the target access rights corresponding to the peripheral description information, the mount path of the peripheral is configured accordingly according to the target access rights, ensuring that the access and operation of the peripherals comply with the preset permission control policy, which is conducive to achieving fine-grained access control. BRIEF DESCRIPTION OF THE DRAWINGS
[0015] In order to more clearly illustrate the specific implementation methods of the present invention or the technical solutions in the prior art, the drawings required for use in the specific implementation methods or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some implementation methods of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0016] Figure 1 is a schematic diagram of a system framework according to some embodiments of the present invention;
[0017] Figure 2 is a flowchart of a method for controlling access to storage peripherals according to some embodiments of the present invention;
[0018] Figure 3 is a schematic diagram of a life cycle of a storage peripheral device according to some embodiments of the present invention;
[0019] Figure 4 is a flowchart of a method for controlling access to storage peripherals according to some embodiments of the present invention;
[0020] Figure 5 is a schematic diagram of a flow chart of access control of storage peripherals according to some embodiments of the present invention;
[0021] Figure 6 is a timing diagram of access control of a storage peripheral device according to some embodiments of the present invention;
[0022] Figure 7 is a structural block diagram of a method and device for controlling access to a storage peripheral according to an embodiment of the present invention;
[0023] Figure 8 It is a schematic diagram of the hardware structure of the electronic device according to an embodiment of the present invention. DETAILED DESCRIPTION
[0024] Embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although certain embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be construed as being limited to the embodiments set forth herein. On the contrary, these embodiments are provided to provide a more thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the present disclosure are only for exemplary purposes and are not intended to limit the scope of protection of the present disclosure.
[0025] In the description of the embodiments of the present disclosure, the term "including" and similar terms should be understood as open inclusion, that is, "including but not limited to". The term "based on" should be understood as "based at least in part on". The term "one embodiment" or "the embodiment" should be understood as "at least one embodiment". The term "some embodiments" should be understood as "at least some embodiments". Other explicit and implicit definitions may also be included below.
[0026] Herein, unless explicitly stated, executing a step “in response to A” does not mean executing the step immediately after “A” but may include one or more intermediate steps.
[0027] It is understandable that the data involved in this technical solution (including but not limited to the data itself, the acquisition, use, storage or deletion of the data) shall comply with the requirements of relevant laws, regulations and relevant provisions.
[0028] It is understandable that before using the technical solutions disclosed in the various embodiments of the present disclosure, the types, scopes of use, usage scenarios, etc. of the information involved in the present disclosure should be informed to relevant users and their authorization should be obtained in an appropriate manner in accordance with relevant laws and regulations. The relevant users may include any type of right holders, such as individuals, enterprises, and groups.
[0029] For example, in response to receiving an active request from a user, a prompt message is sent to the relevant user to clearly prompt the relevant user that the operation requested to be performed will require obtaining and using the information of the relevant user, so that the relevant user can independently choose whether to provide information to software or hardware such as an electronic device, application, server or storage medium that executes the operation of the technical solution of the present disclosure based on the prompt message.
[0030] As an optional but non-limiting implementation, in response to receiving an active request from a relevant user, a prompt message is sent to the relevant user, for example, in the form of a pop-up window, in which the prompt message may be presented in text form. In addition, the pop-up window may also carry a selection control for the user to select "agree" or "disagree" to provide information to the electronic device.
[0031] It is understandable that the above notification and the process of obtaining user authorization are merely illustrative and do not constitute a limitation on the implementation of the present disclosure. Other methods that meet relevant laws and regulations may also be applied to the implementation of the present disclosure.
[0032] Office security usually involves the security management of networks, identities, and terminals. By implementing private network networking, access control, terminal management in private networks, and information security protection, digital office can be made safer, more efficient, and easier to use. Security management at the network level can ensure that private networks such as office networks can operate safely and efficiently, thereby ensuring that business data can be safely transmitted and stored. Security management at the identity level can improve the efficiency and security of identity authentication for users accessing private networks. Security management at the terminal level can achieve unified management of terminal devices within the private network, data leakage prevention, and terminal threat protection, thereby ensuring the security of corporate data.
[0033] In actual applications, the security management of networks, identities, and terminals can achieve technical linkage in multiple technical branches such as networking strategies, network access and control, remote access, unified terminal management, terminal detection and response, enterprise data leakage prevention, and identity authentication management, making digital office simpler, more efficient, and easier to implement.
[0034] Currently, for access management / control of storage peripherals, the method is to control the mounting status of storage peripherals by taking over the automatic mounting process. Specifically, the idea of this method is to invade the automatic mounting process of the storage peripherals so as to control the mounting status.
[0035] However, the following problems will occur when taking over the automatic mounting process. ① Manual mounting of peripherals by users may result in inconsistent states. If users manually mount peripherals without using the automatic mounting process, the mounting state of the peripherals may be inconsistent with expectations. This prevents applications from accessing peripherals normally, or causes inconsistent states between applications. ② This method cannot perform fine-grained management of applications. When taking over the automatic mounting process, it is impossible to distinguish and control the mounting of different applications in a targeted manner. This may cause some applications to fail to obtain the required peripheral access rights, or it may be impossible to restrict certain applications from accessing peripherals.
[0036] Based on the problems existing in the above solutions, this application provides a system architecture. Figure 1 , the architecture includes: a target device 101 and multiple storage peripherals 102, wherein the target device 101 can be a device of the macOS system or a device of the Windows system. The storage peripheral 102 can be a hard disk, for example: an external hard disk drive, which can be connected to a computer via an interface such as USB, Thunderbolt, etc., for storing a large amount of files and data. The storage peripheral 102 can also be a USB flash drive, also known as a U disk, which can be connected to a computer via a USB interface for transferring and storing files. The storage peripheral 102 can also be a portable solid-state drive (SSD) and the like.
[0037] like Figure 1 As shown, a client of a security management application for detecting and managing storage peripherals is deployed in the target device 101. The client can call a disk arbitration (DiskArbitration) framework and a user-mode driver (EndpointSecurity) framework to detect storage peripherals. For example, the disk arbitration framework can be the DiskArbitration framework of the macOS system, and the user-mode driver framework can be the EndpointSecurity framework.
[0038] Specifically, the disk arbitration framework is used to monitor and manage hardware device status change events in real time, such as appearance, disappearance, mounting, unmounting, renaming, etc. Through the disk arbitration framework, you can also obtain information about external storage devices, such as device path, device type, serial number, etc., so that you can monitor the status of external storage devices in real time. The user-state driver framework is used to monitor storage peripheral mount / unmount events caused by user behavior. Based on this, the disk arbitration framework and the user-state driver framework are combined to associate the mount path of the storage peripheral with the specific peripheral information, thereby achieving fine-grained management of external storage devices.
[0039] According to an embodiment of the present invention, a method, apparatus, electronic device and storage medium for access control of a storage peripheral are provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.
[0040] In this embodiment, a method for access control of a storage peripheral is provided. The method provided in the embodiment of the present application is applied to a client of a security management application deployed in a target device in the above framework. Figure 2 is a flow chart of a method for controlling access to a storage peripheral device according to an embodiment of the present invention. Figure 2 As shown, the process includes the following steps:
[0041] Step S11, obtaining peripheral description information corresponding to the storage peripheral currently connected to the target device.
[0042] In the disclosed embodiment, the target device may be a device with different operating systems, such as a computer with a macOS system, a computer with a Windows system, and the like. When a storage device is connected to the target device, the client of the security management application may detect the device identification and device type of the storage device. Storage peripherals refer to external devices used for data storage and transmission. Storage peripherals may be USB flash drives, mobile hard disks, flash memory cards, and the like. Specifically, the client of the security management application may directly obtain the serial number, product identification, manufacturer identification, and other values of the storage peripheral using the disk arbitration framework, and these values may uniquely identify a specific storage peripheral. The disk arbitration framework is a mechanism for resolving disk access conflicts. In an operating system, multiple devices may access shared disk resources at the same time, and the role of the disk arbitration framework is to coordinate these devices to ensure correct access to disk resources. Secondly, the client indirectly obtains the device type through an automatic identification mechanism, for example: by maintaining the combined relationship between the driver identification and the icon file, all storage device types supported by the system can be identified.
[0043] Step S12, detecting a state change event triggered by the storage peripheral on the target device, and determining the current target state of the storage peripheral based on the state change event, and if the target state is consistent with the preset state, obtaining the mount path of the storage peripheral.
[0044] In the disclosed embodiment, the state change event can be detected by the disk arbitration framework or by the user mode driver framework. Specifically, during the state switching process of the storage peripheral, the disk arbitration and user mode driver events may be triggered. Figure 3As shown in the figure, the life cycle of storage peripherals can be divided into the following states: unconnected, connected, and mounted. When switching between these states, disk arbitration and user-mode driver events will be generated, and the information that can be obtained in different state switching events is different. The related events triggered by disk arbitration include: appear, mount, unmount, and disappear. The related events triggered by the user-mode driver framework include: mount and unmount. For example: Figure 3 As shown, when the storage peripheral is in the connected state, a state change event is detected. If the state change event comes from the disk arbitration framework and the event is mount, the state update of the storage peripheral is triggered, that is, the state of the storage peripheral is updated to the mounted state, and then the state switching event is parsed to obtain the mount path of the storage peripheral.
[0045] Step S13, querying the target access rights corresponding to the peripheral description information, and configuring the mount path based on the target access rights.
[0046] In the disclosed embodiment, the target access rights of the peripheral are determined according to the information in the peripheral description information. The target access rights may include read-only mode, read-write mode, disabled mode, etc. According to the target access rights, the mount path is configured for each mounted peripheral. The configuration may include setting the access rights of the file, the permissions of the mount point, etc. For example: Read-only mode allows specific trusted applications to modify: For the case where specific trusted applications are allowed to modify in read-only mode, the mount path can be configured as read-only permission, and then the specific application can be authorized to allow it to perform modification operations on the read-only peripheral. Read-only mode allows security software to isolate viruses: For the case where security software is allowed to isolate viruses in read-only mode, the mount path can be configured as read-only permission, and the security software can be authorized to isolate viruses. Disabled mode allows security software to perform security scans on files: For the case where security software is allowed to perform security scans in disabled mode, the mount path can be configured as disabled permission, and the security software can be authorized to scan files.
[0047] By querying the target access rights corresponding to the peripheral description information and configuring the mount path based on the target access rights, the access rights management of the peripheral and the flexible configuration of the mount path can be achieved.
[0048] The disclosed embodiment can obtain the identification, manufacturer identification, serial number, type and other information of the storage peripheral by acquiring the peripheral description information corresponding to the storage peripheral currently connected to the target device. Then, by detecting the state change events triggered by the storage peripheral on the target device and parsing these events, the mount path of the storage peripheral can be determined. This provides a basis for subsequent refined management and access control of peripherals. The target access rights corresponding to the peripheral are queried according to the peripheral description information, thereby realizing the configuration and management of access to the storage peripheral. In this way, by associating the peripheral description information of the storage peripheral with the mount path, targeted strategies can be formulated for fine-grained management and access control. This ensures data security and protects the integrity of peripheral data.
[0049] Figure 4 is a flow chart of a method for controlling access to a storage peripheral device according to an embodiment of the present invention. Figure 4 As shown, the process includes the following steps:
[0050] Step S21, obtaining peripheral description information corresponding to the storage peripheral currently connected to the target device.
[0051] In the embodiment of the present disclosure, the peripheral description information corresponding to the storage peripheral currently connected to the target device is obtained, and the following steps A1-A4 are performed:
[0052] Step A1, detecting a connection event currently occurring on the target device.
[0053] Specifically, the client can listen to the connection event through the disk arbitration framework. When the storage peripheral is connected to the target device, the corresponding event notification will be triggered. According to the information in the event notification, the device identification and other information can be obtained. It should be noted that the disk arbitration framework is mainly used to prevent other programs or user operations from interfering with the program when it uses the storage peripheral (such as a disk, USB drive, etc.).
[0054] Step A2: based on the connection event, obtain the device identification of each storage peripheral connected to the target device, and detect whether there is a driver identification and icon file that matches when the storage peripheral is connected to the target device.
[0055] Specifically, based on the connection event, the device identification of each storage peripheral connected to the target device can be directly obtained through the disk arbitration framework. While the disk arbitration framework cannot directly obtain the device type of the storage peripheral, in the disclosed embodiment, the client can indirectly identify the device type through the automatic identification mechanism of the operating system. The specific process of obtaining the device type is as follows: Through the disk arbitration framework, a driver identification and icon file of a peripheral can be obtained. When the storage peripheral is connected to the target device, the system will match it according to the device identification (such as the manufacturer and model of the device, etc.) to determine whether there is the most suitable driver. If the driver exists, the driver identification and icon file of the driver are obtained, and the corresponding icon is displayed when mounted (even if the peripheral is available).
[0056] It should be noted that different device types will hit different drivers and icons. Therefore, the device type can be indirectly identified through the icon displayed by the system when the peripheral is connected. The system will select the corresponding driver based on the feature information of the peripheral and display the icon matching the device type when mounting.
[0057] Step A3: If there is a driver identifier and an icon file matching the storage peripheral device, the device type corresponding to the storage peripheral device is queried using the driver identifier and the icon file.
[0058] Specifically, if there is a driver identification and an icon file, then based on the combination relationship of the driver identification and the icon file, all storage device types supported by the system are identified. For example, when maintaining the combination relationship of the driver identification and the icon file, it is stored in a database or managed using a configuration file. These combination relationships can be defined and maintained according to actual needs, so that the system can identify the device types of all storage peripherals supported by the system based on the driver identification and icon file of the peripheral.
[0059] Step A4: construct peripheral description information of the storage peripheral based on the device identification and the device type.
[0060] The disclosed embodiment can timely obtain the connection status of the device by detecting the connection event currently occurring in the target device, ensuring that the newly added storage peripherals can be processed in a timely manner. Through the connection event, the device identification of each storage peripheral connected to the target device is obtained. Through the obtained device identification, it is detected whether there is a driver identification and icon file that matches the storage peripheral when it is connected. It can be determined whether there is a related driver program for the storage peripheral, and whether there is a corresponding icon file for display. If there is a matching driver identification and icon file, the driver identification and icon file are used to query the device type corresponding to the storage peripheral. In this way, the specific type of the storage peripheral can be determined, such as a USB storage device, a mobile hard disk, etc. Based on the device identification and device type, the peripheral description information of the storage peripheral is constructed. In this way, each storage peripheral can be classified and marked, which is convenient for system management and use.
[0061] Step S22, detecting a state change event triggered by the storage peripheral on the target device, and determining the current target state of the storage peripheral based on the state change event, and if the target state is consistent with the preset state, obtaining the mount path of the storage peripheral.
[0062] In the disclosed embodiment, the disk arbitration framework and the user-mode driver framework can detect the state change events triggered by the storage peripheral on the target device, such as disconnection, mounting, unmounting, disappearance, etc. Specifically, based on the state change event, the current target state of the storage peripheral is determined. If the target state is consistent with the preset state, the mount path of the storage peripheral is obtained, including the following steps B1-B2:
[0063] Step B1, obtaining the event type corresponding to the state change event.
[0064] Specifically, by parsing the state change event, the event type corresponding to the state change event can be determined. State change events of different event types will trigger corresponding event notifications. Therefore, the event type is determined based on the information in the event notification. The event type can be: appear, mount, unmount, disappear, etc.
[0065] Step B2, determining the current target state of the storage peripheral device according to the event type, and matching the target state with the preset state.
[0066] Specifically, the current target state of the storage peripheral is obtained from the life cycle state diagram of the storage peripheral according to the state change event that occurs. For example, if the state change event is disappeared and the previous state of the storage peripheral is connected, it can be determined that the storage peripheral and the target device have been disconnected, and the target state of the storage peripheral is disconnected.
[0067] Step B3: If the target state is consistent with the preset state, the mount path corresponding to the storage peripheral is obtained.
[0068] In an embodiment of the present application, if the target state is consistent with the preset state and both are in the connected state, the mount path of the storage peripheral can be directly obtained from the peripheral detailed information. It should be noted that different information can be obtained by parsing different state change events. For example: when the disk arbitration event is occurrence, the hardware information of the storage peripheral is obtained. When the disk arbitration event is mount, the hardware information of the storage peripheral is obtained. When the disk arbitration event is uninstall, the hardware information and mount path of the storage peripheral are obtained. When the user-state drive event is mount, the mount path and BSD device path are obtained. Specifically, if the state change event is a user-state drive event, the interface provided by the disk arbitration framework can be actively called in the user-state drive event callback to obtain some other peripheral detailed information of the storage peripheral. If the state change event is a disk arbitration event, the real-time status can be queried and other peripheral detailed information can be obtained through the callback of the disk arbitration framework. Therefore, only when the target state is consistent with the preset state and both are in the connected state, the mount path of the storage peripheral can be obtained.
[0069] Step S23, querying the target access rights corresponding to the peripheral description information, and configuring the mount path based on the target access rights.
[0070] In an embodiment of the present disclosure, querying the target access rights corresponding to the peripheral description information includes: obtaining a pre-configured access control policy, wherein the access control policy includes a plurality of preset description information and access rights corresponding to the preset description information; matching the peripheral description information with the preset description information; if there is preset description information that is hit by the peripheral description information, then using the access rights corresponding to the preset description information as the target access rights.
[0071] Specifically, a pre-configured access control policy refers to a policy that is set and configured in advance in the system for access rights to external devices or storage devices. These policies usually include multiple preset description information and corresponding access rights, which are used to limit the access rights to external devices or storage devices. The preset description information describes some attributes or characteristics of the external device or storage device, such as the manufacturer, model, capacity, etc. of the device; the access rights specify which users or programs can access the device and which users or programs cannot access it. Access rights usually include different access levels such as read permission, write permission, and execute permission. Peripheral description information refers to the attributes or characteristics of the external device or storage device, such as the manufacturer, model, capacity, etc. of the device.
[0072] When performing access control, the peripheral description information is matched with the preset description information to determine which access rights apply to the peripheral. When the peripheral description information successfully matches the preset description information, it can be determined which access rights apply to the peripheral. These access rights are usually determined by the access rights corresponding to the preset description information in the access control policy. Therefore, if there is preset description information that the peripheral description information hits, the access rights corresponding to the preset description information are used as the target access rights to implement the restrictions of the access control policy.
[0073] For example: the company has a variety of peripherals, including different models of USB storage devices. The preset description information and corresponding access rights are set. The preset description information: USB storage device of brand ABC, access rights: allow reading and writing to the company's internal folders. When the user wants to use the storage peripheral, the client will first obtain the description information of the peripheral, such as brand and model. Then match the peripheral description information with the preset description information. If a USB storage device of brand ABC is connected, the client will find that the peripheral description information successfully matches the preset description information of the USB storage device. According to the preset description information, the access rights to read and write to the company's internal folders are granted to this USB storage device.
[0074] The present disclosure can obtain the specific parameters and characteristics of the storage peripherals of the target device by obtaining the description information of the storage peripherals of the target device, and provide necessary information for subsequent operations. By detecting the state change event of the storage peripherals on the target device, the state of the storage peripherals can be accurately obtained. At the same time, by matching the target state with the preset state, if they are consistent, it means that the storage peripherals are correctly mounted, and then the mount path of the peripherals is obtained. In this way, the problem of inconsistent states caused by change management status and manual mounting by users is solved. Then, by querying the target access rights corresponding to the peripheral description information, the mount path of the peripheral is configured accordingly according to the target access rights, ensuring that the access and operation of the peripherals comply with the preset permission control policy, which is conducive to achieving fine-grained access control.
[0075] In an embodiment of the present disclosure, after querying the mount path according to the query strategy corresponding to the state change event, the method also includes: obtaining peripheral detailed information corresponding to the state change event; constructing a mapping relationship between the device description information and the peripheral detailed information; and writing the mapping relationship between the device description information and the peripheral detailed information and the target state into a peripheral list of the target device.
[0076] In an embodiment of the present disclosure, obtaining detailed peripheral information of a storage peripheral includes: if the state change event originates from a disk arbitration framework, triggering a first callback function of the disk arbitration framework based on the target state to take effect, and obtaining the detailed peripheral information of the storage peripheral through the first callback function. Specifically, when a mount or unmount event occurs in a storage device, the disk arbitration framework detects this event and triggers a corresponding callback function according to the target state. The first callback function refers to a function defined in the disk arbitration framework for processing external storage device events. In the first callback function, the detailed peripheral information of the storage peripheral, such as the mount path, capacity, file type, etc., can be obtained by calling an interface or function provided by the disk arbitration framework. The obtained peripheral detailed information can be used to record the status of the external storage device or used in subsequent operations.
[0077] If the state change event originates from a user-state driver framework, the mount path of the storage peripheral is obtained, and a second callback function of the user-state driver framework is triggered to take effect based on the target state. The detailed information of the storage peripheral is obtained from the disk arbitration framework through the second callback function, and the peripheral detailed information is constructed based on the mount path and the detailed information.
[0078] Specifically, when a user inserts a peripheral, a mount path will be automatically assigned to the peripheral. The mount path is the location of the peripheral in the file system and is used to access files and data in the peripheral. The user-state driver framework is a software architecture used to manage and process user-state driver events. When the user inserts the peripheral, the user-state driver framework detects this event. At this time, the event type of the event can be marked as the user-state driver type, and the corresponding second callback function is triggered according to the target state. The second callback function refers to the function defined in the user-state driver framework to handle peripheral events. In the second callback function, the hardware information of the storage peripheral, such as the capacity of the peripheral, file type, etc., can be obtained by calling the interface or function provided by the disk arbitration framework. Based on the mount path and hardware information, the peripheral detailed information can be constructed.
[0079] In an embodiment of the present application, a peripheral list for storing device description information and peripheral details is created, and the description information and peripheral details of each storage peripheral are added to the peripheral list in the form of a dictionary or object. Each dictionary or object includes device description information and peripheral details, wherein the peripheral details include a mount path. The peripheral list finally obtained is written into the peripheral list of the target device, and the list can be saved as a file or written into the memory of the target device for subsequent device management and use. Since the peripheral details of each peripheral are recorded in the peripheral list, a specific storage peripheral can be operated or controlled based on this information. For example, a specific storage peripheral can be located and operated by a unique identifier or name in the peripheral list to achieve specific control of the peripheral. At the same time, the peripheral list contains device description information, and specific management strategies can be formulated based on the fields in the device description information. For example, different management strategies can be formulated based on information such as device type, manufacturer, configuration parameters, etc., such as regular maintenance, optimized configuration, firmware upgrade, etc., to ensure the normal operation and performance optimization of the device.
[0080] In addition, the user-mode arbitration framework can also extract relevant operation content based on the captured event information. By parsing the event information, the user-mode arbitration framework can restore the user's operation sequence. For example, when a user inserts a USB device and opens a folder, the user-mode arbitration framework can restore it to the user clicking on the external device. The user-mode arbitration framework will save the restored user operation in the form of a record. These records may include information such as the time of the operation, device type, and operation type. Generating records can provide users with valuable information for problem solving and troubleshooting. When problems related to storage peripherals occur, the recorded user operations can be analyzed to locate and solve the problem, saving time and effort. At the same time, the usage and behavior of storage peripherals can also be analyzed and counted. This is conducive to the implementation of resource management and optimization strategies.
[0081] The disclosed embodiment can realize automatic management and control of the state of peripherals by determining the target state of storage peripherals according to the state change event. By building a mapping relationship between device description information and peripheral detailed information, various parameters and state information of the device can be clearly understood, and comprehensive detection and management of the device can be realized. It is helpful to find and solve device problems in time. Finally, by building a peripheral list, it is also convenient to implement fine-grained management strategies and improve the flexibility and efficiency of management.
[0082] In the embodiment of the present disclosure, after the mount path is configured based on the target access rights, such as Figure 5 As shown, the method also includes:
[0083] Step S31, detecting a file access request of a user process for the mount path.
[0084] In the disclosed embodiment, the client of the security management application can monitor the access request of the user process to the file in the mount path in real time. It can capture information such as file system events and system calls, and record the file access behavior of the user process.
[0085] Step S32: Authenticate the file access request using the target access permission to obtain an authentication result.
[0086] In the disclosed embodiment, the system uses the set target access rights to authenticate the file access request issued by the user process. Authentication can be based on a series of policies and rules, such as user identity authentication, access control list (ACL), role permissions, etc. By comparing the file access request with the target access rights, the system can determine whether the user has the right to access the file and obtain the authentication result.
[0087] Step S33, if the authentication result is that access is allowed, the user process is controlled to access the peripheral files corresponding to the mount path according to the access mode indicated by the authentication result, or, if the authentication result is that access is prohibited, the user process is prohibited from accessing the peripheral files corresponding to the mount path.
[0088] In the disclosed embodiment, the system controls the access behavior of the user process according to the authentication result. If the authentication result is to allow access, the system will allow the user process to access the peripheral files corresponding to the mount path according to the access mode indicated by the authentication result. This may include different access rights such as reading, writing, executing, and modifying. If the authentication result is to prohibit access, the system will prohibit the user process from accessing the peripheral files corresponding to the mount path, that is, reject the access request of the user process. Through the execution of the above steps, the system can authenticate the file access request sent by the user process, and control the user process's access rights to the peripheral files according to the authentication result. This can ensure the security and controllability of the peripheral files and prevent unauthorized access and operation.
[0089] The following is an example of how a user process accesses a storage peripheral:
[0090] Use the user-mode driver framework to obtain the file access request sent by the user process. When the user process sends a file access request, the user-mode driver framework triggers the corresponding event notification. Obtain the path information of the file access request from the event notification, and obtain the permission information of the specified access path. The permission information can be stored in a permission control list or database. According to the permission information, perform an authentication operation on the file access request. Authentication can include verifying the user identity, checking user permissions, or executing some other access control policies. According to the result of the authentication operation, determine whether the file access request is allowed. If the authentication result is to allow access, control the user process to access the peripheral file corresponding to the mount path according to the access mode indicated by the authentication result. This can include different access modes such as reading, writing, and executing. If the authentication result is to prohibit access, prohibit the user process from accessing the peripheral file corresponding to the mount path. The effect of prohibiting access can be achieved by rejecting the access request or throwing a corresponding error or exception.
[0091] In the embodiment of the present disclosure, after configuring the mount path based on the target access permission, the method further includes:
[0092] Step S41, obtaining the usage status of each storage peripheral currently connected to the target device.
[0093] In the embodiments of the present application, different operating systems may provide some tools or interfaces to obtain the usage of storage peripherals. For example, in the Windows operating system, you can use the "Disk Management" tool to view the connected storage peripherals and their usage, including information such as used space and available space.
[0094] Step S42, obtaining a target mapping relationship corresponding to the target storage peripheral from the peripheral list of the target device, and writing the peripheral usage into an area corresponding to the target mapping relationship.
[0095] In an embodiment of the present application, a peripheral list of a target device is obtained, which includes a mapping relationship between device description information of different storage peripherals and peripheral detailed information. A target storage peripheral is found from the peripheral list, and a target mapping relationship corresponding thereto is obtained. The usage of the peripheral is written into an area corresponding to the target mapping relationship.
[0096] Specifically, writing the peripheral usage into the area corresponding to the target mapping relationship includes: analyzing the peripheral usage to obtain the peripheral performance corresponding to the stored peripheral; obtaining the display style corresponding to the peripheral performance, and using the display style to render the peripheral usage to obtain the rendered peripheral usage; writing the rendered peripheral usage into the area corresponding to the target mapping relationship.
[0097] By analyzing the usage of storage peripherals, we can obtain information related to the performance of the peripherals. For example: read and write speed, which indicates the speed at which the storage peripheral reads and writes data. Storage space utilization, which indicates the proportion of storage space used by the storage peripheral. Concurrent access volume, which indicates the number of simultaneous accesses to the storage peripheral. Error rate, which indicates the frequency of errors in the storage peripheral. By analyzing these usage data, we can get the performance of the storage peripheral.
[0098] Then, based on the peripheral performance indicators obtained, the corresponding display style needs to be determined. The display style can be in the form of graphics, charts, colors, etc., which are used to intuitively present the usage of peripherals. For example, a bar chart can be used to represent the read and write speed, and a pie chart can be used to represent the storage space utilization. Next, the peripheral usage is rendered using the selected display style to convert the usage data into a visual display to convey the information more clearly. The rendered peripheral usage will be presented in a more intuitive and easy-to-understand way. Finally, the rendered peripheral usage is written to the area corresponding to the target mapping relationship.
[0099] Based on this, by analyzing, rendering and writing the usage of peripherals, intuitive and useful information about the performance of storage peripherals is provided to help users understand the usage of peripherals and make corresponding decisions, or provide reference data for other systems or applications.
[0100] Step S43, obtaining an input event currently in the peripheral list, and obtaining at least one preset peripheral usage requirement based on the input event.
[0101] In an embodiment of the present application, an input event may be an operation instruction sent by a user through a device such as a keyboard or a mouse, such as clicking, scrolling, pressing a keyboard key, etc. To obtain an input event, a corresponding input interface or driver may be used to read data sent by the device. Acquiring at least one preset peripheral usage requirement based on an input event may be understood as determining the user's usage requirements for the peripheral based on the acquired input event. These preset usage requirements may be predefined.
[0102] Step S44, matching the preset peripheral usage requirements with the peripheral usage conditions corresponding to each storage peripheral. If there is a peripheral usage condition that matches the preset peripheral usage requirements, a requirement tag is configured for the target storage peripheral corresponding to the matching peripheral usage condition, wherein the requirement tag is a tag corresponding to the preset peripheral usage requirements.
[0103] In the embodiment of the present application, matching the preset peripheral usage requirements with the peripheral usage corresponding to each storage peripheral means comparing the preset requirements for peripheral usage with the actual usage of the storage peripheral. If there is a match with the preset requirements, it means that the storage peripheral meets the specific usage requirements. In this case, a requirement tag will be configured for the target storage peripheral corresponding to the matched peripheral usage. This requirement tag is a specific tag set according to the preset peripheral usage requirements.
[0104] For example: There are the following preset peripheral usage requirements: Performance requirement: high read and write speed. Task priority: important tasks. There are two storage peripherals: Hard disk A - faster write speed, hard disk B - slower read and write speed. First, match the performance requirements with the read and write speeds of the two hard disks. Since hard disk A has faster read and write speeds, it matches the preset high read and write speed requirement. Then, match the task priority with the usage of hard disk A. Determine whether hard disk A is mainly used for important tasks. If hard disk A meets the preset performance requirements and task priority, then configure a requirement tag for hard disk A, such as "high-performance important task storage." In this way, by matching the preset peripheral usage requirements with the situation of the storage peripherals, and configuring the corresponding requirement tags for the matching storage peripherals, you can better manage and utilize storage peripheral resources to meet specific usage requirements. In actual applications, more detailed matching and tag configuration can be performed according to specific requirements and the characteristics of storage peripherals.
[0105] The method provided in the embodiment of the present application can match the user's preset peripheral usage requirements with the actual usage of the storage peripherals. This helps users find the storage peripherals that best meet their needs and improves the fit between the device and the user's needs. By obtaining the peripheral usage of the storage peripherals and matching them with the preset requirements, the usage of the storage peripherals can be better understood. This allows users to allocate and use storage resources more reasonably and improve the utilization of storage peripherals. At the same time, configuring demand tags can help users quickly identify and find storage peripherals that match specific requirements. This can save users time and energy when they need to frequently use specific storage peripherals or find specific types of storage peripherals.
[0106] In an embodiment of the present application, after configuring a requirement tag for the target storage peripheral corresponding to the matching peripheral usage, the method also includes: obtaining a file storage task, wherein the file storage task carries the file to be stored and the file storage requirement; matching the file storage requirement with each preset peripheral usage requirement to obtain a target peripheral usage requirement that matches the file storage requirement; obtaining a target storage peripheral carrying a requirement tag corresponding to the target peripheral usage requirement from each storage peripheral, and storing the file to be stored in the target storage peripheral.
[0107] Specifically, first, the file storage requirements are matched with the preset peripheral usage requirements. The preset peripheral usage requirements also include information such as storage performance requirements and priority. Then, through the matching process, the target peripheral usage requirements that match the file storage requirements are found. Next, from multiple storage peripherals, the target storage peripheral carrying the requirement label corresponding to the target peripheral usage requirements is found. Finally, the file to be stored is stored in the target storage peripheral to complete the file storage task. For example, suppose there is a storage system with two storage peripherals, a hard disk and a USB flash drive. The file storage task requires the storage of files with high performance and high priority. Comparing the file storage requirements with the preset peripheral usage requirements of the hard disk and the USB flash drive, it is found that the hard disk has high storage performance and carries a high-priority requirement label. Therefore, the hard disk is selected as the target storage peripheral, and the file to be stored is stored in the hard disk. In this way, the file is stored in the most suitable storage peripheral according to its storage requirements to meet the performance and priority requirements. This matching and selection process can be customized and optimized according to the specific storage system and requirements.
[0108] The embodiment of the present application provides a timing diagram of access control of a storage peripheral device, such as Figure 6 As shown, the access process of storage peripherals is as follows:
[0109] Step (1), the client deployed on the target device calls the peripheral management process to detect the disk arbitration framework in real time to learn whether a connection event of the storage peripheral is currently generated.
[0110] Step (2), the storage peripheral device is connected to the target device, and the disk arbitration framework detects the connection event of the storage peripheral device.
[0111] In step (3), the disk arbitration framework sends a first notification message to the peripheral management process based on the connection event of the storage peripheral.
[0112] Step (4), the peripheral management process determines that the storage peripheral is currently in a connected state and stores peripheral description information of the peripheral according to the first notification information, and writes the connected state and the peripheral description information into the peripheral list of the target device.
[0113] Step (5), detecting a mount event triggered by the storage peripheral on the target device through a disk arbitration framework or a user-mode driver framework.
[0114] Step (6), sending a second notification message to the peripheral management process based on the disconnection event through the disk arbitration framework or the user mode driver framework.
[0115] Step (7), the peripheral management process determines that the storage peripheral is currently in a mounted state according to the second notification information, and uses the connected state to update the peripheral list of the target device. At the same time, the mount path is obtained, and the target access rights corresponding to the peripheral description information are queried, and the mount path is configured based on the target access rights. In addition, when the storage peripheral is in a mounted state, it can be detected whether a renaming event of the storage peripheral is currently generated. If a renaming event is generated, the peripheral management process determines the peripheral name of the storage peripheral according to the communication information triggered by the renaming event, and uses the peripheral name to update the peripheral list.
[0116] Step (8), detecting a file access event of the current user process to the storage peripheral device through a file access process;
[0117] Step (9), the file access process sends an authentication request to the peripheral management process based on the file access event.
[0118] Step (10), the peripheral management process uses the target access permission to authenticate the file access request and obtain an authentication result; if the authentication result is that access is allowed, the user process is controlled to access the peripheral file corresponding to the mount path according to the access mode indicated by the authentication result, or, if the authentication result is that access is prohibited, the user process is prohibited from accessing the peripheral file corresponding to the mount path.
[0119] Step (11), detecting an uninstallation event triggered by the storage peripheral on the target device through a disk arbitration framework or a user-mode driver framework, and sending a third notification message to the peripheral management process based on the uninstallation event.
[0120] Step (12), the peripheral management process determines that the storage peripheral is currently in a connected state according to the third notification information, and updates the peripheral list of the target device using the connected state.
[0121] Step (13), detecting a disconnection event triggered by the storage peripheral on the target device through a disk arbitration framework or a user-mode driver framework, and sending a fourth notification message to the peripheral management process based on the disconnection event.
[0122] Step (14), the peripheral management process determines that the storage peripheral is currently in a disconnected state according to the fourth notification information, and updates the peripheral list of the target device using the disconnected state.
[0123] In this embodiment, a storage peripheral access control device is also provided, which is used to implement the above-mentioned embodiments and preferred implementation modes, and the descriptions that have been made will not be repeated. As used below, the term "module" can implement a combination of software and / or hardware of a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceivable.
[0124] This embodiment provides an access control device for a storage peripheral device, such as Figure 7 As shown, including:
[0125] An acquisition module 51 is used to acquire peripheral description information corresponding to the storage peripheral currently connected to the target device;
[0126] A detection module 52 is used to detect a state change event triggered by a storage peripheral on a target device, and determine the current target state of the storage peripheral based on the state change event, and if the target state is consistent with a preset state, obtain a mount path of the storage peripheral;
[0127] The processing module 53 is used to query the target access rights corresponding to the peripheral description information, and configure the mounting path based on the target access rights.
[0128] In the disclosed embodiment, the acquisition module 51 is used to detect the connection event currently occurring in the target device; based on the connection event, the device identification of each storage peripheral connected to the target device is obtained, and whether there is a driver identification and icon file that matches when the storage peripheral is connected to the target device; if there is a driver identification and icon file that matches the storage peripheral, the device type corresponding to the storage peripheral is queried using the driver identification and icon file; and the peripheral description information of the storage peripheral is constructed based on the device identification and device type.
[0129] In the disclosed embodiment, the detection module 52 is used to obtain the event type corresponding to the state change event; determine the current target state of the storage peripheral according to the event type, and match the target state with the preset state; if the target state is consistent with the preset state, obtain the mount path corresponding to the storage peripheral.
[0130] In the embodiment of the present disclosure, the device also includes: a construction module for obtaining peripheral detailed information corresponding to a state change event; constructing a mapping relationship between device description information and peripheral detailed information; and writing the mapping relationship between device description information and peripheral detailed information and the target state into a peripheral list of the target device.
[0131] In an embodiment of the present application, a construction module is used to, if a state change event originates from a disk arbitration framework, trigger a first callback function of the disk arbitration framework based on a target state to take effect, and obtain peripheral detailed information of the storage peripheral through the first callback function; if the state change event originates from a user-state driver framework, obtain the mount path of the storage peripheral, and trigger a second callback function of the user-state driver framework based on the target state to take effect, obtain the hardware information of the storage peripheral from the disk arbitration framework through the second callback function, and construct the peripheral detailed information based on the mount path and the hardware information.
[0132] In an embodiment of the present application, the processing module 53 is used to obtain a pre-configured access control policy, wherein the access control policy includes multiple preset description information and access rights corresponding to the preset description information; the peripheral description information is matched with the preset description information; if there is preset description information that is hit by the peripheral description information, the access right corresponding to the preset description information is used as the target access right.
[0133] In the embodiment of the present disclosure, the device also includes: a control module, which is used to detect file access requests from user processes for storage peripherals; use target access rights to authenticate the file access requests to obtain an authentication result; if the authentication result is that access is allowed, the user process is controlled to access the peripheral files corresponding to the mount path according to the access mode indicated by the authentication result, or, if the authentication result is that access is prohibited, the user process is prohibited from accessing the peripheral files corresponding to the mount path.
[0134] In an embodiment of the present disclosure, the device also includes: a configuration module, which is used to obtain peripheral usage corresponding to each storage peripheral currently connected to the target device; obtain the target mapping relationship corresponding to the target storage peripheral from the peripheral list of the target device, and write the peripheral usage into the area corresponding to the target mapping relationship; obtain the input event currently in the peripheral list, and obtain at least one preset peripheral usage requirement based on the input event; match the preset peripheral usage requirement with the peripheral usage corresponding to each storage peripheral, and if there is a peripheral usage that matches the preset peripheral usage requirement, configure a requirement tag for the target storage peripheral corresponding to the matching peripheral usage, wherein the requirement tag is a tag corresponding to the preset peripheral usage requirement.
[0135] In the embodiment of the present disclosure, a configuration module is used to analyze the usage of peripherals to obtain the peripheral performance corresponding to the storage peripherals; obtain the display style corresponding to the peripheral performance, and use the display style to render the usage of the peripherals to obtain the rendered usage of the peripherals; write the rendered usage of the peripherals into the area corresponding to the target mapping relationship.
[0136] In the disclosed embodiment, the device also includes: a matching module, which is used to obtain a file storage task, wherein the file storage task carries the file to be stored and the file storage requirement; matches the file storage requirement with each preset peripheral usage requirement to obtain a target peripheral usage requirement that matches the file storage requirement; obtains a target storage peripheral carrying a requirement tag corresponding to the target peripheral usage requirement from each storage peripheral, and stores the file to be stored in the target storage peripheral.
[0137] See also Figure 8 , Figure 8 is a schematic diagram of the structure of an electronic device provided by an optional embodiment of the present invention, such as Figure 8As shown, the electronic device includes: one or more processors 10, a memory 20, and interfaces for connecting various components, including high-speed interfaces and low-speed interfaces. The various components are connected to each other using different buses for communication, and can be installed on a common mainboard or installed in other ways as needed. The processor can process instructions executed in the electronic device, including instructions stored in or on the memory to display graphical information of the GUI on an external input / output device (such as a display device coupled to the interface). In some optional embodiments, if necessary, multiple processors and / or multiple buses can be used together with multiple memories and multiple memories. Similarly, multiple electronic devices can be connected, and each device provides some necessary operations (for example, as a server array, a group of blade servers, or a multi-processor system). Figure 8 A processor 10 is taken as an example.
[0138] The processor 10 may be a central processing unit, a network processor or a combination thereof. The processor 10 may further include a hardware chip. The hardware chip may be a dedicated integrated circuit, a programmable logic device or a combination thereof. The programmable logic device may be a complex programmable logic device, a field programmable gate array, a general purpose array logic or any combination thereof.
[0139] The memory 20 stores instructions executable by at least one processor 10, so that at least one processor 10 executes the method shown in the above embodiment.
[0140] The memory 20 may include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function; the data storage area may store data created by the use of an electronic device based on the presentation of a small program landing page, etc. In addition, the memory 20 may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some optional embodiments, the memory 20 may optionally include a memory remotely arranged relative to the processor 10, and these remote memories may be connected to the electronic device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0141] The memory 20 may include a volatile memory, such as a random access memory; the memory may also include a non-volatile memory, such as a flash memory, a hard disk or a solid state drive; the memory 20 may also include a combination of the above types of memory.
[0142] The electronic device further comprises a communication interface 30 for the electronic device to communicate with other devices or a communication network.
[0143] The embodiment of the present invention also provides a computer-readable storage medium. The method according to the embodiment of the present invention can be implemented in hardware, firmware, or can be implemented as a computer code that can be recorded in a storage medium, or can be implemented as a computer code that is originally stored in a remote storage medium or a non-temporary machine-readable storage medium and will be stored in a local storage medium through a network download, so that the method described herein can be stored in such software processing on a storage medium using a general-purpose computer, a dedicated processor, or programmable or dedicated hardware. Among them, the storage medium can be a magnetic disk, an optical disk, a read-only storage memory, a random access memory, a flash memory, a hard disk or a solid-state hard disk, etc.; further, the storage medium can also include a combination of the above types of memories. It can be understood that a computer, a processor, a microprocessor controller, or programmable hardware includes a storage component that can store or receive software or computer code. When the software or computer code is accessed and executed by a computer, a processor, or hardware, the method shown in the above embodiment is implemented.
[0144] Although the embodiments of the present invention have been described in conjunction with the accompanying drawings, those skilled in the art may make various modifications and variations without departing from the spirit and scope of the present invention, and such modifications and variations are all within the scope defined by the appended claims.
Claims
1. A method for controlling access to a storage peripheral, characterized in that: The method comprises: Get the peripheral description information corresponding to the storage peripheral currently connected to the target device; Detecting a state change event triggered by the storage peripheral on the target device, and determining the current target state of the storage peripheral based on the state change event, and if the target state is consistent with a preset state, obtaining a mount path of the storage peripheral; Querying the target access permission corresponding to the peripheral description information, and configuring the mount path based on the target access permission; The method of obtaining peripheral description information corresponding to a storage peripheral currently connected to a target device comprises: detecting a connection event currently occurring on the target device; based on the connection event, obtaining device identifications of various storage peripherals connected to the target device, and detecting whether there are driver identifications and icon files that match the storage peripheral when it is connected to the target device; if there are driver identifications and icon files that match the storage peripheral, querying the device type corresponding to the storage peripheral using the driver identification and the icon file; and constructing peripheral description information of the storage peripheral based on the device identification and the device type.
2. The method according to claim 1, characterized in that The determining the current target state of the storage peripheral device based on the state change event, and if the target state is consistent with a preset state, obtaining the mount path of the storage peripheral device, includes: Obtain the event type corresponding to the state change event; Determining the current target state of the storage peripheral device according to the event type, and matching the target state with a preset state; If the target state is consistent with the preset state, the mount path corresponding to the storage peripheral is obtained.
3. The method according to claim 1, characterized in that After determining the current target state of the storage peripheral device based on the state change event, the method further includes: Obtaining detailed information of the peripheral corresponding to the state change event; Constructing a mapping relationship between the peripheral description information and the peripheral detailed information; The mapping relationship between the peripheral description information and the peripheral detailed information and the target state are written into the peripheral list of the target device.
4. The method according to claim 3, characterized in that The obtaining of peripheral detailed information corresponding to the state change event includes: If the state change event originates from the disk arbitration framework, triggering a first callback function of the disk arbitration framework to take effect based on the target state, and obtaining peripheral detailed information of the storage peripheral through the first callback function; If the state change event originates from a user-state driver framework, the mount path of the storage peripheral is obtained, and a second callback function of the user-state driver framework is triggered to take effect based on the target state. The hardware information of the storage peripheral is obtained from the disk arbitration framework through the second callback function, and the peripheral detailed information is constructed based on the mount path and the hardware information.
5. The method according to claim 1, characterized in that The querying of the target access rights corresponding to the peripheral description information includes: Obtaining a pre-configured access control policy, wherein the access control policy includes a plurality of preset description information and access rights corresponding to the preset description information; Matching the peripheral device description information with the preset description information; If there is preset description information matched by the peripheral description information, the access permission corresponding to the preset description information is used as the target access permission.
6. The method according to claim 1, characterized in that After configuring the mount path based on the target access permission, the method further includes: Detecting a file access request of a user process for the mount path; Authenticating the file access request using the target access permission to obtain an authentication result; If the authentication result is that access is allowed, the user process is controlled to access the peripheral files corresponding to the mount path according to the access mode indicated by the authentication result; or, if the authentication result is that access is prohibited, the user process is prohibited from accessing the peripheral files corresponding to the mount path.
7. The method according to claim 1, characterized in that The method further comprises: Obtaining usage status of peripherals corresponding to each storage peripheral currently connected to the target device; Acquire a target mapping relationship corresponding to the storage peripheral from the peripheral list of the target device, and write the usage of the peripheral into an area corresponding to the target mapping relationship; Acquire an input event currently in the peripheral list, and acquire at least one preset peripheral usage requirement based on the input event; The preset peripheral usage requirement is matched with the peripheral usage corresponding to each of the storage peripherals. If there is a peripheral usage that matches the preset peripheral usage requirement, a requirement tag is configured for the target storage peripheral corresponding to the matching peripheral usage, wherein the requirement tag is a tag corresponding to the preset peripheral usage requirement.
8. The method according to claim 7, characterized in that Writing the usage of the peripheral device into the area corresponding to the target mapping relationship includes: Analyze the usage of the peripheral device to obtain the peripheral device performance corresponding to the storage peripheral device; Obtaining a display style corresponding to the peripheral performance, and rendering the peripheral usage using the display style to obtain the rendered peripheral usage; The rendered usage of the peripherals is written into the area corresponding to the target mapping relationship.
9. The method according to claim 7, characterized in that: After configuring the requirement tag for the target storage peripheral corresponding to the matched peripheral usage, the method further includes: Obtain a file storage task, wherein the file storage task carries the file to be stored and the file storage requirement; Matching the file storage requirement with each of the preset peripheral usage requirements to obtain a target peripheral usage requirement that matches the file storage requirement; A target storage peripheral device carrying a demand tag corresponding to the target peripheral device usage demand is obtained from each storage peripheral device, and the file to be stored is stored in the target storage peripheral device.
10. An access control device for a storage peripheral, characterized in that: The device comprises: An acquisition module is used to acquire peripheral description information corresponding to the storage peripheral currently connected to the target device; A detection module, configured to detect a state change event triggered by the storage peripheral on the target device, and determine the current target state of the storage peripheral based on the state change event, and if the target state is consistent with a preset state, obtain a mount path of the storage peripheral; A processing module, used for querying the target access rights corresponding to the peripheral description information, and configuring the mount path based on the target access rights; The acquisition module is used to detect the connection event currently occurring in the target device; based on the connection event, the device identification of each storage peripheral connected to the target device is obtained, and whether there is a driver identification and icon file that matches the storage peripheral when it is connected to the target device; if there is a driver identification and icon file that matches the storage peripheral, the device type corresponding to the storage peripheral is queried using the driver identification and the icon file; and the peripheral description information of the storage peripheral is constructed based on the device identification and the device type.
11. An electronic device, characterized in that: include: A memory and a processor, wherein the memory and the processor are communicatively connected to each other, the memory stores computer instructions, and the processor executes the method according to any one of claims 1 to 9 by executing the computer instructions.
12. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a computer to execute the method according to any one of claims 1 to 9.
Citation Information
Patent Citations
External device automatic mounting and informing control method and system
CN105808299A
System active USB mobile storage device access control method
CN117251838A