Software authorization method and device based on docker virtual machine
By using the plug-in library and authorization system to bind the hardware resource serial number in the docker virtual machine, the problems of virtual machine replication and hardware replacement are solved, effective control and authorization management of the virtual machine are realized, and labor costs and operational complexity are reduced. .
Patent Information
- Application Number
- CN202411147073.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-21
- Publication Date
- 2024-11-08
AI Technical Summary
In docker virtual machines, it is impossible to effectively control customers' replication operations on virtual machines, resulting in company losses and increased labor costs. The existing technology cannot limit the replication of virtual machines and hardware equipment replacement.
By deploying the plug-in library on the host, generating authorization requests and encrypting and saving the public key, issuing and signing authorization files using the authorization system, binding the hardware resource serial number, detecting changes in the virtual machine serial number to control copying and replacement, and realizing authorization and statistics Function.
Effectively control the copying of virtual machines and hardware device replacement, reduce labor costs, simplify authorization operations, and meet the authorization and use control needs of virtual machines.
Smart Images

Figure CN118916868A_ABST
Abstract
Description
Technical Field
[0001] The invention discloses a software authorization method and device based on a Docker virtual machine, and relates to the technical field of cloud computing. Background Art
[0002] When deploying software services in a docker virtual machine and providing it to customers, if you cannot control the customers from copying the docker virtual machine, it will cause losses to the company. In addition, authorization of a single virtual machine is time-consuming and may lead to misoperation, resulting in increased labor costs.
[0003] Ordinary cloud machine software authorization is bound to hardware device resources such as CPU, disk, and password card, and is unique on a single device. However, the information obtained on the cloud machine virtual machine is the same, which means that the authorization can be used normally after the virtual machine is copied, and the virtual machine copy operation cannot be restricted. Summary of the invention
[0004] In view of the problems of the prior art, the present invention provides a software authorization method and device based on a docker virtual machine, and the technical solution adopted is: In a first aspect, a software authorization method based on a Docker virtual machine is provided, the method comprising: S1, deploying a plug-in library according to the host machine, and providing functions of generating authorization requests and importing authorization through the plug-in library; S2, encrypting and saving the authorization request with a public key according to the preset system public key of the plug-in library; S3, according to the authorization document, is authorized by the authorization system and issued to the plug-in service; S4, according to the plug-in library and its configuration file, calling the plug-in library through the virtual machine software service to map it into the virtual machine; S5, issuing authorization through the plug-in library according to the authorization document; S6, according to the decrypted data of the authorization file, the SM2 signature is performed through the authorization system, and the corresponding authorization information is written and processed.
[0005] In some implementations, the authorization request includes hardware information, CPU information, and an authorization quantity, and the hardware device is bound according to the authorization request.
[0006] In some implementations, the S5 specifically includes: S51, starting the virtual machine software and performing an authorization check; S521: No authorization, call the plug-in library to issue authorization; S522, authorization is successful, and the service is provided; S53, after the authorization is successful, the virtual machine is bound according to the virtual machine ID in the issuance information, and the issuance authorization quantity of the plug-in library is reduced by one.
[0007] In a second aspect, an embodiment of the present invention provides a software authorization device based on a docker virtual machine, the device comprising: The plug-in module also has a plug-in library deployed according to the host machine, and provides functions of generating authorization requests and importing authorization through the plug-in library; An encryption module, used to encrypt and save the authorization request according to the preset system public key of the plug-in library; The authorization module is used to authorize and issue to the plug-in service through the authorization system according to the authorization file; A mapping module is used to map the plug-in library to the inside of the virtual machine through the virtual machine software service according to the plug-in library and its configuration file; The issuing module is used to issue authorization through the plug-in library according to the authorization file; The writing module is used to perform SM2 signing through the authorization system according to the decrypted data of the authorization file, and write the corresponding authorization information.
[0008] In some implementations, the authorization request includes hardware information, CPU information, and an authorization quantity, and the hardware device is bound according to the authorization request.
[0009] In some implementations, the issuing module specifically includes: A checking unit, used to start the virtual machine software and perform an authorization check; The first issuing unit is used to call the plug-in library to issue authorization if there is no authorization; The second issuing unit is used for successful authorization and business services; The binding unit is used to bind the virtual machine according to the virtual machine ID in the issuance information after the authorization is successful, and to reduce the issuance authorization quantity of the plug-in library by one.
[0010] In a third aspect, an embodiment of the present invention provides an electronic device, comprising a memory and a processor, wherein the memory is used to store one or more computer instructions, wherein when the one or more computer instructions are executed by the processor, the method described in the first aspect above is implemented.
[0011] In a fourth aspect, an embodiment of the present invention provides a computer storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, it is used to implement the method described in the first aspect.
[0012] One or more embodiments of the present invention can bring at least the following beneficial effects: The method of the present invention is to add the serial number of docker on the basis of binding hardware resources. In the cloud machine, the serial number of docker is unique. When the virtual machine copies or replaces the hardware, the serial number change of the virtual machine will be detected, the authorization file will become invalid, and the virtual machine will stop providing services. Therefore, the copy operation between virtual machines and the problem of hardware device replacement can be well controlled.
[0013] The authorization system of the method of the present invention is used to issue authorizations and count the number of authorizations, and track the use of authorizations. The host authorization plug-in provides virtual machine authorization, and the virtual machine authorization controls the use of services. The overall operation only needs to authorize the host once, and the remaining operations can be automatically processed by the program. Through the operation of host authorization, virtual machine authorization and authorization system, docker virtual machine authorization can meet the purpose of simple authorization operation and control of virtual machine use. BRIEF DESCRIPTION OF THE DRAWINGS
[0014] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.
[0015] Figure 1 It is an implementation flow chart of a software authorization method based on a Docker virtual machine provided in an embodiment of the present invention. DETAILED DESCRIPTION
[0016] The technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all the embodiments. The components of the embodiments of the present invention generally described and shown in the drawings here can be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of the present invention provided in the drawings is not intended to limit the scope of the claimed invention, but merely represents the selected embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without making creative work belong to the scope of protection of the present invention.
[0017] Embodiment 1: Figure 1 A flowchart of a software authorization method based on a Docker virtual machine is shown. Figure 1 As shown, the software authorization method based on the Docker virtual machine provided in this embodiment includes: S1, deploying a plug-in library according to the host machine, and providing functions of generating authorization requests and importing authorization through the plug-in library; S2, encrypting and saving the authorization request with a public key according to the preset system public key of the plug-in library; S3, according to the authorization document, is authorized by the authorization system and issued to the plug-in service; S4, according to the plug-in library and its configuration file, calling the plug-in library through the virtual machine software service to map it into the virtual machine; S5, issuing authorization through the plug-in library according to the authorization document; S6, according to the decrypted data of the authorization file, the SM2 signature is performed through the authorization system, and the corresponding authorization information is written and processed.
[0018] Furthermore, the authorization request includes hardware information, CPU information and authorization quantity, and the hardware device is bound according to the authorization request.
[0019] Furthermore, the S5 specifically includes: S51, starting the virtual machine software and performing an authorization check; S521: No authorization, call the plug-in library to issue authorization; S522, authorization is successful, and the service is provided; S53, after the authorization is successful, the virtual machine is bound according to the virtual machine ID in the issuance information, and the issuance authorization quantity of the plug-in library is reduced by one.
[0020] First, authorize the host. According to S1, deploy the plug-in library on the host. The plug-in library provides the functions of generating authorization requests and importing authorizations. The authorization request contains hardware information, CPU information, and the number of authorizations, which can be bound to this hardware device. Next, according to S2, the company's authorization system public key is preset inside the plug-in library. The authorization request file is encrypted and saved with the public key. Next, according to S3, submit the authorization file to the authorization system. After the authorization system issues the authorization file, it is imported into the plug-in service, and the authorization is successful.
[0021] Then, the virtual machine is authorized. According to S4, the plug-in library maps the library and the corresponding configuration files to the inside of the virtual machine through mapping, and the virtual machine software service directly calls the plug-in library. According to S4, after the virtual machine software is started, first check whether it has been authorized. If the authorization is successful, it is used directly. If not, call the plug-in library to issue authorization. The issuance information contains the virtual machine ID, which can be bound to this virtual machine; after the virtual machine authorization application is successful, the number of authorizations that the plug-in can issue is reduced by one; Finally, the authorization system is constructed. According to S6, the authorization system decrypts the imported authorization file, performs SM2 signature based on the decrypted data, and writes the corresponding authorization information (issuance time, authorization time, authorization quantity, etc.) into the authorization file.
[0022] Embodiment 2: A software authorization device based on a docker virtual machine, the device comprising: The plug-in module also has a plug-in library deployed according to the host machine, and provides functions of generating authorization requests and importing authorization through the plug-in library; An encryption module, used to encrypt and save the authorization request according to the preset system public key of the plug-in library; The authorization module is used to authorize and issue to the plug-in service through the authorization system according to the authorization file; A mapping module is used to map the plug-in library to the inside of the virtual machine through the virtual machine software service according to the plug-in library and its configuration file; The issuing module is used to issue authorization through the plug-in library according to the authorization file; The writing module is used to perform SM2 signing through the authorization system according to the decrypted data of the authorization file, and write the corresponding authorization information.
[0023] In some implementations, the authorization request includes hardware information, CPU information, and an authorization quantity, and the hardware device is bound according to the authorization request.
[0024] In some implementations, the issuing module specifically includes: A checking unit, used to start the virtual machine software and perform an authorization check; The first issuing unit is used to call the plug-in library to issue authorization if there is no authorization; The second issuing unit is used for successful authorization and business services; The binding unit is used to bind the virtual machine according to the virtual machine ID in the issuance information after the authorization is successful, and to reduce the issuance authorization quantity of the plug-in library by one.
[0025] Embodiment three: This embodiment further provides an electronic device, including a memory and a processor, wherein the memory is used to store one or more computer instructions, wherein the one or more computer instructions implement the method of embodiment 1 when executed by the processor; In practical applications, the processor can be an application specific integrated circuit (ASIC), a digital signal processor (DSP), a digital signal processing device (DSPD), a programmable logic device (PLD), a field programmable gate array (FPGA), a controller, a microcontroller unit (MCU), a microprocessor or other electronic components to execute the methods in the above embodiments.
[0026] The method implemented in this embodiment includes: S1, deploying a plug-in library according to the host machine, and providing functions of generating authorization requests and importing authorization through the plug-in library; S2, encrypting and saving the authorization request with a public key according to the preset system public key of the plug-in library; S3, according to the authorization document, is authorized by the authorization system and issued to the plug-in service; S4, according to the plug-in library and its configuration file, calling the plug-in library through the virtual machine software service to map it into the virtual machine; S5, issuing authorization through the plug-in library according to the authorization document; S6, according to the decrypted data of the authorization file, the SM2 signature is performed through the authorization system, and the corresponding authorization information is written and processed.
[0027] Furthermore, the authorization request includes hardware information, CPU information and authorization quantity, and the hardware device is bound according to the authorization request.
[0028] Furthermore, the S5 specifically includes: S51, starting the virtual machine software and performing an authorization check; S521: No authorization, call the plug-in library to issue authorization; S522, authorization is successful, and the service is provided; S53, after the authorization is successful, the virtual machine is bound according to the virtual machine ID in the issuance information, and the issuance authorization quantity of the plug-in library is reduced by one.
[0029] First, authorize the host. According to S1, deploy the plug-in library on the host. The plug-in library provides the functions of generating authorization requests and importing authorizations. The authorization request contains hardware information, CPU information, and the number of authorizations, which can be bound to this hardware device. Next, according to S2, the company's authorization system public key is preset inside the plug-in library. The authorization request file is encrypted and saved with the public key. Next, according to S3, submit the authorization file to the authorization system. After the authorization system issues the authorization file, it is imported into the plug-in service, and the authorization is successful.
[0030] Then, the virtual machine is authorized. According to S4, the plug-in library maps the library and the corresponding configuration files to the inside of the virtual machine through mapping, and the virtual machine software service directly calls the plug-in library. According to S4, after the virtual machine software is started, first check whether it has been authorized. If the authorization is successful, it is used directly. If not, call the plug-in library to issue authorization. The issuance information contains the virtual machine ID, which can be bound to this virtual machine; after the virtual machine authorization application is successful, the number of authorizations that the plug-in can issue is reduced by one; Finally, the authorization system is constructed. According to S6, the authorization system decrypts the imported authorization file, performs SM2 signature based on the decrypted data, and writes the corresponding authorization information (issuance time, authorization time, authorization quantity, etc.) into the authorization file.
[0031] Embodiment 4: This embodiment further provides a computer storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by one or more processors, the method of the first embodiment is implemented; Among them, the computer-readable storage medium can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic storage, flash memory, magnetic disk or optical disk.
[0032] The method implemented in this embodiment includes: S1, deploying a plug-in library according to the host machine, and providing functions of generating authorization requests and importing authorization through the plug-in library; S2, encrypting and saving the authorization request with a public key according to the preset system public key of the plug-in library; S3, according to the authorization document, is authorized by the authorization system and issued to the plug-in service; S4, according to the plug-in library and its configuration file, calling the plug-in library through the virtual machine software service to map it into the virtual machine; S5, issuing authorization through the plug-in library according to the authorization document; S6, according to the decrypted data of the authorization file, the SM2 signature is performed through the authorization system, and the corresponding authorization information is written and processed.
[0033] Furthermore, the authorization request includes hardware information, CPU information and authorization quantity, and the hardware device is bound according to the authorization request.
[0034] Furthermore, the S5 specifically includes: S51, starting the virtual machine software and performing an authorization check; S521: No authorization, call the plug-in library to issue authorization; S522, authorization is successful, and the service is provided; S53, after the authorization is successful, the virtual machine is bound according to the virtual machine ID in the issuance information, and the issuance authorization quantity of the plug-in library is reduced by one.
[0035] First, authorize the host. According to S1, deploy the plug-in library on the host. The plug-in library provides the functions of generating authorization requests and importing authorizations. The authorization request contains hardware information, CPU information, and the number of authorizations, which can be bound to this hardware device. Next, according to S2, the company's authorization system public key is preset inside the plug-in library. The authorization request file is encrypted and saved with the public key. Next, according to S3, submit the authorization file to the authorization system. After the authorization system issues the authorization file, it is imported into the plug-in service, and the authorization is successful.
[0036] Then, the virtual machine is authorized. According to S4, the plug-in library maps the library and the corresponding configuration files to the inside of the virtual machine through mapping, and the virtual machine software service directly calls the plug-in library. According to S4, after the virtual machine software is started, first check whether it has been authorized. If the authorization is successful, it is used directly. If not, call the plug-in library to issue authorization. The issuance information contains the virtual machine ID, which can be bound to this virtual machine; after the virtual machine authorization application is successful, the number of authorizations that the plug-in can issue is reduced by one; Finally, the authorization system is constructed. According to S6, the authorization system decrypts the imported authorization file, performs SM2 signature based on the decrypted data, and writes the corresponding authorization information (issuance time, authorization time, authorization quantity, etc.) into the authorization file.
[0037] In the several embodiments provided in the embodiments of the present invention, it should be understood that the disclosed system and method can also be implemented in other ways. The system and method embodiments described above are merely illustrative.
[0038] It should be noted that, in this article, the terms "first", "second", etc. in the specification and claims of this application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. The terms "comprise", "include" 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, an element defined by the sentence "comprises a..." does not exclude the presence of other identical elements in the process, method, article or device including the element.
[0039] Although the embodiments disclosed in the present invention are as above, the above contents are only embodiments adopted for facilitating the understanding of the present invention and are not intended to limit the present invention. Any technician in the technical field to which the present invention belongs can make any modifications and changes in the form and details of the implementation without departing from the spirit and scope disclosed in the present invention, but the patent protection scope of the present invention shall still be subject to the scope defined in the attached claims.
Claims
1. A software authorization method based on Docker virtual machine, characterized in that: The method comprises: S1, deploying a plug-in library according to the host machine, and providing functions of generating authorization requests and importing authorization through the plug-in library; S2, encrypting and saving the authorization request with a public key according to the preset system public key of the plug-in library; S3, according to the authorization document, is authorized by the authorization system and issued to the plug-in service; S4, according to the plug-in library and its configuration file, calling the plug-in library through the virtual machine software service to map it into the virtual machine; S5, issuing authorization through the plug-in library according to the authorization document; S6, according to the decrypted data of the authorization file, the SM2 signature is performed through the authorization system, and the corresponding authorization information is written and processed.
2. The method according to claim 1, characterized in that The authorization request includes hardware information, CPU information and authorization quantity, and the hardware device is bound according to the authorization request.
3. The method according to claim 2, characterized in that The S5 specifically includes: S51, starting the virtual machine software and performing an authorization check; S521: No authorization, call the plug-in library to issue authorization; S522, authorization is successful, and the service is provided; S53, after the authorization is successful, the virtual machine is bound according to the virtual machine ID in the issuance information, and the issuance authorization quantity of the plug-in library is reduced by one.
4. A software authorization device based on a docker virtual machine, characterized in that: The device comprises: The plug-in module also has a plug-in library deployed according to the host machine, and provides functions of generating authorization requests and importing authorization through the plug-in library; An encryption module, used to encrypt and save the authorization request according to the preset system public key of the plug-in library; The authorization module is used to authorize and issue to the plug-in service through the authorization system according to the authorization file; A mapping module is used to map the plug-in library to the inside of the virtual machine through the virtual machine software service based on the plug-in library and its configuration file; The issuing module is used to issue authorization through the plug-in library according to the authorization file; The writing module is used to perform SM2 signing through the authorization system according to the decrypted data of the authorization file, and write the corresponding authorization information.
5. The device according to claim 4, characterized in that The authorization request includes hardware information, CPU information and authorization quantity, and the hardware device is bound according to the authorization request.
6. The device according to claim 5, characterized in that The issuing module specifically includes: A checking unit, used to start the virtual machine software and perform an authorization check; The first issuing unit is used to call the plug-in library to issue authorization if there is no authorization; The second issuing unit is used for successful authorization and business services; The binding unit is used to bind the virtual machine according to the virtual machine ID in the issuance information after the authorization is successful, and to reduce the issuance authorization quantity of the plug-in library by one.
7. An electronic device, characterized in that: The method comprises a memory and a processor, wherein the memory is used to store one or more computer instructions, wherein the one or more computer instructions, when executed by the processor, implement the method as described in any one of claims 1 to 3.
8. 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, it is used to implement the method as described in any one of claims 1 to 3.
