A database backup encryption method and system
By binding filenames and passwords for secondary encryption during database backup and automatically cleaning up expired files using configuration files, the security issues of database backup sets are resolved, achieving efficient and secure dynamic encryption and compression, thus improving the security of data backup.
Patent Information
- Application Number
- CN202111419910.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-11-26
- Publication Date
- 2024-09-06
- Estimated Expiration
- 2041-11-26
AI Technical Summary
The lack of a secure and feasible dynamic encryption scheme for database backup sets in the existing technology leads to insufficient data backup security.
By binding the backup file name and password as the basic ciphertext on the source database side, a specific algorithm is used to perform secondary encryption to generate encrypted ciphertext, which is then encrypted and compressed on the data backup target side. The data recovery target side decrypts the data through reverse engineering and automatically cleans up expired backup files in conjunction with the configuration file.
It ensures that each backup file has a different ciphertext, which improves security. The encryption and compression process is completed on the data backup target, without consuming computing resources on the source database. It is simple to operate and has a high level of security.
Smart Images

Figure CN114254338B
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of data encryption, and more specifically, to a database backup encryption method and system. Background Art
[0002] With the popularization of informatization, all walks of life generate a large amount of production and life data every day, many of which, such as transaction information, service accounts, etc., contain a large amount of important personal privacy data. It is necessary to back up these key data. However, the security issues of data backup sets are becoming more and more prominent.
[0003] However, the prior art lacks a technical solution for performing secure and feasible dynamic encryption on backup sets. Summary of the invention
[0004] In order to solve the above technical problems such as the lack of a technical solution for performing safe and feasible dynamic encryption on backup sets in the prior art, the present invention is proposed. The embodiments of the present invention provide a database backup encryption method and system.
[0005] According to one aspect of an embodiment of the present invention, a database backup encryption method is provided, the method comprising:
[0006] The source database establishes an SSH communication channel with the remote data backup target through Linux;
[0007] The source database transfers the backup file to the data backup target end in the form of file data stream through the SSH communication pipeline;
[0008] The source database binds the backup file name and password as the basic ciphertext, and uses a specific algorithm to perform secondary encryption on the basic ciphertext to generate encrypted ciphertext;
[0009] The data backup target receives the data stream transmitted by the innobackupex tool from the source database, and backs up, encrypts and compresses the received data stream by calling pigz and the encrypted ciphertext generated by this program;
[0010] The data recovery target uses the backup file name and password as the ciphertext basis through reverse engineering, generates decrypted ciphertext based on the ciphertext using a specific algorithm, and decrypts the compressed file obtained from the data backup target through the decrypted ciphertext;
[0011] Automatically generate expired backup file cleanup programs and tasks through configuration files, and automatically execute expired backup file cleanup tasks on the data backup target end.
[0012] Optionally, the data is encrypted using an encrypted ciphertext, including: encrypting the data using a des3 encryption algorithm through an openssl tool.
[0013] Optionally, the backup file name uses the backup date and time.
[0014] Optionally, the data backup target receives the data transmitted from the source database using the innobackupex tool and backs up the data, including:
[0015] The data backup target receives the data stream transmitted by the innobackupex tool from the source database to perform a full backup; and / or
[0016] The data backup target receives the data stream transmitted by the innobackupex tool from the source database to perform incremental backup.
[0017] Optionally, specify the compression ratio through the configuration file to meet different backup needs.
[0018] Optionally, the data recovery target uses the backup file name and password as a ciphertext basis through reverse engineering, generates a decrypted ciphertext based on the ciphertext using a specific algorithm, and decrypts the compressed file obtained from the data backup target through the decrypted ciphertext, including:
[0019] Create a new passwd.txt file and add the compressed file name and password;
[0020] Use the backup file name and password as the ciphertext basis, and use a specific algorithm to generate decrypted ciphertext on the ciphertext basis;
[0021] Use the openssl tool to decrypt the compressed file using the generated decrypted ciphertext.
[0022] Optionally, the source database end is provided with a configuration file module, and the configuration file module includes customized information, the customized information including: the port of the database instance of the source database end, the database username and password of the source database end, the database configuration file path of the source database end, the data backup target host IP and root user password, the ssh port, the backup mode, the backup file retention period, and the timer time.
[0023] According to another aspect of an embodiment of the present invention, a database backup encryption system is provided, including a source database end, a data backup target end, and a data recovery target end, wherein
[0024] The source database is used to establish an SSH communication channel with the remote data backup target through Linux;
[0025] The source database end is also used to transfer the backup files to the data backup target end in the form of file data stream through the SSH communication pipeline;
[0026] The source database is used to bind the backup file name and password as the basic ciphertext, and use a specific algorithm to perform secondary encryption on the basic ciphertext to generate encrypted ciphertext;
[0027] The data backup target end is used to receive the data stream transmitted by the innobackupex tool from the source database end, and back up, encrypt and compress the received data stream by calling pigz and the encrypted ciphertext generated by this program;
[0028] The data recovery target is used to use the backup file name and password as the ciphertext basis through reverse engineering, generate decrypted ciphertext based on the ciphertext using a specific algorithm, and decrypt the compressed file obtained from the data backup target through the decrypted ciphertext;
[0029] The database backup encryption system is used to automatically generate expired backup file cleanup programs and tasks through configuration files, and automatically execute expired backup file cleanup tasks on the data backup target end.
[0030] According to another aspect of an embodiment of the present invention, an electronic device is provided, comprising: a processor; a memory for storing instructions executable by the processor; and the processor for reading the executable instructions from the memory and executing the instructions to implement the method described in any one of the above embodiments of the present invention.
[0031] According to another aspect of the embodiments of the present invention, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores a computer program, and the computer program is used to execute the method described in any of the above embodiments of the present invention.
[0032] Thus, the database backup encryption interaction method proposed by the present invention, by using the date and time as the backup file name, using the backup file name + password as the basic ciphertext, using a specific algorithm (this paper uses the encryption program myenc of self-developed encapsulation) to perform secondary encryption operation on the basic ciphertext to generate encrypted ciphertext, transmit data through openssl, and use the encrypted ciphertext to package, encrypt and compress the transmitted data stream at the terminal. In addition, the dynamic password encryption of the backup file is realized by the present invention, and the ciphertext of each backup file generated is different, and it is possible to crack the password only if the encryption algorithm mechanism and password are mastered, thereby improving the security of the backup file. In addition, the encryption and compression part of the present invention is completed at the data backup target end, and does not occupy the computing resources of the source database end.
[0033] The technical solution of the present invention is further described in detail below through the accompanying drawings and embodiments. BRIEF DESCRIPTION OF THE DRAWINGS
[0034] The above and other purposes, features and advantages of the present invention will become more apparent by describing the embodiments of the present invention in more detail in conjunction with the accompanying drawings. The accompanying drawings are used to provide a further understanding of the embodiments of the present invention and constitute a part of the specification. Together with the embodiments of the present invention, they are used to explain the present invention and do not constitute a limitation of the present invention. In the accompanying drawings, the same reference numerals generally represent the same components or steps.
[0035] Figure 1 It is a flowchart of a database backup encryption method provided by an exemplary embodiment of the present invention;
[0036] Figure 2 It is a structural diagram of a database backup encryption system provided by an exemplary embodiment of the present invention;
[0037] Figure 3 This is a structure of an electronic device provided by an exemplary embodiment of the present invention. DETAILED DESCRIPTION
[0038] Below, the exemplary embodiments according to the present invention will be described in detail with reference to the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, rather than all the embodiments of the present invention, and it should be understood that the present invention is not limited to the exemplary embodiments described here.
[0039] It should be noted that the relative arrangement of components and steps, the numerical expressions and numerical values set forth in these embodiments do not limit the scope of the present invention unless specifically stated otherwise.
[0040] Those skilled in the art can understand that the terms "first" and "second" in the embodiments of the present invention are only used to distinguish different steps, devices or modules, etc., and neither represent any specific technical meaning nor indicate the necessary logical order between them.
[0041] It should also be understood that, in the embodiments of the present invention, “plurality” may refer to two or more than two, and “at least one” may refer to one, two or more than two.
[0042] It should also be understood that any component, data or structure mentioned in the embodiments of the present invention can generally be understood as one or more, unless explicitly limited or otherwise indicated in the context.
[0043] In addition, the term "and / or" in the present invention is only a description of the association relationship of the associated objects, indicating that there can be three relationships. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. In addition, the character " / " in the present invention generally indicates that the associated objects before and after are in an "or" relationship.
[0044] It should also be understood that the description of the various embodiments of the present invention focuses on the differences between the various embodiments, and the same or similar aspects thereof can be referenced to each other, and for the sake of brevity, they will not be described one by one.
[0045] At the same time, it should be understood that for the convenience of description, the sizes of the various parts shown in the drawings are not drawn according to the actual proportional relationship.
[0046] The following description of at least one exemplary embodiment is merely illustrative in nature and is in no way intended to limit the invention, its application, or uses.
[0047] Technologies, methods, and equipment known to ordinary technicians in the relevant art may not be discussed in detail, but where appropriate, the technologies, methods, and equipment should be considered part of the specification.
[0048] It should be noted that like reference numerals and letters refer to similar items in the following figures, and therefore, once an item is defined in one figure, it need not be further discussed in subsequent figures.
[0049] Embodiments of the present invention can be applied to electronic devices such as terminal devices, computer systems, servers, etc., which can operate with many other general or special computing system environments or configurations. Examples of well-known terminal devices, computing systems, environments and / or configurations suitable for use with electronic devices such as terminal devices, computer systems, servers, etc. include, but are not limited to: personal computer systems, server computer systems, thin clients, thick clients, handheld or laptop devices, microprocessor-based systems, set-top boxes, programmable consumer electronics, network personal computers, small computer systems, large computer systems, and distributed cloud computing technology environments including any of the above systems, etc.
[0050] Electronic devices such as terminal devices, computer systems, servers, etc. can be described in the general context of computer system executable instructions (such as program modules) executed by computer systems. Generally, program modules can include routines, programs, object programs, components, logic, data structures, etc., which perform specific tasks or implement specific abstract data types. Computer systems / servers can be implemented in a distributed cloud computing environment, where tasks are performed by remote processing devices linked through a communication network. In a distributed cloud computing environment, program modules can be located on local or remote computing system storage media including storage devices.
[0051] Exemplary Methods
[0052] Figure 1 FIG. 1 is a flow chart of a database backup encryption method 100 provided by an exemplary embodiment of the present invention. This embodiment can be applied to electronic devices, such as Figure 1 As shown, the following steps are included:
[0053] Step 101: The source database establishes an SSH communication channel with a remote data backup target terminal through Linux.
[0054] Step 102: The source database end transmits the backup file to the data backup target end in the form of a file data stream through an SSH communication channel.
[0055] In step 103, the source database binds the backup file name and password as the basic ciphertext, and uses a specific algorithm to perform a secondary encryption operation on the basic ciphertext to generate an encrypted ciphertext.
[0056] Optionally, the backup file name uses the backup date and time, thereby realizing the dynamic change of the backup file name, and the corresponding execution code is filename=${dates}.tgz.des3.
[0057] Step 104, the data backup target end receives the data stream transmitted by the innobackupex tool from the source database end, and backs up, encrypts and compresses the received data stream by calling pigz and the encryption ciphertext generated by this program.
[0058] Optionally, the data backup target end backs up the transmitted data through the innobackupex tool, including: the data backup target end receives the data stream transmitted by the innobackupex tool from the source database end for full backup; and / or the data backup target end receives the data stream transmitted by the innobackupex tool from the source database end for incremental backup.
[0059] In the embodiment of the present invention, the data is backed up by the innobackupex tool, encrypted using the encrypted ciphertext generated in step 103, and fully compressed by calling pigz. The corresponding execution code is as follows:
[0060] exe_command_full="pigz-p 8-|openssl enc-e-des3-pass pass:${des3_passwd}>$dest_full / ${filename}"
[0061] innobackupex --defaults-file=$db_my_cnf--user=$db_user--password=$db_pwd--port=$db_port--stream=xbstream--extra-lsndir=$lsndir_ful$db_full 2>$db_log / full_xbk.log|ssh-p${ssh_port}root@$dest_host${exe_command_full}
[0062] In the embodiment of the present invention, the data is backed up by specifying the incremental parameters through the innobackupex tool, and the encrypted ciphertext generated in step 103 is used for encryption, and incremental compression is performed by calling pigz. The corresponding execution code is as follows:
[0063] exe_command_inc="pigz-p 8-|openssl enc-e-des3-pass pass:${des3_passwd}>$dest_incremental / $dates.tgz"
[0064] innobackupex --defaults-file=$db_my_cnf--user=$db_user--password=$db_pwd--port=$db_port--stream=xbstream--incremental--extra-lsndir=$lsndir_inc$db_incremental--incremental-basedir=$lsndir_ful 2>$db_log / incremental_xbk.log|ssh-p${ssh_port}root@$dest_host${exe_command_inc}
[0065] Optionally, the data is encrypted using an encrypted ciphertext, including: encrypting the data using a des3 encryption algorithm through an openssl tool.
[0066] Optionally, specify the compression ratio through the configuration file to meet different backup needs.
[0067] Step 105, the data recovery target end uses the backup file name and password as a ciphertext basis through reverse engineering, generates a decrypted ciphertext based on the ciphertext using a specific algorithm, and decrypts the compressed file obtained from the data backup target end through the decrypted ciphertext.
[0068] In the embodiment of the present invention, the encrypted ciphertext is generated by binding the file name and password and performing secondary encryption and obfuscation on them. The corresponding execution code is des3_passwd=`echo "${filename}${pwd}"|myenc`.
[0069] Optionally, the data recovery target end uses the backup file name and password as a ciphertext basis through reverse engineering, generates a decrypted ciphertext based on the ciphertext using a specific algorithm, and decrypts the compressed file obtained from the data backup target end through the decrypted ciphertext, including: creating a new passwd.txt file to add the compressed file name and password; using the backup file name and password as a ciphertext basis, and generating a decrypted ciphertext based on the ciphertext using a specific algorithm; and using the openssl tool to decrypt the compressed file through the generated decrypted ciphertext.
[0070] In an embodiment of the present invention, a new passwd.txt file is created and "file name + password" is added, and then a specific algorithm (this article uses a self-developed and encapsulated encryption program myenc) is used to generate the original encrypted ciphertext: cat passwd.txt|myenc. After that, the openssl tool is used to decrypt the ciphertext obtained above. The corresponding execution code is: openssl enc-ddes3-in backup\2021-10-07-21.tgz.des3-out backup\2021-10-07-21.tgz-pass pass:123456.
[0071] Step 106, automatically generating an expired backup file cleaning program and task through the configuration file, and automatically executing the expired backup file cleaning task at the data backup target end.
[0072] Optionally, the source database end is provided with a configuration file module, and the configuration file module includes customized information, the customized information including: the port of the database instance of the source database end, the database username and password of the source database end, the database configuration file path of the source database end, the data backup target host IP and root user password, the ssh port, the backup mode, the backup file retention period, and the timer time.
[0073] Therefore, the present invention includes six parts: database backup, backup file transmission, backup file compression, backup file encryption, backup file decryption, and backup file deletion. Among them:
[0074] 1) Database backup: includes full backup and incremental backup.
[0075] Full backup: Use the innobackupex tool to perform a full backup of the MySQL database
[0076] Incremental backup: Use the innobackupex tool to perform incremental backup of the MySQL database
[0077] The backup tool is installed with one click through this program. The startup of the backup, the backup type, deployment and related parameters required for the backup are defined through the configuration file of the program: profile. After the installation and deployment of this program, the backup strategy is automatically generated, and the backup task is automatically added to perform the expired backup file cleanup operation regularly.
[0078] 2) Backup file transfer part:
[0079] Use file data stream to establish SSH communication pipeline through Linux for remote transmission. This method has high transmission efficiency, safety and reliability.
[0080] 3) Backup file compression part:
[0081] Use the pigz tool to compress the transmitted data stream, and specify the compression ratio through the configuration file (profile) to meet different backup needs.
[0082] 4) Backup file encryption part:
[0083] Encryption is performed using the openssl tool using the des3 encryption algorithm. The encryption method can use a specific algorithm to generate encrypted ciphertext for the backup file name + password. Des3 uses the ciphertext to encrypt the backup file. Since the file name contains the backup date and time, the entire encryption process is dynamically encrypted.
[0084] 5) Backup file decryption part:
[0085] Through reverse engineering of [4], the backup file name + password is used as the ciphertext basis, and a specific algorithm such as the md5 algorithm is used to generate a decrypted ciphertext, and the compressed file is decrypted using the decrypted ciphertext.
[0086] 6) Backup file deletion part:
[0087] During the deployment process, the expired backup file cleanup program and tasks are automatically generated through the configuration file (profile), and the system automatically executes the expired backup file cleanup task on the data backup target end.
[0088] Therefore, the present invention is easy to operate and runs automatically after successful deployment; it has high security and uses a dynamic encryption algorithm to encrypt backup files. It is necessary to master the encryption method and password to perform reverse decompression operations, both of which are indispensable; it is efficient and controllable, and encryption compression is performed on the backup data backup target end, does not occupy computing resources on the data source database end, and the compression ratio parameters are adjustable to meet different needs; the backup log is clear and reliable, and an email alarm is sent when the backup fails through log analysis.
[0089] Thus, the database backup encryption interaction method proposed by the present invention, by using the date and time as the backup file name, using the backup file name + password as the basic ciphertext, using a specific algorithm (this paper uses the encryption program myenc of self-developed encapsulation) to perform secondary encryption operation on the basic ciphertext to generate encrypted ciphertext, transmit data through openssl, and use the encrypted ciphertext to package, encrypt and compress the transmitted data stream at the terminal. In addition, the dynamic password encryption of the backup file is realized by the present invention, and the ciphertext of each backup file generated is different, and it is possible to crack the password only if the encryption algorithm mechanism and password are mastered, thereby improving the security of the backup file. In addition, the encryption and compression part of the present invention is completed at the data backup target end, and does not occupy the computing resources of the source database end.
[0090] Exemplary Devices
[0091] Figure 2 FIG. 1 is a schematic diagram of the structure of a database backup encryption system provided by an exemplary embodiment of the present invention. Figure 2 As shown, the database backup encryption system 200 proposed in this embodiment includes: a source database end 210, a data backup target end 220 and a data recovery target end 230, wherein
[0092] The source database end 210 is used to establish an SSH communication channel with the remote data backup target end 220 through Linux;
[0093] The source database end 210 is also used to transmit the backup data in a data stream to the data backup target end 220 through the SSH communication channel;
[0094] The source database end 210 is also used to generate encrypted ciphertext by binding the backup file name and password as the basic ciphertext and performing secondary encryption operation on the basic ciphertext using a specific algorithm;
[0095] The data backup target end 220 is used to receive the data stream transmitted by the innobackupex tool from the source database end 210, and to back up, encrypt and compress the received data stream by calling pigz and the encrypted ciphertext generated by this program;
[0096] The data recovery target end 230 is used to use the backup file name and password as a ciphertext basis through reverse engineering, generate a decrypted ciphertext based on the ciphertext using a specific algorithm, and decrypt the compressed file obtained from the data backup target end 220 through the decrypted ciphertext;
[0097] The database backup encryption system is used to automatically generate expired backup file cleaning programs and tasks through configuration files, and automatically execute expired backup file cleaning tasks at the data backup target end 220.
[0098] Optionally, the data is encrypted using an encrypted ciphertext, including: encrypting the data using a des3 encryption algorithm through an openssl tool.
[0099] Optionally, the backup file name uses the backup date and time.
[0100] Optionally, the data backup target end 220 receives the data stream transmitted by the innobackupex tool from the source database end 210, and backs up, encrypts and compresses the received data stream by calling pigz and the encryption ciphertext generated by this program, including:
[0101] The data backup target end 220 receives the data stream transmitted by the innobackupex tool from the source database end 210 to perform a full backup; and / or
[0102] The data backup target end 220 receives the data stream transmitted by the innobackupex tool from the source database end 210 to perform incremental backup.
[0103] Optionally, specify the compression ratio through the configuration file to meet different backup needs.
[0104] Optionally, the data recovery target end 2320 uses the backup file name and password as a ciphertext basis through reverse engineering, generates a decrypted ciphertext based on the ciphertext using a specific algorithm, and decrypts the compressed file obtained from the data backup target end through the decrypted ciphertext, including:
[0105] Create a new passwd.txt file and add the compressed file name and password;
[0106] Use the backup file name and password as the ciphertext basis, and use a specific algorithm to generate decrypted ciphertext on the ciphertext basis;
[0107] Use the openssl tool to decrypt the compressed file using the generated decrypted ciphertext.
[0108] Optionally, the source database end 2210 is provided with a configuration file module, and the configuration file module includes customized information, including: the port of the source database end database instance, the source database end database username and password, the source database end database configuration file path, the data backup target end host IP and root user password, ssh port, backup mode, backup file retention period, and timer time.
[0109] The database backup encryption system 200 of the embodiment of the present invention corresponds to the database backup encryption method 100 of another embodiment of the present invention, and will not be described in detail herein.
[0110] Exemplary Electronic Devices
[0111] Figure 3 The electronic device provided by an exemplary embodiment of the present invention may be any one or both of the first device and the second device, or a stand-alone device independent of them, and the stand-alone device may communicate with the first device and the second device to receive the collected input signals from them. Figure 3 FIG. 1 is a block diagram of an electronic device according to an embodiment of the present disclosure. Figure 3 As shown, the electronic device 30 includes one or more processors 31 and a memory 32 .
[0112] The processor 31 may be a central processing unit (CPU) or other forms of processing units having data processing capabilities and / or instruction execution capabilities, and may control other components in the electronic device to perform desired functions.
[0113] The memory 32 may include one or more computer program products, which may include various forms of computer-readable storage media, such as volatile memory and / or non-volatile memory. The volatile memory may include, for example, random access memory (RAM) and / or cache memory (cache), etc. The non-volatile memory may include, for example, read-only memory (ROM), hard disk, flash memory, etc. One or more computer program instructions may be stored on the computer-readable storage medium, and the processor 31 may run the program instructions to implement the method for information mining of historical change records and / or other desired functions of the software program of each embodiment of the present disclosure described above. In one example, the electronic device may also include: an input device 33 and an output device 34, which are interconnected via a bus system and / or other forms of connection mechanisms (not shown).
[0114] In addition, the input device 33 may also include, for example, a keyboard, a mouse, and the like.
[0115] The output device 34 can output various information to the outside. The output device 34 can include, for example, a display, a speaker, a printer, a communication network and a remote output device connected thereto.
[0116] Of course, to simplify, Figure 3 Only some of the components related to the present disclosure in the electronic device are shown, and components such as a bus, an input / output interface, etc. are omitted. In addition, according to specific application situations, the electronic device may further include any other appropriate components.
[0117] Exemplary computer program products and computer-readable storage media
[0118] In addition to the above-mentioned methods and devices, an embodiment of the present disclosure may also be a computer program product, which includes computer program instructions, which, when executed by a processor, enable the processor to execute the steps of the method for performing information mining on historical change records according to various embodiments of the present disclosure described in the above "Exemplary Method" section of this specification.
[0119] The computer program product may be written in any combination of one or more programming languages to write program code for performing the operations of the disclosed embodiments, including object-oriented programming languages such as Java, C++, etc., and conventional procedural programming languages such as "C" or similar programming languages. The program code may be executed entirely on the user computing device, partially on the user device, as a separate software package, partially on the user computing device and partially on a remote computing device, or entirely on a remote computing device or server.
[0120] In addition, an embodiment of the present disclosure may also be a computer-readable storage medium having computer program instructions stored thereon, which, when executed by a processor, causes the processor to execute the steps of the method for performing information mining on historical change records according to various embodiments of the present disclosure described in the above “Exemplary Method” section of this specification.
[0121] The computer readable storage medium can adopt any combination of one or more readable media. The readable medium can be a readable signal medium or a readable storage medium. The readable storage medium can include, for example, but is not limited to, a system, device or device of electricity, magnetism, light, electromagnetic, infrared, or semiconductor, or any combination of the above. More specific examples (non-exhaustive list) of readable storage media include: an electrical connection with one or more wires, a portable disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above.
[0122] The basic principles of the present disclosure are described above in conjunction with specific embodiments. However, it should be noted that the advantages, strengths, effects, etc. mentioned in the present disclosure are only examples and not limitations, and it cannot be considered that these advantages, strengths, effects, etc. are required by each embodiment of the present disclosure. In addition, the specific details disclosed above are only for the purpose of illustration and ease of understanding, and are not limitations. The above details do not limit the present disclosure to the necessity of adopting the above specific details to be implemented.
[0123] Each embodiment in this specification is described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the embodiments can be referred to each other. For the system embodiment, since it basically corresponds to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0124] The block diagrams of the devices, apparatuses, equipment, and systems involved in this disclosure are only illustrative examples and are not intended to require or imply that they must be connected, arranged, and configured in the manner shown in the block diagrams. As will be appreciated by those skilled in the art, these devices, apparatuses, equipment, and systems can be connected, arranged, and configured in any manner. Words such as "including," "comprising," "having," and the like are open words, referring to "including but not limited to," and can be used interchangeably therewith. The words "or" and "and" used herein refer to the words "and / or," and can be used interchangeably therewith, unless the context clearly indicates otherwise. The word "such as" used herein refers to the phrase "such as but not limited to," and can be used interchangeably therewith.
[0125] The method and apparatus of the present disclosure may be implemented in many ways. For example, the method and apparatus of the present disclosure may be implemented by software, hardware, firmware, or any combination of software, hardware, and firmware. The above order of steps for the method is for illustration only, and the steps of the method of the present disclosure are not limited to the order specifically described above, unless otherwise specifically stated. In addition, in some embodiments, the present disclosure may also be implemented as a program recorded in a recording medium, which includes machine-readable instructions for implementing the method according to the present disclosure. Therefore, the present disclosure also covers a recording medium storing a program for executing the method according to the present disclosure.
[0126] It should also be noted that in the system, device and method of the present disclosure, each component or each step can be decomposed and / or recombined. These decompositions and / or recombinations should be regarded as equivalent schemes of the present disclosure. The above description of the disclosed aspects is provided to enable any technician in the field to make or use the present disclosure. Various modifications to these aspects are very obvious to those skilled in the art, and the general principles defined herein can be applied to other aspects without departing from the scope of the present disclosure. Therefore, the present disclosure is not intended to be limited to the aspects shown here, but to the widest scope consistent with the principles and novel features disclosed herein.
[0127] The above description has been given for the purpose of illustration and description. In addition, this description is not intended to limit the embodiments of the present disclosure to the forms disclosed herein. Although multiple example aspects and embodiments have been discussed above, those skilled in the art will recognize certain variations, modifications, changes, additions and sub-combinations thereof.
Claims
1. A database backup encryption method, characterized in that: include: The source database establishes an SSH communication channel with the remote data backup target through Linux; The source database transfers the backup file to the data backup target end in the form of file data stream through the SSH communication pipeline; The source database binds the backup file name and password as the basic ciphertext, and uses a specific algorithm to perform secondary encryption on the basic ciphertext to generate encrypted ciphertext; The data backup target receives the data stream transmitted by the innobackupex tool from the source database, and backs up, encrypts and compresses the received data stream by calling pigz and the encrypted ciphertext generated by this program; The data recovery target uses the backup file name and password as the ciphertext basis through reverse engineering, generates decrypted ciphertext based on the ciphertext using a specific algorithm, and decrypts the compressed file obtained from the data backup target through the decrypted ciphertext; Automatically generate expired backup file cleanup programs and tasks through configuration files, and automatically execute expired backup file cleanup tasks on the data backup target end.
2. The method according to claim 1, characterized in that Use dynamic encryption ciphertext to encrypt data, including: using the backup date and time as part of the ciphertext, confusing a specific encryption algorithm to generate encrypted ciphertext, and using the des3 encryption algorithm through the openssl tool to encrypt the backup data using encrypted ciphertext.
3. The method according to claim 1, characterized in that The backup file name uses the backup date and time.
4. The method according to claim 1, characterized in that: The data backup target receives the data stream transmitted by the innobackupex tool from the source database, and backs up, encrypts, and compresses the received data stream by calling pigz and the encrypted ciphertext generated by this program, including: The data backup target receives the data stream transmitted by the innobackupex tool from the source database to perform a full backup; and / or The data backup target receives the data stream transmitted by the innobackupex tool from the source database to perform incremental backup.
5. The method according to claim 4, characterized in that Specify the compression ratio through the configuration file to meet different backup needs.
6. The method according to claim 5, characterized in that The data recovery target uses the backup file name and password as the ciphertext basis through reverse engineering, generates decrypted ciphertext based on the ciphertext using a specific algorithm, and decrypts the compressed file obtained from the data backup target through the decrypted ciphertext, including: Create a new passwd.txt file and add the compressed file name and password; Use the backup file name and password as the ciphertext basis, and use a specific algorithm to generate decrypted ciphertext on the ciphertext basis; Decrypt the compressed file using the generated decrypted ciphertext.
7. The method according to claim 1, characterized in that The source database is provided with a configuration file module, and the configuration file module includes customized information, including: the port of the database instance of the source database, the database username and password of the source database, the database configuration file path of the source database, the data backup target host IP and root user password, the SSH port, the backup mode, the backup file retention period, and the timer time.
8. A database backup encryption system, characterized in that: It includes the source database end, the data backup target end and the data recovery target end. The source database is used to establish an SSH communication channel with the remote data backup target through Linux; The source database end is also used to transmit the backup data to the data backup target end in the form of data stream through the SSH communication pipeline; The source database is also used to bind the backup file name and password as the basic ciphertext, and use a specific algorithm to perform secondary encryption on the basic ciphertext to generate encrypted ciphertext; The data backup target receives the data stream transmitted by the source database, including the backup data, backup file name and encrypted ciphertext; The data backup target is also used to call pigz to encrypt and compress the source data by using the data, file name and encrypted ciphertext transmitted from the source database. The data recovery target uses the backup file name and password as the ciphertext basis through reverse engineering, generates decrypted ciphertext based on the ciphertext using a specific algorithm, and decrypts the compressed file obtained from the data backup target through the decrypted ciphertext; The database backup encryption system is used to automatically generate expired backup file cleanup programs and tasks through configuration files, and automatically execute expired backup file cleanup tasks on the data backup target end.
9. An electronic device, characterized in that: The electronic device comprises: a processor and a memory; wherein, The memory is used to store the processor executable instructions; The processor is used to read the executable instructions from the memory and execute the instructions to implement the method according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and the computer program is used to execute the method according to any one of claims 1 to 7.
