Intranet container offline service authorization tamper-proofing control method, system, device and medium
By adopting an anti-tampering control method for offline service authorization in intranet containers based on CPU-TSC characteristics, hardware fingerprints are generated and authorization license files are encrypted. Combined with a heartbeat signature verification mechanism, the security and reliability issues of traditional authorization services in intranet containerized environments are solved, making it suitable for enterprise intranet deployment scenarios without external networks.
Patent Information
- Application Number
- CN202611017745.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-07-09
- Publication Date
- 2026-11-10
AI Technical Summary
In containerized intranet environments without external networks, traditional authorization services face challenges such as difficulty in reading host hardware information, the need for network connectivity for authorization, and susceptibility to tampering and bypassing, resulting in insufficient security, reliability, and feasibility of custom authentication.
An intranet container offline service authorization anti-tampering control method based on CPU-TSC features is adopted. It generates an RSA-2048 asymmetric key pair and a self-signed public key certificate, combines the SHA-256 algorithm to generate a hardware fingerprint, encrypts it using the AES-128 algorithm, constructs an authorization license file, realizes container image service, and performs multiple verifications through a heartbeat signature verification mechanism.
It achieves strong binding of host hardware information in an intranet environment, prevents illegal copying of license files, builds an offline trusted time-testing mechanism, enhances the security and reliability of authorization, adapts to K8S clustered deployment scenarios, and improves the anti-cracking and anti-tampering capabilities of the authorization system.
Smart Images

Figure CN123074697A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of computer software licensing and information security technology, specifically to a method, system, device, and medium for preventing tampering of offline service licensing for intranet containers. Background Technology
[0002] With the rapid expansion of cloud services and the gradual improvement of enterprise informatization, the number of intranet business systems is increasing and their architecture is becoming more complex. The traditional virtual machine-based deployment model can no longer meet the needs of enterprises. Against this backdrop, private cloud + containerization deployment has become the mainstream architecture for enterprise intranet services. However, due to the various characteristics of containerized services, traditional authorized services face a series of problems: ① Host hardware information reading problem: Traditional authorization usually binds directly to the host IP or related hardware information, but containers are actually sandboxed and isolated, so they cannot obtain the host hardware information (by default, they cannot obtain it). In addition, Pods will be scheduled, drifted, and rebuilt on different nodes, and the MAC address will change every time the container is restarted.
[0003] ② Intranet environment cannot access the external network: Due to security concerns, enterprises generally do not allow servers to communicate with the external network, which has a significant impact on traditional authorizations that require online activation or online signature verification.
[0004] ③ Anti-tampering issues: Users can bypass the traditional authorization time validity vulnerability by deleting log files and modifying server time.
[0005] Therefore, how to implement tamper-proof software license authentication services in a containerized intranet environment without an external network, overcome the shortcomings of difficult-to-read host hardware information, network-required authorization, and easy tampering and bypassing, improve the security, reliability and feasibility of custom authentication, and ensure the benefits of enterprise software licensing are currently urgent technical problems to be solved. Summary of the Invention
[0006] The technical objective of this invention is to provide a method, system, device, and medium for preventing tampering of offline service authorization for intranet containers. This addresses the challenge of implementing tamper-proof software license authentication services in an intranet containerized environment without an external network. It overcomes the shortcomings of difficulty in reading host hardware information, the need for network access for authorization, and the ease with which such information can be tampered with and bypassed. The invention also improves the security, reliability, and feasibility of custom authentication, thereby ensuring the benefits of enterprise software licensing.
[0007] The technical objective of this invention is achieved as follows: a method for preventing tampering of authorization for offline services in intranet containers based on CPU-TSC characteristics, the method being as follows: Construct custom key information: Generate RSA-2048 asymmetric key pairs using the KeyStore tool, construct a PKCS12 format keystore, bind the asymmetric key pairs to a self-signed public key certificate, and store them persistently. Collect host machine characteristics and construct license file: Collect host machine CPU-TSC hardware characteristics and CPU serial number, generate a unique hardware fingerprint through SHA-256 algorithm, combine with custom license validity period, sign with RSA-2048 algorithm and encrypt with AES-128 algorithm to generate license file bound to host machine hardware; Building container image services: Based on license files, pre-built public key stores, and enterprise infrastructure services, we build secure and controllable container image services. Signature verification: Start the container image, load the pre-built components in the image, execute the license activation and signature verification process, generate encrypted signature records and store them in the K8S Etcd distributed storage or disk; Heartbeat verification: Periodically repeats the verification process and calculates the validity of the license document, verifying the legality of the license document through multiple rules.
[0008] As a preferred option, the custom key information is constructed as follows: Initialize the RSA algorithm key pair generator and set the key length to 2048 bits to generate an RSA-2048 asymmetric key pair containing a public key and a private key; Construct a public key certificate using the X.509 standard, embed the generated public key into the public key certificate, and fill in the metadata information of the public key certificate, such as the subject information (CN, OU, etc.), validity period, and serial number. Sign the public key certificate using the private key to construct a self-signed public key certificate. Create a PKCS12 format keystore instance and complete its initialization. Bind the private key to the self-signed public key certificate, and store the asymmetric key pair and the self-signed public key certificate chain into the keystore by specifying a unique alias and a password protected by the private key. Set an overall protection password for the keystore and persistently store the PKCS12 format keystore as a local file to realize the generation of RSA asymmetric key pairs, the construction of public key certificates, and the construction of PKCS12 format keystores. The RSA-2048 asymmetric key pair is generated using KeyStore or other tools and saved to the key store. The key store is used for the digital signing, verification, and encryption / decryption of the verification record of the subsequent license file. The public key will be extracted and pre-installed into the container image built later for signature verification in the license verification process.
[0009] More optimally, the host machine characteristics are collected and the license file is constructed as follows: Read the host machine's / proc / cpuinfo file, collect the host machine's CPU-TSC hardware characteristic parameters, and combine them with hardware information that is not easily tampered with, such as the CPU serial number, to generate a hardware fingerprint that is unique to the current host machine using the SHA-256 algorithm; As required for authorization, the activation time, deactivation time, and authorization validity period can be manually configured or configured through keystore association. The hardware fingerprint, custom activation time, deactivation time, and authorization validity period information are then combined to form combined data. The combined data is digitally signed using the asymmetric encryption algorithm RSA-2048 to obtain the signed combined data. The combined data and signature information after signing are encrypted and encapsulated using the symmetric encryption algorithm AES-128 to generate a license file that is bound to the host hardware, has a fixed validity period, and is tamper-proof.
[0010] Even better, in the process of providing a secure and controllable container image service, the license file, the pre-built public key library file, the enterprise basic service related components, and the runtime dependency packages are uniformly integrated and encapsulated into the image file system to form a standardized image service containing basic authorization information and a basic environment for public key verification. The pre-installed public key store includes KeyStore Explorer, p11-kit, and jdk.
[0011] Ideally, the verification process should be as follows: Start the container image. During container instantiation, load the pre-built enterprise basic service-related components and runtime dependencies, license file, and pre-built public key store within the image. The activation of the license file is as follows: First, the enterprise basic service components initiate the activation process through an internally integrated activation sub-service. This involves mounting the host machine's ` / proc` directory via a container, reading the ` / proc / cpuinfo` file, and extracting CPU-TSC hardware characteristics (such as TSC frequency, multi-core synchronization, and other timing features). Simultaneously, auxiliary hardware information such as the server's MAC address, CPU serial number, motherboard serial number, and IP address is collected. This entire data collection process is completed offline, without relying on the external network. Then, SHA256 is performed on the CPU-TSC hardware characteristics and auxiliary hardware information. The system performs a hash operation to generate the hardware fingerprint of the current host machine, and then performs a consistency check against the hardware fingerprint pre-stored in the license file. Next, based on the CPU-TSC hardware characteristics, it obtains the baseline TSC count value at the activation time and the current TSC count value, combines them with the activation baseline time, and completes the validity check. If the hardware fingerprint of the current host machine matches the hardware fingerprint pre-stored in the license file and the validity check is valid, an activation success identifier is generated. If the hardware fingerprint of the current host machine does not match the hardware fingerprint pre-stored in the license file or the validity check is invalid, the activation process is terminated and the reason for activation failure is marked (e.g., fingerprint mismatch, license expired). License verification: First, extract the digital signature generated by the licensor based on the RSA-2048 private key and the original authorization data including the validity period of the hardware fingerprint machine authorization from the license file. Then, call the RSA-2048 public key in the pre-built public key store in the image to decrypt and verify the extracted digital signature to confirm that the license file has not been tampered with and its source is legitimate. If the verification passes, the license file is confirmed to be legitimate and valid. If the verification fails (e.g., signature tampering, public key mismatch), the license file is determined to be invalid and the exception handling mechanism (service stoppage) is triggered. Verification record encryption and storage: First, integrate the verification result (success / failure), activation status, current host TSC feature hash value, trusted timestamp, and verification failure reason (if any) to generate a structured verification record. Then, encrypt the structured verification record using the AES-128 algorithm. Next, write the encrypted verification record to the K8S Etcd distributed storage, along with the metadata of the associated node identifier and container ID, to ensure that the record is traceable and not lost.
[0012] More preferably, based on the CPU-TSC hardware characteristics, the baseline TSC count value at the activation time and the current TSC count value are obtained, and the activation baseline time is combined to complete the validity verification as follows: Based on the host CPU's TSC hardware characteristics, obtain the baseline TSC count value TSC0 at the activation time and the current TSC count value TSC.n ; According to the constant frequency F of TSC ts c, via ΔT=(TSC) n -TSC0) / F ts c. Calculate the reliable time increment; Combined with activation reference time T a 𝒸𝒯𝒾𝓋𝒶𝓉ℯ, obtain the offline trusted current time T truste 𝒹=T a 𝒸𝒯𝒾𝓋𝒶𝓉ℯ+ΔT; Simultaneously, the multi-core TSC count value is synchronized to ensure that the difference in multi-core TSC is within the preset threshold range, thus guaranteeing the reliability of the timing sequence. Trust the current time T truste The effective date T is preset in the license document. start Failure time T en 𝒹 Perform interval determination: If T start ≤T truste 𝒹≤T en If 𝒹, then the statute of limitations is valid; If not, the authorization is deemed invalid and service operation is refused.
[0013] Even better, the heartbeat verification process is as follows: Trigger a heartbeat timed task: with a fixed cycle of 10 minutes to ensure the signature verification process is executed periodically; When a heartbeat signature is verified, a full signature verification process is triggered, and the signature verification process is re-executed without regenerating the signature verification record. If the signature verification passes, the latest heartbeat timestamp of the signature verification record already stored in Etcd is updated; if the signature verification fails, exception handling is triggered. Abnormal scenario verification: During the heartbeat signature verification process, three additional abnormal verifications are added: ① Verify whether the collected CPU-TSC features are consistent with the features during the first activation: if there is a change, it is determined to be abnormal; ② Verify whether the signature verification record stored in Etcd or disk exists: if the record is missing, it is determined to be abnormal; ③ Verify whether the stored signature verification record can be parsed normally after decryption: if the parsing is illegal, it is determined to be abnormal. Error Reporting and Handling: If any of the following abnormal scenarios occur, such as CPU-TSC feature change, missing signature record, illegal parsing, or expired license, the error reporting mechanism will be triggered immediately. An error log containing the error type, occurrence time, current CPU-TSC feature, and signature record status will be generated, and the enterprise service will be terminated or its functions restricted. If all heartbeat signature verifications pass, the latest heartbeat timestamp of the signature record will be updated to maintain normal service operation.
[0014] An anti-tampering control system for offline service authorization of intranet containers based on CPU-TSC characteristics, the system being used to implement the aforementioned anti-tampering control method for offline service authorization of intranet containers based on CPU-TSC characteristics; the system includes: A custom key information building module is used to generate RSA-2048 asymmetric key pairs through the KeyStore tool, build a PKCS12 format key store, bind the asymmetric key pairs with self-signed public key certificates, and store them persistently. The license file construction module is used to collect the host machine's CPU-TSC hardware characteristics and CPU serial number, generate a unique hardware fingerprint through the SHA-256 algorithm, combine it with a custom license validity period, sign it with the RSA-2048 algorithm, encrypt it with the AES-128 algorithm, and generate a license file bound to the host machine hardware. The container image service building module is used to build secure and controllable container image services based on the license file, pre-built public key store, and enterprise basic services. The signature verification module is used to start the container image, load the pre-built components in the image, execute the license activation and signature verification process, generate encrypted signature records and store them in the K8S Etcd distributed storage or disk; The heartbeat signature verification module is used to periodically repeat the signature verification process and calculate the validity of the license document (license), and to verify the legality of the license document (license) through multiple rules.
[0015] An electronic device includes: a memory and at least one processor; The memory contains computer programs; The at least one processor executes the computer program stored in the memory, causing the at least one processor to perform the above-described method for preventing tampering of authorization for offline services of intranet containers based on CPU-TSC features.
[0016] A computer-readable storage medium storing a computer program that can be executed by a processor to implement the CPU-TSC feature-based tamper-proof control method for offline service authorization of intranet containers as described above.
[0017] The intranet container offline service authorization anti-tampering control method, system, device, and medium of the present invention have the following advantages: (i) This invention solves the problem of reading host hardware information in intranet container environments, achieving a strong binding between the host machine and the license file, preventing unauthorized copying and cross-machine use of the license file. By mounting the host machine's / proc directory onto the container, it reads the CPU-TSC hardware characteristics and generates an irreversible hardware fingerprint using the SHA256 algorithm. Relying on the inherent uniqueness, stability, and tamper-proof characteristics of TSC hardware, compared to traditional authorization methods based on IP and MAC addresses, it completely eliminates illegal authorization bypassing behaviors such as hardware emulation and address forgery, improving the security and reliability of authorization control. (ii) This invention constructs an offline trusted time validity verification mechanism to avoid authorization failure vulnerabilities caused by time tampering; based on timing characteristics such as TSC frequency and multi-core synchronization, it calculates trusted time offline through standardized algorithms without relying on network clocks or system local clocks, effectively resisting malicious operations such as human modification of system time and forgery of authorization validity, ensuring the authenticity and legality of the license authorization validity period, and adapting to deployment scenarios where there is no external network on the intranet; (III) This invention adopts a multi-verification logic of "activation + signature verification + heartbeat" to achieve multiple security guarantees for authorization credentials and authorized objects; the activation process verifies the machine fingerprint and authorization validity period, the signature verification process verifies the legality and integrity of the license file, and the heartbeat process periodically performs full signature verification and detects anomalies, which solves the security risks of the single verification method in the prior art and improves the anti-cracking and anti-tampering capabilities of the authorization system; (iv) This invention is adapted to K8S clustered deployment scenarios, realizing clustered and traceable control of authorization verification. By encrypting the signature verification record with the AES-128 algorithm and storing it in K8S's Etcd distributed storage, and associating it with node identifiers, container IDs and other metadata, it facilitates the query, traceability and control of authorization records at the cluster level. At the same time, combined with a 10-minute periodic heartbeat signature verification mechanism, it monitors risks such as TSC feature changes and signature verification record anomalies in real time, realizing full lifecycle control of authorization verification and adapting to the business needs of enterprise clustered deployment. (v) The SHA-256, RSA-2048 and AES-128 algorithms used in this invention are all mature encryption algorithms. No additional hardware costs are required. TSC feature reading can be achieved by mounting the host machine's / proc directory in the container. It is easy to implement in engineering and can be quickly adapted to the deployment scenario of containerized enterprise intranet without external network. It solves the problems of traditional authorization being unsuitable and easy to bypass in intranet container scenarios, and has good feasibility and economy. Attached Figure Description
[0018] The invention will be further described below with reference to the accompanying drawings.
[0019] Appendix Figure 1 A flowchart illustrating the process of authorizing tamper-proof control methods for offline services of intranet containers. Detailed Implementation
[0020] The following detailed description of the intranet container offline service authorization anti-tampering control method, system, device, and medium of the present invention, with reference to the accompanying drawings and specific embodiments, is provided. Example
[0021] As attached Figure 1 As shown in the figure, this embodiment provides a method for preventing tampering of authorization for offline services in intranet containers. The method is as follows: S1. Construct custom key information: Generate RSA-2048 asymmetric key pairs using the KeyStore tool, construct a PKCS12 format key store, bind the asymmetric key pairs with self-signed public key certificates, and store them persistently. S2. Collect host machine characteristics and construct license file: Collect host machine CPU-TSC hardware characteristics and CPU serial number, generate a unique hardware fingerprint through SHA-256 algorithm, combine with custom license validity period, sign with RSA-2048 algorithm and encrypt with AES-128 algorithm to generate license file bound to host machine hardware; S3. Building Container Image Services: Based on the license file, pre-built public key store, and enterprise basic services, build secure and controllable container image services. S4, Signature Verification: Start the container image, load the pre-built components in the image, execute the license activation and signature verification process, generate encrypted signature records and store them in K8S's Etcd distributed storage or disk; S5, Heartbeat Verification: Periodically repeats the verification process and calculates the validity of the license document (licence), verifying the legality of the license document (licence) through multiple rules.
[0022] The specific steps for constructing the custom key information in step S1 of this embodiment are as follows: S101. Initialize the RSA algorithm key pair generator and set the key length to 2048 bits to generate an RSA-2048 asymmetric key pair containing a public key and a private key; S102. Construct a public key certificate using the X.509 standard, embed the generated public key into the public key certificate, and fill in the metadata information of the public key certificate, such as the subject information (CN, OU, etc.), validity period, and serial number. Sign the public key certificate using the private key to construct a self-signed public key certificate. Create a PKCS12 format keystore instance and complete its initialization. Bind the private key to the self-signed public key certificate, and store the asymmetric key pair and the self-signed public key certificate chain into the keystore by specifying a unique alias and a password protected by the private key. S103. Set the overall protection password for the keystore and persistently store the PKCS12 format keystore as a local file to realize the generation of RSA asymmetric key pairs, the construction of public key certificates, and the construction of PKCS12 format keystores. S104. Generate an RSA-2048 asymmetric key pair based on KeyStore or other tools and save it to the key store. The key store is used for the digital signing, verification, and encryption / decryption of the verification record of the subsequent license file. The public key will be extracted and pre-installed into the container image built later for signature verification in the license verification process.
[0023] In this embodiment, step S2, which involves collecting host machine characteristics and constructing the license file, is as follows: S201. Read the host machine's / proc / cpuinfo file, collect the host machine's CPU-TSC hardware characteristic parameters, and combine them with hardware information that is not easily tampered with, such as the CPU serial number, to generate a hardware fingerprint that is unique to the current host machine using the SHA-256 algorithm. S202. Configure the custom effective time, expiration time and authorization validity period manually or through keystore association according to authorization requirements, and combine the hardware fingerprint, custom effective time, expiration time and authorization validity period information to form combined data; S203. Digitally sign the combined data using the asymmetric encryption RSA-2048 algorithm to obtain the signed combined data; S204. The combined data and signature information after signing are encrypted and encapsulated using the symmetric encryption AES-128 algorithm to generate a license file that is bound to the host hardware, has a fixed validity period, and is tamper-proof.
[0024] In step S3 of this embodiment, during the secure and controllable container image service process, the authorization license file, the pre-built public key library file, the enterprise basic service related components, and the runtime dependency packages are uniformly integrated and encapsulated into the image file system to form a standardized image service containing basic authorization information and a basic environment for public key verification; wherein, the pre-built public key library includes KeyStore Explorer, p11-kit, and jdk.
[0025] The signature verification in step S4 of this embodiment is as follows: S401. Start the container image. During the container instantiation process, load the pre-built enterprise basic service related components and runtime dependencies, license file, and pre-built public key store in the image. S402. Activating the license file: First, the enterprise basic service components initiate the activation process through the internally integrated activation sub-service. This involves mounting the host machine's / proc directory via a container, reading the host machine's / proc / cpuinfo file, extracting CPU-TSC hardware characteristics (such as TSC frequency, multi-core synchronization, and other timing characteristics), and simultaneously collecting auxiliary hardware information including the server's MAC address, CPU serial number, motherboard serial number, and IP address. This data collection is completed entirely offline, without relying on the external network. Then, SHA256 is performed on the CPU-TSC hardware characteristics and auxiliary hardware information. The system performs a hash operation to generate the hardware fingerprint of the current host machine, and then performs a consistency check against the hardware fingerprint pre-stored in the license file. Next, based on the CPU-TSC hardware characteristics, it obtains the baseline TSC count value at the activation time and the current TSC count value, combines them with the activation baseline time, and completes the validity check. If the hardware fingerprint of the current host machine matches the hardware fingerprint pre-stored in the license file and the validity check is valid, an activation success identifier is generated. If the hardware fingerprint of the current host machine does not match the hardware fingerprint pre-stored in the license file or the validity check is invalid, the activation process is terminated and the reason for activation failure is marked (e.g., fingerprint mismatch, license expired). The key steps for extracting CPU-TSC hardware characteristics are as follows: Check CPU TSC support: Use ` / proc / cpuinfo` to check if the CPU has the necessary flags for stable TSC: `cat / proc / cpuinfo|grep -E "tsc|constant_tsc|nonstop_tsc"`. `constant_tsc` indicates that the TSC frequency is fixed and does not change with the CPU's clock speed; `nonstop_tsc` indicates that the TSC continues to count even when the CPU is in deep sleep (C-state). These two flags are prerequisites for TSC to function as a reliable, high-precision clock source. Confirm the current clock source used by the system: `cat / sys / devices / system / clocksource / clocksource0 / current_clocksource`. If the output is `tsc`, it means the Linux kernel is currently using TSC as the system's main clock source. Obtain the TSC frequency: First, read the kernel's pre-calibrated frequency file (in kHz): `cat / sys / devices / system / cpu / cpu0 / tsc_freq_khz`; secondly, check the kernel's calibration log during system startup: `dmesg|grep -i tsc`. The output will typically contain information like [0.000000] tsc: Detected 3192.000 MHz processor; check multi-core TSC synchronization: dmesg | grep -i "tsc\|warp"; if a warning appears indicating "Measured xxx cycles TSC warp between CPUs", it means there is a TSC count offset between cores; if there are no related warnings or the synchronization test passes, it indicates that the multi-core TSC is synchronized; Enterprise basic service components trigger the activation process through an internally integrated activation sub-service: After the container instance starts and loads the pre-installed enterprise service programs, license files, and public keystore within the image, the license activation process is triggered by the certificate verification and signature interception module within the business subsystem. This module is integrated into the business subsystem as a separate JAR file, automatically loaded as part of the subsystem's startup process, and completes activation verification upon the first business request. Triggering method: The certificate verification and signature JAR file is embedded in the business request processing chain through an interceptor mechanism. After the business subsystem starts, the first arriving request or other business event (health check) will trigger the interceptor to execute, which in turn actively calls the activation sub-service encapsulated within the JAR file to initiate the hardware feature collection and license verification process. After successful activation, subsequent requests will not trigger the verification process again; verification will only be performed through internally customized health checks.
[0026] S403, License Verification: First, extract the digital signature generated by the licensor based on the RSA-2048 private key and the original authorization data including the validity period of the hardware fingerprint machine authorization from the license file. Then, call the RSA-2048 public key in the pre-built public key library in the image to decrypt and verify the extracted digital signature to confirm that the license file has not been tampered with and that its source is legitimate. If the verification passes, the license file is confirmed to be legitimate and valid. If the verification fails (e.g., signature tampering, public key mismatch), the license file is determined to be invalid and the exception handling mechanism (service stoppage) is triggered. S404. Verification Record Encryption and Storage: First, integrate the verification result (success / failure), activation status, current host machine TSC feature hash value, trusted timestamp, and verification failure reason (if any) to generate a structured verification record. Then, encrypt the structured verification record using the AES-128 algorithm. Next, write the encrypted verification record to the K8S Etcd distributed storage, along with the metadata of the associated node identifier and container ID, to ensure that the record is traceable and not lost.
[0027] In this embodiment, step S402, based on the CPU-TSC hardware characteristics, obtains the activation time baseline TSC count value and the current TSC count value, combines the activation baseline time, and completes the validity verification of the validity period as follows: S40201. Based on the host CPU's TSC hardware characteristics, obtain the activation time baseline TSC count value TSC0 and the current TSC count value TSC. n ; S40202, Based on the constant frequency F of TSC ts c, via ΔT=(TSC) n -TSC0) / F ts c. Calculate the reliable time increment; S40203, combined with activation reference time T a 𝒸𝒯𝒾𝓋𝒶𝓉ℯ, obtain the offline trusted current time T truste 𝒹=T a 𝒸𝒯𝒾𝓋𝒶𝓉ℯ+ΔT; S40204. Simultaneously, perform synchronization verification on the multi-core TSC count values to ensure that the difference in multi-core TSC values is within a preset threshold range, thus ensuring reliable timing. S40205, Trust the current time T truste The effective date T is preset in the license document. start Failure time T en 𝒹 Perform interval determination: If T start ≤T truste 𝒹≤T en If 𝒹, then the statute of limitations is valid; If not, the authorization is deemed invalid and service operation is refused.
[0028] The heartbeat verification step S5 in this embodiment is as follows: S501, Trigger heartbeat timed task: The fixed period is 10 minutes to ensure that the signature verification process is executed periodically; S502. During heartbeat signature verification, a full signature verification process is triggered, and the signature verification process is re-executed without regenerating signature verification records. If the signature verification passes, the latest heartbeat timestamp of the signature verification record stored in Etcd is updated; if the signature verification fails, exception handling is triggered. S503, Abnormal Scenario Verification: During the heartbeat signature verification process, three additional abnormal verifications are added: ① Verify whether the collected CPU-TSC features are consistent with the features during the first activation: if there is a change, it is determined to be abnormal; ② Verify whether the signature verification record stored in Etcd or disk exists: if the record is missing, it is determined to be abnormal; ③ Verify whether the stored signature verification record can be parsed normally after decryption: if the parsing is illegal, it is determined to be abnormal. S504. Error Reporting and Handling: If any of the following abnormal scenarios occur: CPU-TSC feature change, signature verification record not found, illegal parsing, or expired license authorization, the error reporting mechanism will be triggered immediately, generating an error log containing the error type, occurrence time, current CPU-TSC feature, and signature verification record status, and simultaneously terminating the enterprise service or restricting service functions; if all heartbeat signature verifications pass, the latest heartbeat timestamp of the signature verification record will be updated to maintain normal service operation.
[0029] This embodiment employs an offline reliable timeliness verification mechanism based on TSC timing characteristics, specifically: obtaining the baseline TSC count value TSC0 at the activation time and the current TSC count value TSC. n According to the constant frequency F of TSC ts c, through the formula ΔT=(TSC) n -TSC0) / F ts c calculates the reliable time increment, combined with the activation baseline time T. a 𝒸𝒯𝒾𝓋𝒶𝓉ℯ Obtain the offline trusted current time T truste Simultaneously verify the synchronization of multi-core TSC values to ensure that the difference in multi-core TSC values is within a preset threshold range; T truste The effective date T in the license file. start Failure time T enThe system performs interval determination to effectively resist malicious operations such as manually modifying the system time and forging the validity period of authorization, ensuring the legality of the license authorization period.
[0030] The license activation and signature verification process in this embodiment adopts a multi-verification logic of "activation + signature verification + heartbeat": the activation step verifies the consistency and validity of the machine fingerprint; the signature verification step extracts the digital signature from the license file and decrypts and verifies it using the RSA-2048 public key in the preset public key library to confirm that the license file has not been tampered with and that its source is legitimate; the heartbeat signature verification mechanism in step S5 adds anomaly detection for TSC feature changes, signature record existence, and signature record parsing validity on the basis of dual verification, which solves the security risks of the single verification method in the prior art and improves the anti-cracking capability of the authorization system.
[0031] The encrypted signature verification record in this embodiment is encrypted using the AES-128 algorithm. When storing, it is associated with the node identifier and container ID metadata of the K8S cluster and stored in Etcd distributed storage to achieve traceability and prevent loss of signature verification records. The heartbeat signature verification mechanism in this embodiment is adapted to K8S clustered deployment, monitors authorization anomalies in real time and triggers alarms, and realizes full lifecycle management of authorization verification, which is suitable for enterprise clustered deployment business scenarios.
[0032] This embodiment extracts CPU-TSC hardware features by reading the host machine's / proc / cpuinfo file, and generates an irreversible SHA-256 machine fingerprint by combining it with the CPU serial number. Relying on the uniqueness, stability, and tamper-proof characteristics of the TSC hardware, it achieves a strong binding between the license file and the host machine's physical node, preventing unauthorized copying and cross-machine use of the license.
[0033] The SHA-256 hash algorithm, RSA-2048 asymmetric encryption algorithm, and AES-128 symmetric encryption algorithm used in this embodiment are all mature technologies that do not require additional hardware costs. TSC feature reading is achieved by mounting the host machine's / proc directory through the container, which is easy to implement in engineering and adaptable to offline containerized deployment scenarios on the intranet. Example
[0034] An anti-tampering control system for offline service authorization of intranet containers based on CPU-TSC characteristics, the system being used to implement the aforementioned anti-tampering control method for offline service authorization of intranet containers based on CPU-TSC characteristics; the system includes: A custom key information building module is used to generate RSA-2048 asymmetric key pairs through the KeyStore tool, build a PKCS12 format key store, bind the asymmetric key pairs with self-signed public key certificates, and store them persistently. The license file construction module is used to collect the host machine's CPU-TSC hardware characteristics and CPU serial number, generate a unique hardware fingerprint through the SHA-256 algorithm, combine it with a custom license validity period, sign it with the RSA-2048 algorithm, encrypt it with the AES-128 algorithm, and generate a license file bound to the host machine hardware. The container image service building module is used to build secure and controllable container image services based on the license file, pre-built public key store, and enterprise basic services. The signature verification module is used to start the container image, load the pre-built components in the image, execute the license activation and signature verification process, generate encrypted signature records and store them in the K8S Etcd distributed storage or disk; The heartbeat signature verification module is used to periodically repeat the signature verification process and calculate the validity of the license document (license), and to verify the legality of the license document (license) through multiple rules.
[0035] The working process of this system is as follows: (a) Construct custom keys and other information using the KeyStore tool or other methods, as detailed below: First, initialize the key pair generator for the RSA algorithm and set the key length to 2048 bits to generate an asymmetric key pair containing a public key and a private key; Then, a self-signed public key certificate is built using the X.509 standard. The generated public key is embedded in the certificate, and metadata such as certificate subject information (e.g., CN, OU, etc.), validity period, and serial number are filled in. The certificate is signed using the private key to complete the construction of the public key certificate. A keystore instance in PKCS12 format is created and initialized. The private key is bound to the above public key certificate. By specifying a unique alias and a password protected by the private key, the key pair and certificate chain are stored in the keystore. Finally, set the overall protection password for the keystore and persistently store the PKCS12 keystore as a local file, thus realizing the generation of RSA asymmetric key pairs, the construction of public key certificates, and the construction of a PKCS12 format keystore.
[0036] (ii) By collecting the host machine's CPU-TSC hardware characteristic parameters (obtained by reading the host machine's / proc / cpuinfo file), and combining them with hardware information that is not easily tampered with, such as the CPU serial number, a hardware fingerprint unique to the current host machine is generated using the SHA-256 algorithm. According to the authorization requirements, the user can manually configure or configure the user through the key store to customize the effective time, expiration time, and authorization validity period. Then, the user can use the asymmetric encryption RSA-2048 algorithm to digitally sign the combined data, and then use the symmetric encryption AES-128 algorithm to encrypt and encapsulate the signed data and signature information, thereby generating an authorization license file (License) that is bound to the host machine hardware, has a fixed validity period, and is tamper-proof.
[0037] (iii) Based on the license, pre-built public key store and enterprise basic services, build a secure and controllable container image service; in the image building process, integrate the license, public key store and enterprise service related components and runtime dependency packages into the image file system to form a standardized image containing basic authorization information and public key verification environment.
[0038] (iv) Verification of signature, as detailed below: (1) Start the container image. During the container instantiation process, load the following pre-built components in the image: enterprise service programs and runtime dependencies, license file and public key store; (2) License activation process, as detailed below: ① Hardware feature collection: The enterprise service program triggers the activation process through the internally integrated activation sub-service, mounts the host machine's / proc directory through the container, reads the host machine's / proc / cpuinfo file, extracts CPU-TSC hardware features (such as TSC frequency, multi-core synchronization and other timing features), and synchronously collects hardware information such as CPU serial number; the collection is completed offline without relying on the external network. ② Fingerprint generation and comparison: Perform SHA256 hash operation on the collected TSC features and auxiliary hardware information (including server MAC address, CPU serial number, motherboard serial number and IP address) to generate the hardware fingerprint of the current host machine, and perform consistency verification with the hardware fingerprint pre-stored in the License file. ③ Time validity verification: Based on the host CPU's TSC hardware characteristics, obtain the baseline TSC count value TSC0 at the activation time and the current TSC count value TSC. n According to the constant frequency F of TSC ts c, through the formula ΔT=(TSC) n -TSC0) / F ts c. Calculate the reliable time increment; combine it with the activation baseline time T.a 𝒸𝒯𝒾𝓋𝒶𝓉ℯ, obtain the offline trusted current time T truste 𝒹=T a 𝒸𝒯𝒾𝓋𝒶𝓉ℯ+ΔT; Simultaneously, perform synchronization checks on multi-core TSC values to ensure that the difference in multi-core TSC values is within a preset threshold range, guaranteeing time sequence reliability. Set the reliable current time T. truste The effective time T preset in the license file. start Failure time T en 𝒹 Perform interval determination: If T start ≤T truste 𝒹≤T en If the authorization is valid, the validity period is valid; otherwise, the authorization is deemed invalid and service operation is refused. ④ Activation Confirmation: If the fingerprint matches and the validity period is valid, an activation success identifier is generated; if the verification fails, the activation process is terminated and the reason for activation failure is marked (such as fingerprint mismatch or expired authorization). (3) License verification process, as detailed below: ①Signature Extraction: Extract the digital signature and original authorization data (hardware fingerprint, validity period, etc.) generated by the authorizing party based on the RSA-2048 private key from the License file; ② Public key verification: The RSA-2048 public key in the pre-set public key library in the image is used to decrypt and verify the extracted digital signature to confirm that the license file has not been tampered with and that its source is legitimate; ③ Signature verification result determination: If the signature verification passes, the license is confirmed to be legal and valid; if the signature verification fails (e.g., signature tampering, public key mismatch), the license is determined to be invalid and the exception handling mechanism (service suspension) is triggered; (4) Encryption and storage of signature verification records, as detailed below: ① Record generation: Integrate the signature verification result (success / failure), activation status, current host machine TSC feature hash value, trusted timestamp, signature verification failure reason (if any) and other information to generate a structured signature verification record, and use the AES-128 algorithm to encrypt the structured signature verification record; ② Signature verification storage (default K8S cluster scenario): The encrypted signature verification record is written to the K8S Etcd distributed storage, and associated with metadata such as node identifier and container ID to ensure that the record is traceable and not lost; (v) The above verification successfully triggers the heartbeat signature verification mechanism, as detailed below: (1) Trigger heartbeat timed task: The fixed period is 10 minutes to ensure that the signature verification process is executed periodically; (2) Heartbeat signature verification triggers the full signature verification process, re-executes the logic of hardware feature acquisition, fingerprint comparison, timeliness verification and license signature verification, without regenerating the signature verification record; if the signature verification is successful, the latest heartbeat timestamp of the signature verification record stored in Etcd is updated; if the signature verification fails, exception handling is triggered. (3) Abnormal scenario verification: Three additional abnormal verification methods are added to the heartbeat signature verification process: ① Verify whether the collected TSC features are consistent with the features at the time of initial activation. If there is a change, it is considered abnormal. ② Verify the existence of the signature verification records stored in Etcd / disk; if the records are missing, it is considered abnormal. ③ Verify whether the stored signature verification record can be parsed normally after decryption. If the parsing is illegal, it is judged as abnormal. (4) Error reporting and handling: If any of the following abnormal scenarios occur, such as TSC feature change, signature verification record non-existent / illegally parsed, or License authorization expired, the error reporting mechanism will be triggered immediately to generate an error log containing the error type, occurrence time, current TSC feature, and signature verification record status, and the enterprise service operation will be terminated or the service function will be restricted simultaneously; if all heartbeat signature verifications pass, the latest heartbeat timestamp of the signature verification record will be updated to maintain normal service operation. Example
[0039] This invention also provides an electronic device, including: a memory and a processor; The memory stores the instructions executed by the computer. The processor executes computer execution instructions stored in the memory, causing the processor to execute the intranet container offline service authorization anti-tampering control method in any embodiment of the present invention.
[0040] The processor can be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), off-the-shelf programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The processor can be a microprocessor or any conventional processor.
[0041] Memory can be used to store computer programs and / or modules. The processor implements various functions of the electronic device by running or executing the computer programs and / or modules stored in the memory, and by accessing data stored in the memory. Memory can mainly include a program storage area and a data storage area. The program storage area can store the operating system, at least one application program required for a function, etc.; the data storage area can store data created based on the use of the terminal, etc. In addition, memory can also include high-speed random access memory, and can also include non-volatile memory, such as hard disks, RAM, plug-in hard disks, smart memory cards (SMC), secure digital cards (SD cards), flash memory cards, at least one disk storage device, flash memory device, or other volatile solid-state storage devices. Example
[0042] This embodiment also provides a computer-readable storage medium storing multiple instructions, which are loaded by a processor to cause the processor to execute the intranet container offline service authorization anti-tampering control method in any embodiment of the present invention. Specifically, a system or device equipped with a storage medium may be provided, on which software program code implementing the functions of any of the above embodiments is stored, and the computer (or CPU or MPU) of the system or device may read and execute the program code stored in the storage medium.
[0043] In this case, the program code read from the storage medium can itself implement the function of any of the above embodiments, and therefore the program code and the storage medium storing the program code constitute part of the present invention.
[0044] Storage media embodiments for providing program code include floppy disks, hard disks, magneto-optical disks, optical disks (such as CD-ROM, CD-R, CD-RW, DVD-ROM, DVD-RYM, DVD-RW, DVD+RW), magnetic tapes, non-volatile memory cards, and ROMs. Alternatively, program code can be downloaded from a server computer via a communication network.
[0045] Furthermore, it should be clear that not only can the program code read by the computer be executed, but also the operating system or other components operating on the computer can be instructed based on the program code to perform some or all of the actual operations, thereby realizing the function of any of the embodiments described above.
[0046] Furthermore, it is understood that the program code read from the storage medium is written to the memory set in the expansion board inserted into the computer or to the memory set in the expansion unit connected to the computer. Then, based on the instructions of the program code, the CPU or other components installed on the expansion board or expansion unit execute some and all of the actual operations, thereby realizing the function of any of the embodiments described above.
[0047] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some or all of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention.
Claims
1. A method for preventing tampering of offline service authorization for intranet containers based on CPU-TSC characteristics, characterized in that, The method is as follows: Construct custom key information: Generate RSA-2048 asymmetric key pairs using the KeyStore tool, construct a PKCS12 format keystore, bind the asymmetric key pairs to a self-signed public key certificate, and store them persistently. Collect host machine characteristics and construct license file: Collect host machine CPU-TSC hardware characteristics and CPU serial number, generate a unique hardware fingerprint through SHA-256 algorithm, combine with custom license validity period, sign with RSA-2048 algorithm and encrypt with AES-128 algorithm to generate license file bound to host machine hardware; Building container image services: Based on license files, pre-built public key stores, and enterprise infrastructure services, we build secure and controllable container image services. Signature verification: Start the container image, load the pre-built components in the image, execute the license activation and signature verification process, generate encrypted signature records and store them in the K8S Etcd distributed storage or disk; Heartbeat verification: Periodically repeats the verification process and calculates the validity of the license document, verifying the legality of the license document through multiple rules.
2. The method for preventing tampering of offline service authorization for intranet containers based on CPU-TSC characteristics according to claim 1, characterized in that, The specific steps for constructing custom key information are as follows: Initialize the RSA algorithm key pair generator and set the key length to 2048 bits to generate an RSA-2048 asymmetric key pair containing a public key and a private key; Construct a public key certificate using the X.509 standard, embed the generated public key into the public key certificate, and fill in the metadata information of the public key certificate, including the subject information, validity period, and serial number. Sign the public key certificate using the private key to construct a self-signed public key certificate. Create a PKCS12 format keystore instance and complete its initialization. Bind the private key to the self-signed public key certificate, and store the asymmetric key pair and the self-signed public key certificate chain into the keystore by specifying a unique alias and a password protected by the private key. Set an overall protection password for the keystore and persistently store the PKCS12 format keystore as a local file to realize the generation of RSA asymmetric key pairs, the construction of public key certificates, and the construction of PKCS12 format keystores.
3. The method for preventing tampering of offline service authorization for intranet containers based on CPU-TSC characteristics according to claim 1 or 2, characterized in that, The specific steps for collecting host machine characteristics and constructing the license file are as follows: Read the host machine's / proc / cpuinfo file, collect the host machine's CPU-TSC hardware characteristic parameters, and combine them with the CPU serial number to generate a hardware fingerprint unique to the current host machine using the SHA-256 algorithm; As required for authorization, the activation time, deactivation time, and authorization validity period can be manually configured or configured through keystore association. The hardware fingerprint, custom activation time, deactivation time, and authorization validity period information are then combined to form combined data. The combined data is digitally signed using the asymmetric encryption algorithm RSA-2048 to obtain the signed combined data. The combined data and signature information after signing are encrypted and encapsulated using the symmetric encryption algorithm AES-128 to generate a license file that is bound to the host hardware, has a fixed validity period, and is tamper-proof.
4. The method for preventing tampering of offline service authorization for intranet containers based on CPU-TSC characteristics according to claim 3, characterized in that, In the process of providing secure and controllable container image services, the authorization license file, the pre-built public key store file, the enterprise basic service related components, and the runtime dependency packages are uniformly integrated and encapsulated into the image file system to form a standardized image service containing basic authorization information and a basic environment for public key verification.
5. The method for preventing tampering of offline service authorization for intranet containers based on CPU-TSC characteristics according to claim 4, characterized in that, The verification process is as follows: Start the container image. During container instantiation, load the pre-built enterprise basic service-related components and runtime dependencies, license file, and pre-built public key store within the image. The activation of the license file (license) involves the following steps: First, the enterprise's basic service components initiate the activation process through an internally integrated activation sub-service. This involves mounting the host machine's ` / proc` directory via a container, reading the ` / proc / cpuinfo` file, extracting the CPU-TSC hardware characteristics, and simultaneously collecting auxiliary hardware information such as the server's MAC address, CPU serial number, motherboard serial number, and IP address. This entire data collection process is completed offline, without relying on the external network. Then, a SHA256 hash operation is performed on the CPU-TSC hardware characteristics and auxiliary hardware information to generate the current host machine's hardware fingerprint, which is then compared to the hardware fingerprint pre-stored in the license file (license). Next, based on the CPU-TSC hardware characteristics, the baseline TSC count value at the activation time and the current TSC count value are obtained, and the activation baseline time is combined to complete the validity period verification. If the hardware fingerprint of the current host machine is consistent with the hardware fingerprint pre-stored in the license file and the validity period verification is valid, an activation success identifier is generated. If the hardware fingerprint of the current host machine is inconsistent with the hardware fingerprint pre-stored in the license file or the validity period verification is invalid, the activation process is terminated and the reason for activation failure is marked. License verification: First, extract the digital signature generated by the licensor based on the RSA-2048 private key and the original authorization data including the validity period of the hardware fingerprint machine authorization from the license file. Then, call the RSA-2048 public key in the pre-built public key library in the image to decrypt and verify the extracted digital signature to confirm that the license file has not been tampered with and its source is legitimate. If the verification passes, the license file is confirmed to be legitimate and valid; if the verification fails, the license file is determined to be invalid and the exception handling mechanism is triggered. Verification record encryption and storage: First, integrate the verification result, activation status, current host machine TSC feature hash value, trusted timestamp, and verification failure reason information to generate a structured verification record. Then, encrypt the structured verification record using the AES-128 algorithm. Next, write the encrypted verification record to the K8S Etcd distributed storage, along with the metadata of the associated node identifier and container ID, to ensure that the record is traceable and not lost.
6. The method for preventing tampering of offline service authorization for intranet containers based on CPU-TSC characteristics according to claim 5, characterized in that, Based on the CPU-TSC hardware characteristics, the baseline TSC count value at the activation time and the current TSC count value are obtained, and combined with the activation baseline time, the validity period verification is completed as follows: Based on the host CPU's TSC hardware characteristics, obtain the baseline TSC count value TSC0 at the activation time and the current TSC count value TSC. n ; According to the constant frequency F of TSC ts c, via ΔT=(TSC) n -TSC0) / F ts c. Calculate the reliable time increment; Combined with activation reference time T a 𝒸𝒯𝒾𝓋𝒶𝓉ℯ, obtain the offline trusted current time T truste 𝒹=T a 𝒸𝒯𝒾𝓋𝒶𝓉ℯ+ΔT; Simultaneously, the multi-core TSC count value is synchronized to ensure that the difference in multi-core TSC is within the preset threshold range, thus guaranteeing the reliability of the timing sequence. Trust the current time T truste The effective date T is preset in the license document. start Failure time T en 𝒹 Perform interval determination: If T start ≤T truste 𝒹≤T en If 𝒹, then the statute of limitations is valid; If not, the authorization is deemed invalid and service operation is refused.
7. The method for preventing tampering of offline service authorization for intranet containers based on CPU-TSC characteristics according to claim 6, characterized in that, The heartbeat verification process is as follows: Trigger a heartbeat timed task: with a fixed cycle of 10 minutes to ensure the signature verification process is executed periodically; When heartbeat signature verification is performed, a full signature verification process is triggered and the signature verification process is re-executed without the need to regenerate signature verification records. If the signature verification is successful, the latest heartbeat timestamp of the signature verification record already stored in Etcd is updated. If the signature verification fails, exception handling will be triggered. Abnormal scenario verification: During the heartbeat signature verification process, three additional abnormal verifications are added: ① Verify whether the collected CPU-TSC features are consistent with the features during the first activation: if there is a change, it is determined to be abnormal; ② Verify whether the signature verification record stored in Etcd or disk exists: if the record is missing, it is determined to be abnormal; ③ Verify whether the stored signature verification record can be parsed normally after decryption: if the parsing is illegal, it is determined to be abnormal. Error Reporting and Handling: If any of the following abnormal scenarios occur, such as CPU-TSC feature change, missing signature record, illegal parsing, or expired license, the error reporting mechanism will be triggered immediately. An error log containing the error type, occurrence time, current CPU-TSC feature, and signature record status will be generated, and the enterprise service will be terminated or its functions restricted. If all heartbeat signature verifications pass, the latest heartbeat timestamp of the signature record will be updated to maintain normal service operation.
8. A tamper-proof control system for offline service authorization of intranet containers based on CPU-TSC features, characterized in that, This system is used to implement the intranet container offline service authorization anti-tampering control method based on CPU-TSC characteristics as described in any one of claims 1 to 7; the system includes: A custom key information building module is used to generate RSA-2048 asymmetric key pairs through the KeyStore tool, build a PKCS12 format key store, bind the asymmetric key pairs with self-signed public key certificates, and store them persistently. The license file construction module is used to collect the host machine's CPU-TSC hardware characteristics and CPU serial number, generate a unique hardware fingerprint through the SHA-256 algorithm, combine it with a custom license validity period, sign it with the RSA-2048 algorithm, encrypt it with the AES-128 algorithm, and generate a license file bound to the host machine hardware. The container image service building module is used to build secure and controllable container image services based on the license file, pre-built public key store, and enterprise basic services. The signature verification module is used to start the container image, load the pre-built components in the image, execute the license activation and signature verification process, generate encrypted signature records and store them in the K8S Etcd distributed storage or disk; The heartbeat signature verification module is used to periodically repeat the signature verification process and calculate the validity of the license document (license), and to verify the legality of the license document (license) through multiple rules.
9. An electronic device, characterized in that, include: Memory and at least one processor; The memory contains computer programs; The at least one processor executes the computer program stored in the memory, causing the at least one processor to perform the intranet container offline service authorization anti-tampering control method based on CPU-TSC features as described in 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 that can be executed by a processor to implement the intranet container offline service authorization anti-tampering control method based on CPU-TSC features as described in any one of claims 1 to 7.
