A content security audit method and system
By opening firewall ports in virtual machines, decompressing and loading service packages, judging data directories, setting startup sequences and monitoring status information, automatic repair and alarm of content security audit system is achieved, and the deployment cost and low efficiency in the existing technology is solved. and service unavailability issues, real-time monitoring and alarm functions are provided.
Patent Information
- Application Number
- CN202210016420.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-01-07
- Publication Date
- 2024-11-29
- Estimated Expiration
- 2042-01-07
AI Technical Summary
In the prior art, the content security audit system is difficult to alarm and repair in time, resulting in high deployment costs, low efficiency, prone to error operations, and high maintenance costs, especially when the server is down.
A content security audit method is adopted, based on the virtual machine, decompress and load the compressed package by opening the firewall port, determine whether the service data directory exists, start the corresponding service, and set the service startup sequence and IP self-adjustment through scripts to monitor the server status information , achieve alarm and automatic repair.
One-click deployment is realized, the steps of privatization are simplified, automatic service restoration is added, the service unavailability problem caused by server downtime is solved, and real-time monitoring and alarm systems are equipped to dynamically prompt related service information.
Smart Images

Figure CN114385449B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of information content security technology, and more specifically, to a content security audit method and system. Background Art
[0002] The private deployment consists of multiple proofreading modules and basic service modules. Each module has data packets, image packages and code packages. When problems occur, they cannot be discovered in time and the corresponding configuration files need to be modified in sequence. The deployment cost is high, the efficiency is low, and errors are prone to occur due to incorrect operations. The maintenance cost is high. After deployment, if force majeure occurs, such as the IP address reallocation after the server restarts, causing the server to crash, it will not be able to provide services normally.
[0003] Therefore, how to promptly report problems and self-repair to ensure normal service provision is a technical problem that needs to be solved. Summary of the invention
[0004] The present invention provides a content security audit method to solve the technical problems of the prior art that the alarm cannot be given in time and the self-repair cannot be performed. The method is applied to a virtual machine and comprises:
[0005] Opening ports of the firewall based on the firewall type, the firewall types including ufw and firewalld;
[0006] Placing a preset compressed package in the same preset directory, wherein the preset compressed package includes a data package and an image package, distinguishing and decompressing the data package and loading the image package based on the type of the compressed package, placing the decompressed data in a specified directory, creating an empty directory and writing a service configuration file;
[0007] Determine whether the data directory required by each service in the service project exists, and if so, start the corresponding service; if not, report an error to the terminal; the service project includes basic services and proofreading services;
[0008] After all the service items are started, the startup sequence of the service items and the self-adjustment of the service IP are set based on the preset scripts, wherein the preset scripts include a first script, a second script and a monitoring script;
[0009] Based on the monitoring script, the real-time status information of the server is obtained, and the number of service modules is adjusted based on the real-time status information of the server. If the real-time status information of the server reaches a threshold, an alarm is issued. The real-time status information of the server includes temperature, CPU usage and memory usage.
[0010] In some embodiments of the present application, the data packet and the loading mirror packet are distinguished and decompressed based on the type of the compressed packet, the decompressed data is placed in a specified directory, an empty directory is created and a service configuration file is written, specifically:
[0011] The types of compressed packages include tar image packages and tar.gz data packages. The package name is assigned to the TAR variable and the TARGZ variable based on the type of the compressed package. The TAR value and the TARGZ value are read in a loop, the image package is loaded based on the TAR value, and the data package is decompressed to a specified directory based on the TARGZ value. After decompression, an empty directory is created and the service configuration file is written.
[0012] In some embodiments of the present application, the method further includes:
[0013] After writing the service configuration file, assign the image ID to the variable based on the image name and tag.
[0014] In some embodiments of the present application, it is determined whether the data directory required by each service in the service project exists. If it exists, the corresponding service is started. If it does not exist, an error is reported to the terminal. Specifically:
[0015] Determine whether the data directory required by each service in the service project exists, the data directory required by the service being the designated directory where the corresponding data packet is decompressed;
[0016] If it exists, switch to the directory corresponding to the service, modify the service configuration file based on the server IP, assign values to the service container based on preset variables, and start the corresponding service. The preset variables include the mapping directory, image ID, and port number.
[0017] If it does not exist, an error is reported to the terminal.
[0018] In some embodiments of the present application, the startup sequence of service items and the self-adjustment of service IP are set based on a preset script, specifically:
[0019] If the server IP changes, modify the IP of the calling service in the service configuration file based on the first script, and add the first script to the environment variables;
[0020] The first script and the second script are added to the startup process, and the server is restarted. After the restart, the second script is called to adjust the service startup sequence in the service project.
[0021] Accordingly, the present invention also proposes a content security audit system, which is applied to a virtual machine. The system includes:
[0022] A port opening module, used to open the port of the firewall based on the firewall type, the firewall type includes ufw and firewalld;
[0023] A decompression and loading module, used to place a preset compressed package in the same preset directory, the preset compressed package includes a data package and a mirror package, distinguish and decompress the data package and the loaded mirror package based on the type of the compressed package, place the decompressed data in a specified directory, create an empty directory and write a service configuration file;
[0024] A determination module, used to determine whether the data directory required by each service in the service project exists, and if so, start the corresponding service, and if not, report an error to the terminal, wherein the service project includes basic services and proofreading services;
[0025] A data restoration module, which is used to set the startup sequence of the service projects and self-adjust the service IP based on a preset script after all the service projects are started, wherein the preset script includes a first script, a second script and a monitoring script;
[0026] A monitoring module, used to obtain the real-time status information of the server based on the monitoring script, adjust the number of service modules based on the real-time status information of the server, and issue an alarm if the real-time status information of the server reaches a threshold;
[0027] The real-time status information of the server includes temperature, CPU usage and memory usage.
[0028] In some embodiments of the present application, the decompression loading module is specifically used to:
[0029] The types of compressed packages include tar image packages and tar.gz data packages. The package name is assigned to the TAR variable and the TARGZ variable based on the type of the compressed package. The TAR value and the TARGZ value are read in a loop, the image package is loaded based on the TAR value, and the data package is decompressed to a specified directory based on the TARGZ value. After decompression, an empty directory is created and the service configuration file is written.
[0030] In some embodiments of the present application, the decompression loading module is further used to:
[0031] After writing the service configuration file, assign the image ID to the variable based on the image name and tag.
[0032] In some embodiments of the present application, the determination module is specifically used to:
[0033] Determine whether the data directory required by each service in the service project exists, the data directory required by the service being the designated directory where the corresponding data packet is decompressed;
[0034] If it exists, switch to the directory corresponding to the service, modify the service configuration file based on the server IP, assign values to the service container based on preset variables, and start the corresponding service. The preset variables include the mapping directory, image ID, and port number.
[0035] If it does not exist, an error is reported to the terminal.
[0036] In some embodiments of the present application, the data restoration module is specifically used to:
[0037] If the server IP changes, modify the IP of the calling service in the service configuration file based on the first script, and add the first script to the environment variables;
[0038] The first script and the second script are added to the startup process, and the server is restarted. After the restart, the second script is called to adjust the service startup sequence in the service project.
[0039] Compared with the prior art, the present invention has the following advantages:
[0040] This application opens the port of the firewall based on the firewall type, places the preset compressed package in the same preset directory, distinguishes and decompresses the data packet and loads the image package based on the type of the compressed package, places the decompressed data in the specified directory, creates an empty directory and writes the service configuration file; determines whether the data directory required for each service in the service project exists, if it exists, starts the corresponding service, if it does not exist, reports an error to the terminal, after all the service projects are started, sets the startup sequence of the service projects and the self-adjustment of the service IP based on the preset script; obtains the real-time status information of the server based on the monitoring script, adjusts the number of service modules based on the real-time status information of the server, and alarms if the real-time status information of the server reaches the threshold. It is simple and convenient to replace the cumbersome steps of private deployment with one-click deployment, and adds automatic service restoration to solve the problem of service unavailability caused by server downtime. After the server goes down, dynamic prompts are used for related service information. It is equipped with an alarm system, which monitors the server's own status in real time through the monitoring module and reports alarm information in time. BRIEF DESCRIPTION OF THE DRAWINGS
[0041] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For those skilled in the art, other drawings can be obtained based on these drawings without creative work.
[0042] Figure 1A schematic diagram of a process flow of a content security audit method proposed in an embodiment of the present invention is shown;
[0043] Figure 2 A structural diagram of a content security audit system proposed in an embodiment of the present invention is shown. DETAILED DESCRIPTION
[0044] 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 only 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.
[0045] The present application embodiment provides a content security audit method, which is applied to a virtual machine, such as Figure 1 As shown, the method comprises the following steps:
[0046] Step S101, opening the port of the firewall based on the firewall type, the firewall type includes ufw and firewalld.
[0047] In this embodiment, the firewall type is checked by executing the check status command, and the firewall types include but are not limited to ufw (The Ubuntu Firewall) and firewalld. After confirming the firewall type, the pre-defined array is substituted into the variable to open the firewall port.
[0048] It is understandable that opening the firewall port is equivalent to opening a channel to allow subsequent steps to proceed stably and ensure service connectivity.
[0049] Step S102, placing the preset compressed package in the same preset directory, the preset compressed package includes but is not limited to a data package and a mirror package, distinguishing and decompressing the data package and loading the mirror package based on the type of the compressed package, placing the decompressed data in the specified directory, creating an empty directory and writing the service configuration file.
[0050] In this embodiment, the preset compressed package is placed in the same directory, the compressed package includes data and mirror package, the data package and the mirror package are distinguished according to the type of the compressed package, and the data package is decompressed and the mirror package is loaded, the data in the data package is decompressed to the specified directory, an empty directory is created and the service-related configuration files are written.
[0051] To ensure accuracy, in some embodiments of the present application, the types of compressed packages include tar image packages and tar.gz data packages. The package name is assigned to the TAR variable and the TARGZ variable based on the type of the compressed package. The TAR value and the TARGZ value are read in a loop, the image package is loaded based on the TAR value, and the data package is decompressed to a specified directory based on the TARGZ value. After decompression, an empty directory is created and the service configuration file is written.
[0052] In this embodiment, the types of compressed packages include tar image packages and tar.gz data packages. The package name is assigned to the TAR variable according to the tar image package, and the package name is assigned to the TARGZ variable according to the tar.gz data package. The TAR value is read and the image package is loaded through a for loop. The TARGZ value is then read and the tar.gz data package is decompressed to the specified directory through a for loop. An empty directory is created and service-related configuration files are written.
[0053] To further improve accuracy, in some embodiments of the present application, after writing the service configuration file, the image ID is assigned to a variable based on the image name and the tag.
[0054] In this embodiment, by searching the image name and label, the relevant image ID is assigned to each variable.
[0055] Step S103, determining whether the data directory required by each service in the service project exists, if so, starting the corresponding service, if not, reporting an error to the terminal, the service project includes basic services and proofreading services.
[0056] In this embodiment, if is used to determine whether the data directory required by each service in the service project exists, if it exists, the corresponding service is started, if it does not exist, an error is reported to the terminal to notify the user. The service project includes but is not limited to basic services and proofreading services. Specific services can be adjusted according to actual needs and are within the scope of protection of this application.
[0057] To ensure reliability, in some embodiments of the present application, it is determined whether the data directory required by each service in the service project exists, where the data directory required by the service is the designated directory where the corresponding data packet is decompressed; if it exists, switch to the directory corresponding to the service, modify the service configuration file based on the server IP, assign values to the service container based on preset variables, and start the corresponding service, where the preset variables include a mapping directory, a mirror ID, and a port number; if it does not exist, report an error to the terminal.
[0058] In this embodiment, if is used to determine whether the data directory required by each service in the service project exists. The data directory required by the service is the directory where the data packet is decompressed and placed. If it exists, switch to the directory corresponding to the service, modify the service configuration file according to the server's IP, assign it to the service container according to the preset variables, and start the corresponding service. The preset variables are obtained by assigning the image ID to the variable according to the image name and label. If it does not exist, an error is reported to the terminal. The preset variables include but are not limited to mapping directories, image IDs, and port numbers.
[0059] Step S104, after all the service items are started, the startup sequence of the service items and the self-adjustment of the service IP are set based on a preset script, and the preset script includes a first script, a second script and a monitoring script.
[0060] In this embodiment, after all the above service items are started, the startup order of the service items and the self-repair of the IP in the service are set according to the preset scripts, and the preset scripts include but are not limited to the first script, the second script and the monitoring script. The first script is used to obtain the target server IP, the second script is used to restart the server and adjust the service order, and the monitoring script is used to obtain the real-time status information of the server and alarm when the threshold is reached.
[0061] In order to further improve stability, in some embodiments of the present application, if the server IP changes, the IP calling the service in the service configuration file is modified based on the first script, and the first script is added to the environment variable; the first script and the second script are added to the boot startup, the server is restarted, and after the restart, the second script is called to adjust the service startup order in the service project.
[0062] In this embodiment, when the target server IP changes, the IP of the service call in the service configuration file is modified according to the first script to ensure the availability of the service. The first script is added to the environment variable to ensure that the service can self-repair the IP when the IP is not correctly obtained under special circumstances. The first script and the second script are respectively added with execution permissions, and the first script and the second script are added to the startup. After the server restarts, the second script is automatically called to achieve the purpose of adjusting the service order.
[0063] Step S105, obtaining the real-time status information of the server based on the monitoring script, adjusting the number of service modules based on the real-time status information of the server, and issuing an alarm if the real-time status information of the server reaches a threshold. The real-time status information of the server includes temperature, CPU usage, and memory usage.
[0064] In this embodiment, the monitoring script can obtain the real-time status information of the server through sensors or other devices. The real-time status information of the server includes but is not limited to the current temperature, CPU usage, and memory usage. The number of server modules is dynamically adjusted according to the above real-time status information of the server to ensure the normal operation of the server. A threshold is set. When at least one parameter information in the real-time status information of the server reaches the threshold, an alarm is issued to achieve real-time monitoring.
[0065] By applying the above technical solution, a content security audit method is applied in a virtual machine, the method comprising: opening the port of the firewall based on the firewall type, the firewall type comprising ufw and firewalld; placing a preset compressed package in the same preset directory, the preset compressed package comprising a data package and a mirror package, distinguishing and decompressing the data package and the loaded mirror package based on the type of the compressed package, placing the decompressed data in a specified directory, creating an empty directory and writing a service configuration file; judging whether the data directory required by each service in the service project exists, if so, starting the corresponding service, if not, reporting an error to the terminal, the service project comprising a basic service and a proofreading service; after all the service projects are started, setting the startup sequence of the service projects and the self-adjustment of the service IP based on a preset script, the preset script comprising a first script, a second script and a monitoring script; obtaining the real-time status information of the server based on the monitoring script, adjusting the number of service modules based on the real-time status information of the server, and alarming if the real-time status information of the server reaches a threshold, the real-time status information of the server comprising temperature, CPU usage and memory usage. One-click deployment replaces the cumbersome steps of private deployment, which is simple and convenient. Automatic service recovery is added to solve the problem of service unavailability caused by server downtime. After the server goes down, dynamic prompts are used for related service information. Equipped with an alarm system, the monitoring module monitors the server's own status in real time and reports alarm information in time.
[0066] In order to further explain the technical idea of the present invention, the technical solution of the present invention is now described in combination with specific application scenarios.
[0067] Step S101, based on the script automation method, the firewall type is confirmed by executing the check status command to return the result. After confirmation, the defined array is brought into the variable to open the firewall port.
[0068] Step S102, all existing compressed packages such as data packets and mirror packages are placed in the same directory, all packages are distinguished according to the package type (tar mirror package, tar.gz data packet) and the package name is assigned to the TAR and TARGZ variables, the TAR value is read through the for loop and the mirror package loading operation is executed, and then the for loop is executed to read the TARGZ value and all tar.gz data packets are decompressed into the specified directory through tar-zxvf-C, and tar-zxvf-C is to decompress the decompressed content into the specified directory. After decompression, an empty directory is created by scripting and the service-related configuration file is written in cat (concatenate) mode. The cat command is used to connect files and print them to the standard output device. The relevant mirror ID is assigned to each variable by searching the mirror name and label.
[0069] Step S103, after the above preparations are completed, start the basic service and proofreading service in sequence. Determine whether to start the relevant service by judging whether the service directory exists (determine whether the data directory required by each service in the service project exists) through if. If it does not exist, report an error to the terminal. If it exists, switch to the corresponding directory first, dynamically modify the configuration file through sed, assign the pre-defined relevant variables to the command to start the docker container and start the container. After the container is started, verify whether the service is started normally or an error is reported by calling the port through curl, and output the verification result to the user.
[0070] sed can process and edit text files according to the instructions of the script, automatically edit one or more files, simplify file operations, write conversion programs, etc.
[0071] Docker is an open source application container engine that allows developers to package their applications and dependent packages into a portable container in a unified way, and then publish them to any server with the Docker engine installed (including popular Linux machines and Windows machines), and can also achieve virtualization. Containers use a sandbox mechanism completely, and there will be no interface between them (similar to iPhone apps). There is almost no performance overhead, and they can be easily run in machines and data centers. Most importantly, they do not depend on any language, framework, or system.
[0072] curl (CommandLine Uniform Resource Locator) is a command line tool that uses URLs to transfer data or files.
[0073] Pre-defined related variables include but are not limited to mapping directory, image ID, and port number.
[0074] Step S104: After all services are started, data restoration is performed. Data restoration is performed by using Shell scripts. The configuration files in the scripts are dynamically modified by sed and directly run to restore data. The specific process is as follows:
[0075] The cat writing method in the script automatically generates two scripts, source (first script) and restart (second script). When the server IP changes, source is used to modify the IP of the service in the configuration file through sed to ensure the availability of the service, and add source to bash_profile (environment variable) to ensure that the service can self-repair when the IP is not correctly obtained under special circumstances. Source adds execution permissions to these two scripts through the customized service startup sequence, adds source and restart to the startup, and the server will automatically call the restart script after restarting to achieve the purpose of adjusting the service sequence.
[0076] Shell script is similar to batch processing under Windows / Dos, that is, various commands are pre-placed in a file for one-time execution. It is mainly used by administrators for setting or management. However, it is more powerful than batch processing under Windows and more efficient than programs edited with other programming programs. It uses commands under Linux / Unix.
[0077] source is used to obtain the server IP address, and restart is used to restart the server and adjust the service order.
[0078] Step S105, finally, a log monitoring script (monitoring script) is added to dynamically adjust the number of service modules by obtaining relevant monitoring information such as the current temperature, CPU usage, memory usage, etc. of the server to ensure the normal operation of the server, and set a threshold. When the threshold is reached in the above parameters, an alarm is triggered to achieve the purpose of real-time monitoring.
[0079] Through the description of the above implementation methods, those skilled in the art can clearly understand that the present invention can be implemented by hardware, or by means of software plus a necessary general hardware platform. Based on such an understanding, the technical solution of the present invention can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.), including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each implementation scenario of the present invention.
[0080] The present application also provides a content security audit system, which is applied to a virtual machine, such as Figure 2 As shown, the system includes:
[0081] A port opening module 201 is used to open the port of the firewall based on the firewall type, and the firewall type includes ufw and firewalld;
[0082] The decompression and loading module 202 is used to place the preset compressed package in the same preset directory, the preset compressed package includes a data package and a mirror package, distinguish and decompress the data package and the loaded mirror package based on the type of the compressed package, place the decompressed data in a specified directory, create an empty directory and write the service configuration file;
[0083] The determination module 203 is used to determine whether the data directory required by each service in the service project exists. If it exists, the corresponding service is started. If it does not exist, an error is reported to the terminal. The service project includes basic services and proofreading services;
[0084] The data restoration module 204 is used to set the startup sequence of the service items and the self-adjustment of the service IP based on the preset script after all the service items are started. The preset script includes a first script, a second script and a monitoring script;
[0085] A monitoring module 205, configured to obtain the real-time status information of the server based on the monitoring script, adjust the number of service modules based on the real-time status information of the server, and generate an alarm if the real-time status information of the server reaches a threshold;
[0086] The real-time status information of the server includes temperature, CPU usage and memory usage.
[0087] The decompression loading module 202 is specifically used for:
[0088] The types of compressed packages include tar image packages and tar.gz data packages. The package name is assigned to the TAR variable and the TARGZ variable based on the type of the compressed package. The TAR value and the TARGZ value are read in a loop, the image package is loaded based on the TAR value, and the data package is decompressed to a specified directory based on the TARGZ value. After decompression, an empty directory is created and the service configuration file is written.
[0089] The decompression loading module 202 is further used for:
[0090] After writing the service configuration file, assign the image ID to the variable based on the image name and tag.
[0091] The determination module 203 is specifically used for:
[0092] Determine whether the data directory required by each service in the service project exists, the data directory required by the service being the designated directory where the corresponding data packet is decompressed;
[0093] If it exists, switch to the directory corresponding to the service, modify the service configuration file based on the server IP, assign values to the service container based on preset variables, and start the corresponding service. The preset variables include the mapping directory, image ID, and port number.
[0094] If it does not exist, an error is reported to the terminal.
[0095] The data restoration module 204 is specifically used for:
[0096] If the server IP changes, modify the IP of the calling service in the service configuration file based on the first script, and add the first script to the environment variables;
[0097] The first script and the second script are added to the startup process, and the server is restarted. After the restart, the second script is called to adjust the service startup sequence in the service project.
[0098] Those skilled in the art will appreciate that the modules in the system in the implementation scenario can be distributed in the system of the implementation scenario according to the implementation scenario description, or can be changed accordingly and located in one or more systems different from the implementation scenario. The modules in the above implementation scenario can be combined into one module, or can be further split into multiple sub-modules.
[0099] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit it. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present application.
Claims
1. A content security audit method, characterized in that: Applied to virtual machines, including: Opening ports of the firewall based on the firewall type, the firewall types including ufw and firewalld; Placing a preset compressed package in the same preset directory, wherein the preset compressed package includes a data package and an image package, distinguishing and decompressing the data package and loading the image package based on the type of the compressed package, placing the decompressed data in a specified directory, creating an empty directory and writing a service configuration file; Determine whether the data directory required by each service in the service project exists, and if so, start the corresponding service; if not, report an error to the terminal; the service project includes basic services and proofreading services; After all the service items are started, the startup sequence of the service items and the self-adjustment of the service IP are set based on the preset scripts, wherein the preset scripts include a first script, a second script and a monitoring script; Specifically, after the service is started, a data restoration operation is performed. The data restoration adopts a Shell script method. The Shell script pre-places various commands into a file, uses commands under Linux / Unix, dynamically modifies the configuration file in the script through sed, and directly runs the script to perform data restoration; The cat writing method in the script automatically generates two scripts, the source first script and the restart second script. The source first script is used to modify the IP of the service in the configuration file through sed to ensure the availability of the service when the server IP changes, and the source first script is added to the bash_profile environment variable to ensure that the service self-repairs when the IP is not correctly obtained; the source first script adds execution permissions to the source first script and the restart second script through the customized service startup sequence, and adds the source first script and the restart second script to the startup. After the server restarts, the restart second script will be automatically called to adjust the service sequence; The real-time status information of the server is obtained based on the monitoring script, and the number of service modules is adjusted based on the real-time status information of the server. If the real-time status information of the server reaches a threshold, an alarm is issued. The real-time status information of the server includes: temperature, CPU usage and memory usage.
2. The method according to claim 1, characterized in that: Based on the type of the compressed package, the data package and the loaded mirror package are distinguished and decompressed, the decompressed data is placed in the specified directory, an empty directory is created and the service configuration file is written, specifically: The types of the compressed packages include tar image packages and tar.gz data packages. The package name is assigned to the TAR variable and the TARGZ variable based on the type of the compressed package. The TAR value and the TARGZ value are read in a loop, the image package is loaded based on the TAR value, and the data package is decompressed to a specified directory based on the TARGZ value. After decompression, an empty directory is created and the service configuration file is written.
3. The method according to claim 1, characterized in that Also includes: After writing the service configuration file, the image ID is assigned to the variable based on the image name and tag.
4. The method according to claim 3, characterized in that Determine whether the data directory required by each service in the service project exists. If it exists, start the corresponding service. If it does not exist, report an error to the terminal. Specifically: Determine whether the data directory required by each service in the service project exists, the data directory required by the service being the designated directory where the corresponding data packet is decompressed; If it exists, switch to the directory corresponding to the service, modify the service configuration file based on the server IP, assign values to the service container based on preset variables, and start the corresponding service. The preset variables include: mapping directory, image ID and port number; If it does not exist, an error is reported to the terminal.
5. The method according to claim 1, characterized in that The startup order of service items and self-adjustment of service IP are set based on the preset script, specifically: If the server IP changes, modify the IP of the calling service in the service configuration file based on the first script, and add the first script to the environment variables; The first script and the second script are added to the startup process, and the server is restarted. After the restart, the second script is called to adjust the service startup sequence in the service project.
6. A content security review system, characterized in that: Applied to virtual machines, including: A port opening module, used for opening the port of the firewall based on the firewall type, wherein the firewall type includes ufw and firewalld; A decompression and loading module, used to place a preset compressed package in the same preset directory, wherein the preset compressed package includes: a data package and a mirror package, distinguish and decompress the data package and the loaded mirror package based on the type of the compressed package, place the decompressed data in a specified directory, create an empty directory and write a service configuration file; A determination module, used to determine whether the data directory required by each service in the service project exists, and if so, start the corresponding service, and if not, report an error to the terminal, wherein the service project includes basic services and proofreading services; A data restoration module, which is used to set the startup sequence of the service items and self-adjust the service IP based on a preset script after all the service items are started, wherein the preset script includes a first script, a second script and a monitoring script; Specifically, after the service is started, a data restoration operation is performed. The data restoration adopts a Shell script method. The Shell script pre-places various commands into a file, uses commands under Linux / Unix, dynamically modifies the configuration file in the script through sed, and directly runs the script to perform data restoration; The cat writing method in the script automatically generates two scripts, the source first script and the restart second script. The source first script is used to modify the IP of the service in the configuration file through sed to ensure the availability of the service when the server IP changes, and the source first script is added to the bash_profile environment variable to ensure self-repair when the service fails to obtain the IP correctly; the source first script adds execution permissions to the source first script and the restart second script through the customized service startup sequence, and adds the source first script and the restart second script to the startup. After the server restarts, the restart second script will be automatically called to adjust the service sequence; A monitoring module, used to obtain the real-time status information of the server based on the monitoring script, adjust the number of service modules based on the real-time status information of the server, and issue an alarm if the real-time status information of the server reaches a threshold; The real-time status information of the server includes: temperature, CPU usage and memory usage.
7. The system according to claim 6, characterized in that The decompression loading module is specifically used for: The types of the compressed packages include tar image packages and tar.gz data packages. The package name is assigned to the TAR variable and the TARGZ variable based on the type of the compressed package. The TAR value and the TARGZ value are read in a loop, the image package is loaded based on the TAR value, and the data package is decompressed to a specified directory based on the TARGZ value. After decompression, an empty directory is created and the service configuration file is written.
8. The system according to claim 6, characterized in that The decompression loading module is also used for: After writing the service configuration file, the image ID is assigned to the variable based on the image name and tag.
9. The system according to claim 8, characterized in that The determination module is specifically used for: Determine whether the data directory required by each service in the service project exists, the data directory required by the service being the designated directory where the corresponding data packet is decompressed; If it exists, switch to the directory corresponding to the service, modify the service configuration file based on the server IP, assign values to the service container based on preset variables, and start the corresponding service. The preset variables include: mapping directory, image ID and port number; If it does not exist, an error is reported to the terminal.
10. The system according to claim 6, characterized in that The data restoration module is specifically used for: If the server IP changes, modify the IP of the calling service in the service configuration file based on the first script, and add the first script to the environment variables; The first script and the second script are added to the startup process, and the server is restarted. After the restart, the second script is called to adjust the service startup sequence in the service project.
Citation Information
Patent Citations
File system-based application running method and system
CN108089888A
A method for realizing automatic deployment of a database by a user-defined script
CN109241035A
Docker intrusion detection method and device based on command monitoring and medium
CN110138776A
Method, device and equipment for loading dynamic key by middleware and storage medium
CN113886014A
Server Image Migrations Into Public and Private Cloud Infrastructures
US20130290542A1
