A website file protection method, device and system
By creating source virtual disks and virtual mirror disks in the website file protection system, saving and mounting the target file in read-only mode, the problem of website files being tampered with is solved, and the secure access and protection of files are achieved.
Patent Information
- Application Number
- CN202111662956.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-30
- Publication Date
- 2025-03-18
- Estimated Expiration
- 2041-12-30
AI Technical Summary
How to protect the files published by the website from being tampered with, prevent criminals from invading the website server from tampering with files and spreading malicious content.
By creating the source virtual disk and virtual mirror disk, save the target file to the source virtual disk, and synchronize the update to the virtual mirror disk to obtain the first mirror file. The first image file is then mounted on the target server in read-only mode, allowing access to the target file but not modifying it.
It effectively avoids the occurrence of tampering with the target files and improves the security of the target files published by the target website.
Smart Images

Figure CN114297716B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of data security technology, and in particular to a website file protection method, device and system. Background Art
[0002] In recent years, with the rapid development of the Internet and the widespread application of information technology, we have entered the era of network economy. Various Internet-based applications continue to emerge, and various security issues have also emerged. For example, criminals invade website servers, tamper with website files, conduct phishing scams, steal user information, or spread malicious and illegal content, which has a great impact on both service providers and users. Summary of the invention
[0003] The embodiments of the present application provide a website file protection method, device and system to solve the problem of how to protect files published on the website from being tampered with.
[0004] In a first aspect, an embodiment of the present application provides a website file protection method, which is applied to a website file protection system, and the method includes:
[0005] Creating a source virtual disk and a virtual mirror disk corresponding to the source virtual disk;
[0006] The target file published by the target website is saved in the source virtual disk, and the image file corresponding to the virtual image disk is updated to obtain a first image file;
[0007] The first mirror file is mounted on a target server in a read-only mode so that the target file is accessible but not modifiable. The target server is a server corresponding to the target website.
[0008] In a second aspect, an embodiment of the present application further provides a website file protection device, the device comprising:
[0009] A creation module, used to create a source virtual disk and a virtual mirror disk corresponding to the source virtual disk;
[0010] An acquisition module, used for saving the target file published by the target website into the source virtual disk, and updating the image file corresponding to the virtual image disk to obtain the first image file;
[0011] The mounting module is used to mount the first image file on a target server in a read-only mode so that the target file is accessible but not modifiable. The target server is a server corresponding to the target website.
[0012] In a third aspect, the embodiment of the present application further provides a website file protection system, the system comprising:
[0013] Website file management layer, interface layer and core service layer;
[0014] The website file management layer is used to call the first interface provided by the interface layer to create a source virtual disk and a virtual mirror disk corresponding to the source virtual disk; save the target file published by the target website to the virtual disk, and update the mirror file corresponding to the virtual mirror disk to obtain the first mirror file; and call the second interface provided by the interface layer to send a control instruction to the core service layer, so that the core service layer mounts the first mirror file in read-only mode on a target server, and the target server is a server corresponding to the target website;
[0015] The interface layer includes: a first interface for providing the website file management layer with a method for creating a source virtual disk and a virtual mirror disk corresponding to the source virtual disk, and a second interface for providing the website file management layer with a method for the website file management layer to send a control instruction to the core service layer;
[0016] The core service layer is used to receive the control instruction sent by the website file management layer through the second interface, and mount the first mirror file on the target server in read-only mode according to the control instruction, so that the target file can be accessed but not modified.
[0017] In a fourth aspect, an embodiment of the present application further provides an electronic device, comprising a processor, a memory, and a computer program stored in the memory and executable on the processor, wherein the computer program implements the steps of the above-mentioned website file protection method when executed by the processor.
[0018] In a fifth aspect, an embodiment of the present application further provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the steps of the above-mentioned website file protection method are implemented.
[0019] The embodiments of the present application include at least the following technical effects:
[0020] The technical solution of the present application saves the target file published by the target website to the source virtual disk, updates the virtual mirror disk to obtain a first mirror file, and mounts the first mirror file to the target server in read-only mode, so that the target file is allowed to be accessed but not modified, thereby avoiding the target file from being tampered with and improving the security of the target file published by the target website. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art are briefly introduced below.
[0022] Figure 1 This is one of the flow charts of the website file protection method provided in the embodiment of the present application;
[0023] Figure 2 This is the second flow chart of the website file protection method provided in the embodiment of the present application;
[0024] Figure 3 It is a structural diagram of a website file protection device provided in an embodiment of the present application;
[0025] Figure 4 It is a structural diagram of a website file protection system provided in an embodiment of the present application. DETAILED DESCRIPTION
[0026] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0027] It should be understood that the references to "one embodiment" or "an embodiment" throughout the specification mean that the specific features, structures, or characteristics associated with the embodiment are included in at least one embodiment of the present application. Therefore, the references to "in one embodiment" or "in an embodiment" appearing throughout the specification do not necessarily refer to the same embodiment. In addition, these specific features, structures, or characteristics may be combined in any suitable manner in one or more embodiments.
[0028] In the various embodiments of the present application, it should be understood that the size of the serial numbers of the following processes does not mean the order of execution. 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 embodiments of the present application.
[0029] The present application embodiment provides a website file protection method, which is applied to a website file protection system, such as Figure 1 As shown, the method may include:
[0030] Step 101: Create a source virtual disk and a virtual mirror disk corresponding to the source virtual disk.
[0031] On the operating system corresponding to the target server, a source virtual disk and a virtual mirror disk corresponding to the source virtual disk can be created, wherein the virtual mirror disk is established based on the source virtual disk, and the files in the source virtual disk can be mapped to the virtual mirror disk, that is, when a file is saved in the source virtual disk, the file will be saved synchronously in the virtual mirror disk, that is, the file in the virtual mirror disk is a mirror file with the same content as the file in the source virtual disk.
[0032] Step 102: Save the target file published by the target website into the source virtual disk, and update the image file corresponding to the virtual image disk to obtain a first image file.
[0033] The target file published by the target website is displayed on the target website in the form of a web page for users browsing the website. If criminals hack into the server of the target website, tamper with the target file, and spread malicious and illegal content, it will have a great impact on the website and users.
[0034] The embodiment of the present application does not directly save the target file published by the target website to the target server, which can prevent criminals from modifying the target file by invading the server of the target website. By saving the target file to the source virtual disk, the virtual mirror disk corresponding to the source virtual disk will synchronously store the target file, and a first mirror file containing the target file can be obtained.
[0035] Specifically, the source virtual disk is a logical disk in the operating system corresponding to the target server. When the maintenance personnel of the target website upload the target file to the operating system corresponding to the target server, the website file protection system will save the target file to the source virtual disk.
[0036] Step 103, mounting the first image file in read-only mode on a target server so that the target file is accessible but not modifiable, and the target server is a server corresponding to the target website.
[0037] The target file stored in the source virtual disk is mapped to the first image file in the virtual image disk. By mounting the first image file on the target server, the target file is mounted on the target server, so that users who visit the target website can access the webpage file corresponding to the target file on the target server through a browser. And when mounting, the mount mode of the first image file is set to read-only mode. At this time, the target file can only be accessed through the target server, but cannot be modified.
[0038] The embodiment of the present application saves the target file published by the target website to the source virtual disk, updates the virtual mirror disk to obtain a first mirror file, and mounts the first mirror file to the target server in read-only mode, so that the target file is accessible but not modified, thereby preventing the target file from being tampered with and improving the security of the target file published by the target website.
[0039] In an optional embodiment of the present application, the method further includes:
[0040] In the case of obtaining a modification instruction to modify the target file, detecting whether the target server is started, the modification instruction carrying a modification strategy;
[0041] When the target server is not started, modifying the target file according to the modification strategy;
[0042] When the target server is started, the target server is controlled to be shut down, and the target file is modified according to the modification strategy.
[0043] When the target file published by the target website needs to be modified, the maintenance personnel of the target website can send a modification instruction to the website file protection system through the user interaction device, wherein the modification instruction carries a modification policy. When the website file protection system obtains the modification instruction, it needs to first detect the status of the current target server. Only when the target server is in a closed state can the target file be modified according to the modification policy.
[0044] Specifically, when the target server is started, the user may be browsing the target website. If the target file is modified directly according to the modification strategy, the target file modification may fail and the user may fail to browse the target website. Therefore, the website file protection system needs to send a control instruction to the target server to control the target server to shut down.
[0045] The above implementation scheme of the present application can ensure that the target server is in a closed state when the target file is modified, prevent the target file modification failure from occurring, and prevent users browsing the target website from being affected by the modification, by detecting whether the target server is started when the modification instruction is obtained, and modifying the target file when the target server is not started, and controlling the target server to shut down when the target server is started.
[0046] In an optional embodiment of the present application, modifying the target file according to the modification strategy includes:
[0047] Controlling the target server to uninstall the first image file;
[0048] Remounting the first image file on the target server in read-write mode;
[0049] According to the modification strategy, the target file in the first image file is modified, and the modified second image file is obtained.
[0050] The target website publishes the target file by mounting the first image file on the target server in read-only mode. At this time, since the mounting mode of the first image file is read-only mode, the target file cannot be modified. When the target file needs to be modified, the mounting mode of the first image file needs to be adjusted to read-write mode first. In the read-write mode, the website file protection system can modify the target file according to the modification strategy.
[0051] Specifically, the mounting mode of the first image file can be modified by remounting. First, the website file protection system sends a control instruction to the target server to control the target server to uninstall the first image file. Then the website file protection system remounts the first image file on the target server in read-write mode. At this time, the mounting mode of the first image file is read-write mode. The website file protection system can modify the target file in the first image file according to the modification strategy, and the target file in the virtual disk will be modified synchronously.
[0052] The above implementation scheme of the present application realizes the conversion of the mounting mode of the first image file from read-only mode to read-write mode by controlling the target server to uninstall the first image file and re-mounting the first image file on the target server in read-write mode, so that the target file in the first image file can be modified according to the modification policy through the target server.
[0053] In an optional embodiment of the present application, after modifying the target file in the first image file according to the modification strategy, the method further includes:
[0054] Controlling the target server to uninstall the second image file;
[0055] The second image file is remounted to the target server in read-only mode.
[0056] After modifying the target file in the first image file, the image file mounted on the target server is the second image file, which contains the modified target file. At this time, the second image file is still mounted on the target server in read-write mode. In order to prevent the target file from being maliciously tampered with, the mounting mode of the second image file needs to be modified to read-only mode.
[0057] Specifically, the website file protection system can send a control instruction to the target server to enable the target server to uninstall the second image file, and then the website file protection system remounts the second image file on the target server in read-only mode. At this time, the mounting mode of the second image file is read-only mode, and the target file is allowed to be accessed but not modified.
[0058] The above implementation scheme of the present application can avoid the target file from being tampered with and improve the security of the target file published by the target website by uninstalling the second image file obtained after modifying the target file from the target server and remounting it on the target server in read-only mode.
[0059] In an optional embodiment of the present application, modifying the target file in the first image file according to the modification strategy includes:
[0060] Determine a modification type according to the modification strategy, wherein the modification type includes: at least one of adding, replacing and deleting;
[0061] When the modification type is adding, determining the first file to be added and the corresponding adding position of the first file in the target file according to the modification strategy, and adding the first file at the adding position;
[0062] When the modification type is deletion, determining the second file to be deleted and the deletion position corresponding to the second file in the target file according to the modification strategy, and deleting the second file at the deletion position;
[0063] When the modification type is replacement, the third file to be replaced, the replacement position corresponding to the third file in the target file and the fourth file to be replaced are determined according to the modification strategy, and the third file at the replacement position is replaced with the fourth file.
[0064] Specifically, the modification type can be determined according to the modification strategy, and the modification type includes: at least one of addition, replacement and deletion, wherein, when the modification type is addition, the first file to be added and the corresponding adding position of the first file in the target file can be determined according to the modification strategy, and in this case, the first file needs to be added to the adding position. When the modification type is deletion, the second file to be deleted and the corresponding deletion position of the second file in the target file can be determined according to the modification strategy, and in this case, the second file located at the deletion position needs to be deleted. When the modification type is replacement, the third file to be replaced, the corresponding replacement position of the third file in the target file and the fourth file to be replaced can be determined according to the modification strategy, and in this case, the third file located at the replacement position needs to be replaced with the fourth file.
[0065] The above implementation scheme of the present application can determine the specific modification type, modified file and the location of the modified file by analyzing the modification strategy, and can realize the modification of the target file according to the modification strategy, thereby realizing the modification of the target file by the website file protection system.
[0066] In an optional embodiment of the present application, the target file includes: a file directory published by the target website and at least one sub-file, and a file title corresponding to the sub-file is located in the file directory.
[0067] Specifically, the target file includes a file directory and at least one sub-file, wherein the file directory is a file directory that needs to be published on the target website, and the file title corresponding to each sub-file is located in the file target directory.
[0068] It should be noted that the modification instructions for the target file obtained by the website file protection system may be modifications to the file directory, modifications to sub-files, or modifications to both the file directory and sub-files. The specific modification content needs to be determined based on the modification strategy carried in the modification instructions.
[0069] The overall implementation process of the embodiment of the present application is introduced below. Figure 2 As shown, including:
[0070] Step 201: Create a source virtual disk and a virtual mirror disk corresponding to the source virtual disk.
[0071] Step 202: Save the target file published by the target website into the source virtual disk, and update the image file corresponding to the virtual image disk to obtain a first image file.
[0072] Step 203: mount the first image file in read-only mode on a target server, where the target server is a server corresponding to the target website.
[0073] Step 204, start the target server.
[0074] Step 205, determine whether the target file needs to be modified, if so, execute step 206, otherwise execute step 205.
[0075] Step 206, shut down the target server, control the target server to uninstall the first image file, and re-mount the first image file to the target server in a read-write mode.
[0076] Step 207, modify the target file to obtain a second image file, uninstall the second image file, and re-mount the second image file to the target server in read-only mode.
[0077] Step 208, start the target server, and then execute step 205.
[0078] The above implementation scheme saves the target file published by the target website to the source virtual disk, and synchronously updates it to the virtual mirror disk to obtain the first mirror file, and then mounts the first mirror file on the target server in read-only mode. Due to the setting of the read-only mode, the target file is allowed to be accessed but not modified. When the target file needs to be modified, the target server is shut down, the target server is controlled to uninstall the first mirror file, and the first mirror file is remounted to the target server in read-write mode. After modifying the target file to obtain the second mirror file, the second mirror file is uninstalled, and the second mirror file is remounted to the target server in read-only mode. This can prevent the target file from being tampered with, and improve the security of the target file published by the target website.
[0079] The present application also provides a website file protection device, such as Figure 3 As shown, the device comprises:
[0080] A creation module 301 is used to create a source virtual disk and a virtual mirror disk corresponding to the source virtual disk;
[0081] The acquisition module 302 is used to save the target file published by the target website to the source virtual disk, and update the image file corresponding to the virtual image disk to obtain the first image file;
[0082] The mounting module 303 is used to mount the first mirror file on a target server in a read-only mode so that the target file is accessible but not modifiable. The target server is a server corresponding to the target website.
[0083] The website file protection device provided by the present application saves the target file published by the target website to the source virtual disk, updates the virtual mirror disk to obtain a first mirror file, and mounts the first mirror file to the target server in read-only mode, so that the target file is allowed to be accessed but not modified, thereby preventing the target file from being tampered with and improving the security of the target file published by the target website.
[0084] Optionally, the device further comprises:
[0085] A detection module, configured to detect whether the target server is started when a modification instruction to modify the target file is obtained, wherein the modification instruction carries a modification strategy;
[0086] A modification module, used for modifying the target file according to the modification strategy when the target server is not started;
[0087] The modification module is further used to control the target server to shut down when the target server is started, and to modify the target file according to the modification strategy.
[0088] Optionally, the modification module includes:
[0089] A first control submodule, used for controlling the target server to uninstall the first image file;
[0090] A first mounting submodule, used for re-mounting the first image file on the target server in a read-write mode;
[0091] The modification submodule is used to modify the target file in the first image file according to the modification strategy, and obtain the modified second image file.
[0092] Optionally, after modifying the target file in the first image file according to the modification strategy, the modification module further includes:
[0093] A second control submodule, used for controlling the target server to uninstall the second image file;
[0094] The second mounting submodule is used to remount the second image file to the target server in read-only mode.
[0095] Optionally, the modification submodule includes:
[0096] A determination unit, configured to determine a modification type according to the modification strategy, wherein the modification type includes at least one of: adding, replacing and deleting;
[0097] an adding unit, configured to determine, when the modification type is adding, a first file to be added and an adding position corresponding to the first file in the target file according to the modification strategy, and add the first file at the adding position;
[0098] a deleting unit, configured to determine, when the modification type is deletion, a second file to be deleted and a deletion position corresponding to the second file in the target file according to the modification strategy, and delete the second file at the deletion position;
[0099] A replacement unit is used to determine, when the modification type is replacement, a third file to be replaced, a replacement position corresponding to the third file in the target file, and a fourth file to be replaced according to the modification strategy, and replace the third file at the replacement position with the fourth file.
[0100] Optionally, the target file includes: a file directory published by the target website and at least one sub-file, and a file title corresponding to the sub-file is located in the file directory.
[0101] The present application also provides a website file protection system. Figure 4 As shown, the system comprises:
[0102] Website file management layer, interface layer and core service layer;
[0103] The website file management layer is used to call the first interface provided by the interface layer to create a source virtual disk and a virtual mirror disk corresponding to the source virtual disk; save the target file published by the target website to the virtual disk, and update the mirror file corresponding to the virtual mirror disk to obtain the first mirror file; and call the second interface provided by the interface layer to send a control instruction to the core service layer, so that the core service layer mounts the first mirror file in read-only mode on a target server, and the target server is a server corresponding to the target website;
[0104] The interface layer includes: a first interface for providing the website file management layer with a method for creating a source virtual disk and a virtual mirror disk corresponding to the source virtual disk, and a second interface for providing the website file management layer with a method for the website file management layer to send a control instruction to the core service layer;
[0105] The core service layer is used to receive the control instruction sent by the website file management layer through the second interface, and mount the first mirror file on the target server in read-only mode according to the control instruction, so that the target file can be accessed but not modified.
[0106] On the operating system corresponding to the target server, the website file management layer can call the first interface provided by the interface layer to create a source virtual disk and a virtual mirror disk corresponding to the source virtual disk, and save the target file published by the target website to the virtual disk, and update the mirror file corresponding to the virtual mirror disk to obtain the first mirror file, wherein the virtual mirror disk is established based on the source virtual disk, and the files in the source virtual disk can be mapped to the virtual mirror disk, that is, when the target file is saved to the source virtual disk, the target file will be synchronously saved in the virtual mirror disk.
[0107] Specifically, the target file published by the target website is displayed on the target website in the form of a web page for users browsing the website to view. If criminals invade the server of the target website, tamper with the target file, and spread malicious and illegal content, it will have a great impact on the website and users. The website file protection system of the embodiment of the present application does not directly save the target file published by the target website to the target server, but the website file management layer calls the second interface provided by the interface layer to send a control instruction to the core service layer, so that the core service layer mounts the first mirror file in read-only mode on the target server, so that the target file can be accessed but not modified.
[0108] The website file protection system provided by the present application saves the target file published by the target website to the source virtual disk, updates the virtual mirror disk to obtain a first mirror file, and mounts the first mirror file to the target server in read-only mode, so that the target file is allowed to be accessed but not modified, thereby preventing the target file from being tampered with and improving the security of the target file published by the target website.
[0109] Optionally, the website file management layer is also used to detect whether the target server is started when a modification instruction to modify the target file is obtained, and the modification instruction carries a modification policy; when the target server is not started, modify the target file according to the modification policy; when the target server is started, control the target server to shut down and modify the target file according to the modification policy.
[0110] Optionally, the website file management layer is also used to call the second interface provided by the interface layer to send a control instruction to the core service layer, so that the core service layer controls the target server to uninstall the first image file; remounts the first image file on the target server in read-write mode; and after the first image file is remounted on the target server in read-write mode, the website file management layer modifies the target file in the first image file according to the modification strategy, and obtains the modified second image file.
[0111] Optionally, after the website file management layer modifies the target file in the first image file, the website file management layer calls the second interface provided by the interface layer to send a control instruction to the core service layer, so that the core service layer controls the target server to uninstall the second image file; and remounts the second image file to the target server in read-only mode.
[0112] Optionally, the website file management layer is further used to: determine the modification type according to the modification strategy, wherein the modification type includes: at least one of addition, replacement and deletion; when the modification type is addition, determine the first file to be added and the corresponding adding position of the first file in the target file according to the modification strategy, and add the first file at the adding position; when the modification type is deletion, determine the second file to be deleted and the corresponding deletion position of the second file in the target file according to the modification strategy, and delete the second file at the deletion position; when the modification type is replacement, determine the third file to be replaced, the corresponding replacement position of the third file in the target file and the fourth file to be replaced according to the modification strategy, and replace the third file at the replacement position with the fourth file.
[0113] Optionally, the target file saved to the virtual disk includes: a file directory published by the target website and at least one sub-file, and a file title corresponding to the sub-file is located in the file directory.
[0114] Specifically, Figure 4 As shown, the website file management layer is located at the top layer of the website file protection system, including a virtual disk and virtual mirror disk creation management module, a target file publishing module and a target file modification module.
[0115] Among them, the virtual disk and virtual mirror disk creation management module is used to call the first interface provided by the interface layer to create a virtual disk and a virtual mirror disk, control the mounting mode of the image file in the virtual mirror disk on the target server through the second interface, and receive the mounting mode of the image file in the virtual mirror disk on the target server sent by the target file publishing module and the target file modification module.
[0116] The target file publishing module is used to save the target file published by the target website to the virtual disk, and send the mounting mode of the image file in the virtual image disk on the target server to the virtual disk and virtual image disk creation management module, specifically, mounting the first image file containing the target file to the target server in read-only mode.
[0117] The target file modification module is used to obtain a modification instruction for modifying the target file, and to modify the target file according to the modification strategy carried in the modification instruction, and to send the mounting mode of the image file in the virtual image disk on the target server to the virtual disk and virtual image disk creation management module. Specifically, the first image file is first unloaded, and the first image file is mounted to the target server in a read-write mode. After the target file modification is completed and the second image file is obtained, the second image file is unloaded, and then the second image file is mounted in a read-only mode.
[0118] The interface layer is located in the middle layer of the website file protection system, and plays a connecting role between the website file management layer and the core service layer, including a virtual disk management interface and a file system service interface. The virtual disk management interface includes: a first interface for providing the website file management layer with a source virtual disk and a virtual mirror disk corresponding to the source virtual disk, and a second interface for providing the website file management layer with a control instruction for the website file management layer to send to the core service layer, wherein the file system service interface is provided by the operating system corresponding to the target server.
[0119] The core service layer is located at the bottom layer of the website file protection system, and includes a virtual disk driver and a read-write control module. Among them, the virtual disk driver is used to receive the mount mode of the virtual mirror disk on the target server sent by the virtual disk management interface in the interface layer, and respond to the access request sent by the file system service interface in the interface layer according to the mount mode sent by the read-write control module. Specifically, when the mount mode of the virtual mirror disk is read-only mode, respond to the read request in the access request, and reject the write request in the access request; when the mount mode of the virtual mirror disk is read-write mode, respond to both the read request and the write request in the access request. The read-write control module is used to monitor the mount mode of the virtual mirror disk and send the mount mode to the virtual disk driver.
[0120] An embodiment of the present application also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the computer program is executed by the processor, each process of the above-mentioned website file protection method embodiment is implemented, and the same technical effect can be achieved. To avoid repetition, it will not be described here.
[0121] The embodiment of the present application also provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the various processes of the above-mentioned website file protection method embodiment are implemented, and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.
[0122] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present application is generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions may be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium, for example, the computer instructions may be transmitted from a website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) mode to another website site, computer, server or data center. The computer-readable storage medium may be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more available media integrated. The available medium may be a magnetic medium, (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state drive Solid State Disk (SSD)), etc.
[0123] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants 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, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.
[0124] Each embodiment in this specification is described in a related manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the system embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0125] The above description is only a preferred embodiment of the present application and is not intended to limit the protection scope of the present application. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application are included in the protection scope of the present application.
Claims
1. A website file protection method, characterized in that: Applied to a website file protection system, the method comprises: Creating a source virtual disk and a virtual mirror disk corresponding to the source virtual disk; The target file published by the target website is saved in the source virtual disk, and the image file corresponding to the virtual image disk is updated to obtain a first image file; Mounting the first image file on a target server in read-only mode so that the target file is accessible but not modifiable, the target server being a server corresponding to the target website; When a modification instruction to modify the target file is obtained, controlling the target server to be in a closed state, wherein the modification instruction carries a modification strategy; Controlling the target server to uninstall the first image file; Remounting the first image file on the target server in read-write mode; According to the modification strategy, the target file in the first image file is modified, and the modified second image file is obtained.
2. The website file protection method according to claim 1, characterized in that: When a modification instruction to modify the target file is obtained, controlling the target server to be in a closed state includes: In case a modification instruction to modify the target file is obtained, detecting whether the target server is started; When the target server is not started, the target server is in a closed state; When the target server is started, the target server is controlled to be shut down so that the target server is in a shut down state.
3. The website file protection method according to claim 1, characterized in that: After modifying the target file in the first image file according to the modification strategy, the method further includes: Controlling the target server to uninstall the second image file; The second image file is remounted to the target server in read-only mode.
4. The website file protection method according to claim 1, characterized in that: Modifying the target file in the first image file according to the modification strategy includes: Determine a modification type according to the modification strategy, wherein the modification type includes: at least one of adding, replacing and deleting; When the modification type is adding, determining the first file to be added and the corresponding adding position of the first file in the target file according to the modification strategy, and adding the first file at the adding position; When the modification type is deletion, determining the second file to be deleted and the deletion position corresponding to the second file in the target file according to the modification strategy, and deleting the second file at the deletion position; When the modification type is replacement, the third file to be replaced, the replacement position corresponding to the third file in the target file and the fourth file to be replaced are determined according to the modification strategy, and the third file at the replacement position is replaced with the fourth file.
5. The website file protection method according to any one of claims 1 to 4, characterized in that: The target file includes: a file directory published by the target website and at least one sub-file, and a file title corresponding to the sub-file is located in the file directory.
6. A website file protection device, characterized in that: The device comprises: A creation module, used to create a source virtual disk and a virtual mirror disk corresponding to the source virtual disk; An acquisition module, used for saving the target file published by the target website into the source virtual disk, and updating the image file corresponding to the virtual image disk to obtain the first image file; A mounting module, used for mounting the first image file on a target server in a read-only mode, so that the target file is allowed to be accessed but not modified, the target server being a server corresponding to the target website; in the case of obtaining a modification instruction to modify the target file, controlling the target server to be in a closed state, the modification instruction carrying a modification policy; A first control submodule, used for controlling the target server to uninstall the first image file; A first mounting submodule, used for re-mounting the first image file on the target server in a read-write mode; The modification submodule is used to modify the target file in the first image file according to the modification strategy, and obtain the modified second image file.
7. A website file protection system, characterized in that: The system comprises: Website file management layer, interface layer and core service layer; The website file management layer is used to call the first interface provided by the interface layer to create a source virtual disk and a virtual mirror disk corresponding to the source virtual disk; save the target file published by the target website to the virtual disk, and update the mirror file corresponding to the virtual mirror disk to obtain the first mirror file; and call the second interface provided by the interface layer to send a control instruction to the core service layer, so that the core service layer mounts the first mirror file in read-only mode on a target server, and the target server is a server corresponding to the target website; The interface layer includes: a first interface for providing the website file management layer with a method for creating a source virtual disk and a virtual mirror disk corresponding to the source virtual disk, and a second interface for providing the website file management layer with a method for the website file management layer to send a control instruction to the core service layer; The core service layer is used to receive the control instruction sent by the website file management layer through the second interface, and mount the first image file on the target server in read-only mode according to the control instruction, so that the target file can be accessed but not modified; The website file management layer is also used to control the target server to be in a closed state when a modification instruction to modify the target file is obtained, and the modification instruction carries a modification strategy; The website file management layer is also used to call the second interface to send the control instruction to the core service layer, so that the core service layer controls the target server to uninstall the first image file; remounts the first image file on the target server in read-write mode; after the first image file is remounted on the target server in read-write mode, the website file management layer modifies the target file in the first image file according to the modification strategy, and obtains the modified second image file.
8. An electronic device, characterized in that: include: A memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program, when executed by the processor, implements the steps of the website file protection method according to any one of claims 1 to 5.
9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the website file protection method according to any one of claims 1 to 5 are implemented.
Citation Information
Patent Citations
Quick starting method and system for a virtual machine of network security practical training platform
CN112363795A