Log file storage method and device, storage medium and electronic equipment

By encrypting the log files at BMC startup and transmitting them to a secure server storage, the problem of low security of BMC log files is solved, and efficient security protection of log files is achieved.

CN119003476APending Publication Date: 2024-11-22SHANDONG YUNHAI GUOCHUANG CLOUD COMPUTING EQUIP IND INNOVATION CENT CO LTD

Patent Information

Application Number
CN202410946832.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-15
Publication Date
2024-11-22

AI Technical Summary

Technical Problem

In the prior art, the log files of the substrate management controller (BMC) have low security problems and are vulnerable to attacks and lead to illegal access and data leakage.

Method used

When BMC is started, it is determined whether to encrypt the log file based on the configuration information, and the encrypted log file is transferred to a secure server for storage. It uses cryptographic protocols such as SSL/TLS, etc. for encryption, and uses hash functions and asymmetry. Technologies such as encryption ensure data security.

Benefits of technology

Through encrypted processing and secure storage, the risk of data breaches caused by hacker attacks or malicious behavior is significantly reduced, and the security of BMC log files is improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119003476A_ABST
    Figure CN119003476A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a log file storage method and device, a storage medium and electronic device.The method comprises the steps that under the condition that a substrate management controller is started, configuration information of a first configuration item is read, and the first configuration item is used for indicating whether encryption processing is conducted on a log file of the substrate management controller or not; under the condition that the log file of the baseboard management controller is determined to be encrypted based on the configuration information of the first configuration item, encrypting the log file of the baseboard management controller to obtain an encrypted log file; the encrypted log file is transmitted to the security server to be stored, the address of the security server is indicated through the configuration information of the second configuration item, and by means of the log file storage method and device, the problem that in the related technology, the security of a log file storage method is low is solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present application relate to the field of computers, and more specifically, to a method and apparatus for storing log files, a storage medium, and an electronic device. Background Art

[0002] Currently, log files store a large amount of information related to system operation, and these files are stored in plain text. Some of this information contains critical information. For example, BMC log files record server-related accounts, passwords, commands, status, hardware device models, and more. If this information is obtained by an attacker, it could lead to illegal access, illegal command execution, and leakage of core server information. Therefore, the log file storage methods used in related technologies have low security issues. Summary of the Invention

[0003] The embodiments of the present application provide a log file storage method and device, a storage medium, and an electronic device to at least solve the problem of low security of log file storage methods in related technologies.

[0004] According to one embodiment of the present application, a method for storing a log file is provided, comprising: when a baseboard management controller is started, reading configuration information of a first configuration item, wherein the first configuration item is used to indicate whether to encrypt the log file of the baseboard management controller; when it is determined based on the configuration information of the first configuration item that the log file of the baseboard management controller is to be encrypted, encrypting the log file of the baseboard management controller to obtain an encrypted log file; and transmitting the encrypted log file to a secure server for storage, wherein the address of the secure server is indicated by the configuration information of a second configuration item.

[0005] According to another embodiment of the present application, a log file storage device is provided, including: a reading unit for reading configuration information of a first configuration item when a baseboard management controller is started, wherein the first configuration item is used to indicate whether to encrypt the log file of the baseboard management controller; a processing unit for encrypting the log file of the baseboard management controller to obtain an encrypted log file when it is determined based on the configuration information of the first configuration item that the log file of the baseboard management controller is to be encrypted; and a transmission unit for transmitting the encrypted log file to a security server for storage, wherein the address of the security server is indicated by the configuration information of the second configuration item.

[0006] According to another embodiment of the present application, a computer-readable storage medium is provided, in which a computer program is stored. The computer program is configured to execute the steps of any one of the above method embodiments when run.

[0007] According to another embodiment of the present application, an electronic device is provided, including a memory and a processor, wherein the memory stores a computer program, and the processor is configured to run the computer program to execute the steps in any one of the above method embodiments.

[0008] According to another embodiment of the present application, a computer program product is provided, including a computer program, which implements the steps of any of the above method embodiments when executed by a processor.

[0009] Through the present application, when the BMC is powered on and started, it is determined based on the configuration information whether to encrypt the BMC log file. If it is determined based on the configuration information that encryption is to be performed, the BMC log file is encrypted and transmitted to a designated secure server for storage. Storing data on a secure server can reduce the risk of data leakage due to hacker attacks or other malicious acts, thereby solving the problem of low security in the log file storage method in the related art and improving the security of the BMC log file. BRIEF DESCRIPTION OF THE DRAWINGS

[0010] Figure 1 This is a hardware environment diagram of a log file storage method according to an embodiment of the present application;

[0011] Figure 2 This is a flow chart of a log file storage method according to an embodiment of the present application;

[0012] Figure 3 is a schematic diagram of a log file storage method according to an embodiment of the present application;

[0013] Figure 4 is a schematic diagram of another log file storage method according to an embodiment of the present application;

[0014] Figure 5 is a schematic diagram of another log file storage method according to an embodiment of the present application;

[0015] Figure 6 This is a flow chart of another log file storage method according to an embodiment of the present application;

[0016] Figure 7 This is a structural block diagram of an optional log file storage device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0017] The embodiments of the present application will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.

[0018] It should be noted that 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.

[0019] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by those skilled in the art to which this application pertains. The terms used herein are for the purpose of describing the embodiments of this application only and are not intended to limit this application.

[0020] In this embodiment, a method for storing log files is provided. Figure 1 This is a hardware environment diagram of a log file storage method according to an embodiment of the present application. Figure 1 As shown, a log file storage method of an embodiment of the present application can be applied to the baseboard management controller 102. Optionally, the baseboard management controller can send the log file to the security server 104 for storage based on configuration information.

[0021] Here, BMC (Baseboard Management Controller) is a server hardware component used to remotely monitor and manage the server.

[0022] Figure 2 This is a flow chart of a log file storage method according to an embodiment of the present application. Figure 2 As shown, the process includes the following steps:

[0023] Step S202: when the baseboard management controller is started, reading configuration information of a first configuration item, wherein the first configuration item is used to indicate whether to encrypt a log file of the baseboard management controller;

[0024] The log file storage method in this embodiment can be applied to scenarios where baseboard management controller (BMC) log files are encrypted and protected. Here, the BMC (Baseboard Management Controller) is a management system independent of the server operating system, used to manage the server's hardware. The BMC log records operations, processes, and alarm information during BMC operation, including but not limited to the following categories: audit logs, IDL (Inspur Diagnosis Log), SEL (System Event Log), SOL (Serial Over LAN, a technology for connecting and controlling computers via a remote network, transmitting control and management instructions via a serial port), maintenance logs, etc. The audit log records all non-query operations performed by external users (including external tools) through the BMC; the IDL log is a precise fault diagnosis log; the SEL log records events that occur during system operation; the SOL log records BIOS (Basic Input / Output System) serial port information; and the maintenance log records the BMC's daily operation process information.

[0025] BMC log storage stores a large amount of system operation-related information in plain text. This information includes critical information such as server-related accounts, passwords, commands, status, hardware device models, and more. If this information is obtained by an attacker, it could lead to illegal access, illegal command execution, and leakage of core server information. Currently, the partition where BMC logs are stored is not encrypted, which shows that the log file storage method used in related technologies has a low security problem.

[0026] In order to at least partially solve the above problem, in this embodiment, a security protection method is established to encrypt and transmit the log to the security server after the BMC is started, so as to prevent the log information from being cracked.

[0027] Here, a secure server refers to a server specifically used to provide secure network communications and data transmission. It uses various security technologies and measures, such as firewalls, data encryption, and identity authentication, to ensure that user data is not stolen or tampered with during transmission.

[0028] In this embodiment, a security log configuration option may be added to the BMC. The security log configuration option may include a first configuration item. The first configuration item is used to indicate whether to encrypt the log file of the baseboard management controller.

[0029] In order to improve the comprehensiveness of the BMC log file encryption protection, when the baseboard management controller is started, the configuration information of the first configuration item can be read to determine whether to encrypt the log file of the baseboard management controller.

[0030] For example, in this embodiment, the first configuration item may be Encryption (translated as data encryption): whether to enable encrypted transmission (true / false).

[0031] When the configuration information of the first configuration item is true, it is determined to encrypt the log file of the baseboard management controller; when the configuration information of the first configuration item is false, it is determined not to encrypt the log file of the baseboard management controller.

[0032] It should be noted that this embodiment does not limit the form of the configuration information, and it may also be other configuration information for indicating whether to encrypt the log file of the baseboard management controller.

[0033] Step S204 , when it is determined based on the configuration information of the first configuration item that the log file of the baseboard management controller is to be encrypted, encrypt the log file of the baseboard management controller to obtain an encrypted log file;

[0034] Similar to the aforementioned embodiment, the first configuration item is used to indicate whether to encrypt the log file of the baseboard management controller. When the BMC determines to encrypt the log file of the baseboard management controller based on the configuration information of the first configuration item, the log file of the baseboard management controller is encrypted to obtain an encrypted log file.

[0035] Optionally, in this embodiment, encryption processing of the log files of the baseboard management controller may include but is not limited to encryption using cryptographic protocols (such as SSL / TLS (Secure Sockets Layer / Transport Layer Security Protocol), etc.), encryption using hash functions, asymmetric encryption (asymmetric encryption uses a pair of keys, namely a public key and a private key, the public key is used to encrypt data, and the private key is used for decryption), symmetric encryption, etc.

[0036] Step S206: Transmit the encrypted log file to a security server for storage, wherein the address of the security server is indicated by the configuration information of the second configuration item.

[0037] The BMC reads the configuration information of the first configuration item, and when determining to encrypt the log file of the baseboard management controller based on the configuration information of the first configuration item, transmits the encrypted log file to the security server for storage based on the address of the security server indicated by the configuration information of the second configuration item.

[0038] For example, in this embodiment, the second configuration item may be RemoteTarget: remote security server address.

[0039] Through the above steps, when the baseboard management controller is started, the configuration information of the first configuration item is read, wherein the first configuration item is used to indicate whether to encrypt the log file of the baseboard management controller; when it is determined based on the configuration information of the first configuration item that the log file of the baseboard management controller is to be encrypted, the log file of the baseboard management controller is encrypted to obtain an encrypted log file; the encrypted log file is transmitted to a secure server for storage, wherein the address of the secure server is indicated by the configuration information of the second configuration item, thereby solving the problem of low security of the log file storage method in the related art.

[0040] In an exemplary embodiment, when it is determined based on the configuration information of the first configuration item that the log file of the baseboard management controller is to be encrypted, encrypting the log file of the baseboard management controller to obtain an encrypted log file includes:

[0041] S11, when it is determined based on the configuration information of the first configuration item that the log file of the baseboard management controller is to be encrypted, the log file under the first storage path is encrypted to obtain an encrypted log file, wherein the first storage path is the storage path of the log file of the baseboard management controller.

[0042] Considering that different types of log files have different file system paths, in this embodiment, in order to encrypt the BMC log files, the log files in the first storage path may be encrypted.

[0043] Here, the first storage path is a storage path of a log file of the baseboard management controller.

[0044] Optionally, in this embodiment, the first storage path may be configured based on a setting of the BMC or a configuration item (eg, the third configuration item) in the configuration file.

[0045] For example, in this embodiment, the path for BMC storage logs is / var / lib / log / . When it is determined based on the configuration information of the first configuration item that the log file of the baseboard management controller is to be encrypted, the log file under / var / lib / log / can be encrypted to obtain an encrypted log file.

[0046] Through this embodiment, by encrypting the log file at the designated location, the security of the BMC log can be improved.

[0047] In an exemplary embodiment, when it is determined based on the configuration information of the first configuration item that the log file of the baseboard management controller is to be encrypted, encrypting the log file of the baseboard management controller to obtain an encrypted log file includes:

[0048] S21 , when it is determined based on the configuration information of the first configuration item that the log file of the baseboard management controller is to be encrypted, encrypt the log file of a specified type of the baseboard management controller to obtain an encrypted log file.

[0049] Considering that different types of BMC log files record different log contents, in this embodiment, in order to avoid a large number of system resources being called upon due to full encryption of BMC log files, only the log files of specified types of BMC can be encrypted.

[0050] Here, the specified type of log file may include, but is not limited to, BMC log files containing sensitive information, such as security logs, which may contain user names, IP addresses, and details of login attempts; and configuration logs, which may contain sensitive configuration parameters such as login credentials for management interfaces or network settings.

[0051] In the case where it is determined based on the configuration information of the first configuration item that the log file of the baseboard management controller is to be encrypted, the security log file may be encrypted to obtain an encrypted log file.

[0052] Through this embodiment, by encrypting the log files of a specified type, the amount of encrypted log file data can be reduced, thereby improving the utilization rate of system resources.

[0053] In an exemplary embodiment, transmitting the encrypted log file to a secure server for storage includes:

[0054] S31: Transmit the encrypted log file to a secure server for storage through a designated log service, where the designated log service is an rsyslog service.

[0055] In this embodiment, a log service may be used to transmit the encrypted log file to a secure server for storage.

[0056] Here, the specified log service can be the rsyslog service, which is a log management tool primarily used for Unix and similar systems. The rsyslog service is an open source system log service used to receive, forward, process, and record system log messages.

[0057] For example, in this embodiment, combined with Figure 3By configuring rsyslog on the BMC and server, the rsyslog service encrypts the BMC log files and transmits them to the remote security server (remote), and stores the encrypted files on the security server.

[0058] Optionally, in this embodiment, the remote forwarding capability of the rsyslog service can be utilized to complete plain text format forwarding. The rsyslog service can support multiple log formats and transmission protocols. Here, the plain text format (Plain Text Format) is a simple text format that usually does not contain any special characters or encodings and is easy to read and process. In log management, this format helps to simplify log analysis and processing.

[0059] Optionally, in this embodiment, in order to implement remote forwarding of the rsyslog service, it is necessary to set corresponding rules and parameters in the configuration file of the rsyslog service (e.g., located at / etc / rsyslog.conf`). For example, the source of the log (i.e., the log file under the first storage path), the address of the security server, etc. can be specified.

[0060] When configuring the rsyslog service for remote forwarding, you can use TLS / SSL encrypted transmission to protect the security and integrity of log data during transmission.

[0061] Through this embodiment, the encrypted log file is transmitted to the security server for storage through the rsyslog service, which can improve the configurability and security of the BMC log file transmission process.

[0062] In an exemplary embodiment, before transmitting the encrypted log file to the secure server for storage through the designated log service, the method further includes:

[0063] S41, receiving a copy of a designated certificate authority (CA) certificate and a server public key from a security server, wherein the server public key is a public key in an asymmetric key pair assigned by the security server, and the designated CA certificate is a CA certificate applied for by the security server;

[0064] S42, verifying the legitimacy of the designated CA certificate to obtain a legitimacy verification result of the designated CA certificate;

[0065] S43, if the legitimacy verification result indicates that the legitimacy verification of the designated CA certificate has passed, save the designated CA certificate and the server public key;

[0066] S44, generating a random number, encrypting the random number using the server public key to obtain an asymmetrically encrypted random number, and transmitting the asymmetrically encrypted random number to the security server;

[0067] S45. Upon receiving the symmetric encrypted data sent by the security server, decrypt the symmetric encrypted data using the random number to obtain a first interaction message and a first hash value corresponding to the first interaction message. The symmetric encrypted data is obtained by the security server decrypting the asymmetrically encrypted random number using the private key corresponding to the server's public key to obtain the random number. The random number is then used as a symmetric encryption key to encrypt the second interaction message and the second hash value corresponding to the second interaction message.

[0068] S46 , when the first hash value is the same as the second hash value, configure a designated log service for the baseboard management controller, and restart the configured designated log service.

[0069] The client receives a copy of the certificate authority (CA) certificate and the server's public key from the server, allowing the client to verify the server's identity and prevent man-in-the-middle attacks. The client verifies the legitimacy of the CA certificate to ensure that the CA certificate is issued by a trusted certificate authority and avoids the use of forged CA certificates. If the CA certificate passes the legitimacy check, the client saves the CA certificate and the server's public key so that it can use the server's public key for encryption and verification in subsequent communications.

[0070] The client generates a random number and encrypts it with the server's public key to obtain an asymmetric encrypted random number. In other words, a key known only to the client and server is generated for subsequent communication encryption.

[0071] In order for the server to use the same key as the random number generated by the client for communication encryption, the client transmits the asymmetrically encrypted random number to the server. After receiving the asymmetrically encrypted random number, the server uses the private key corresponding to the server's public key to decrypt it and obtain the random number. The server then obtains the key generated by the client.

[0072] The server uses a random number as a symmetric encryption key to encrypt the second interaction message and the second hash value corresponding to the second interaction message to obtain symmetric encrypted data. The server sends the symmetric encrypted data to the client, and the client can use the random number to decrypt it to obtain the second interaction message and the second hash value.

[0073] After receiving the symmetrically encrypted data, the client uses a random number to decrypt it and obtain a first interaction message and a first hash value corresponding to the first interaction message. Based on this, the client can obtain the message and hash value sent by the server.

[0074] The client compares the first hash value and the second hash value. If they are the same, it means that the communication process has not been tampered with, and the security of the communication can be ensured.

[0075] To ensure the security of log collection and transmission on the client, when the first hash value and the second hash value are the same, the client configures the rsyslog log service for the client and restarts the configured rsyslog log service.

[0076] In this embodiment, both symmetric and asymmetric encryption are used to balance security and efficiency. Data is transmitted using symmetrical encryption. The symmetric encryption process requires a client-side key. To ensure secure transmission of this key to the server, asymmetric encryption is used to encrypt the key. In general, data is symmetrically encrypted, and the key used for symmetric encryption is transmitted using asymmetric encryption. The server's public and private keys are used for asymmetric encryption, while the client-generated random key is used for symmetric encryption.

[0077] That is, in this embodiment, before data transmission, a handshake is required between the client (i.e., BMC) and the server (i.e., security server). During the handshake, the password information for encrypting the transmitted data is established. The specific steps of the handshake process are as follows:

[0078] Step 1: The client sends a set of encryption rules it supports to the server.

[0079] In step 2, the server selects a set of encryption and hash algorithms and sends its identity information back to the client in the form of a certificate. The certificate contains information such as the server address, encryption public key, and the issuing authority of the certificate.

[0080] Step 3: After the client obtains the server certificate, it needs to do the following:

[0081] a) Verify the legitimacy of the certificate (whether the institution that issued the certificate is legal, whether the server address contained in the certificate is consistent with the address being accessed, etc.).

[0082] b) If the certificate is trusted, or if the user accepts an untrusted certificate, the client generates a random password and encrypts it with the public key provided in the certificate.

[0083] c) Use the agreed HASH algorithm to calculate the handshake message, encrypt the message with the generated random number, and finally send all the previously generated information to the server.

[0084] Step 4: After receiving the data from the client, the server performs the following operations:

[0085] a) Use your own private key to decrypt the information and obtain the password, use the password to decrypt the handshake message sent by the client, and verify whether the HASH is consistent with the one sent by the client.

[0086] b) Use the password to encrypt a handshake message and send it to the client.

[0087] Step 5: The client decrypts and calculates the HASH of the handshake message. If it is consistent with the HASH sent by the server, the handshake process ends and all subsequent communication data will be encrypted using the random password generated by the client using the symmetric encryption algorithm.

[0088] Optionally, in this embodiment, the private key of the CA certificate and the action of generating the CA certificate based on the CA private key can be implemented through the certtool tool. Certtool is a tool provided by the GnuTLS library of linu×. GnuTLS is a secure communication library that implements SSL, TLS and DTLS protocols and related technologies.

[0089] The process of transmitting logs via TLS (SSL) encryption is as follows:

[0090] a. Set up a CA certificate;

[0091] Generate a private key for the CA certificate: The certtool parameter indicates that the certtool application is called, the --generate-privkey parameter indicates that this command generates a private key, and the file name specified after the --outfile parameter indicates the file name of the private key output by this command.

[0092] certtool--generate-privkey--outfile ca-key.pem;

[0093] Generate a self-signed CA certificate based on the private key of the CA certificate: The --generate-self-signed parameter indicates that this command generates a self-signed certificate. The --load-privkey parameter indicates that the ca-key.pem file that follows it will be read, and then the private key of ca-key.pem will be output.

[0094] certtool--generate-self-signed--load-privkey ca-key.pem--outfileca.pem;

[0095] The CA certificate is set up on the server. ca-key.pem is on the server and must be kept strictly confidential. It is the source of all trust chains. Copies of ca.pem are distributed to all clients, so that rsyslog on the server knows that it can trust clients that have copies of the certificate.

[0096] b. Generate certificates for the server and client;

[0097] Generate a 2048-bit RSA private key: The --bits parameter indicates that an RSA private key of the corresponding size is generated according to the number of bits that follows;

[0098] certtool--generate-privkey--outfile key.pem--bits 2048;

[0099] Generate a certificate request in PKCS#10 format based on the private key:

[0100] certtool--generate-request--load-privkey key.pem--outfilerequest.pem;

[0101] Generate a signed certificate: This means reading request.pem, ca.pem, and ca-key.pem to produce cert.pem.

[0102] certtool--generate-certificate--load-request request.pem--outfilecert.pem;

[0103] --load-ca-certificate ca.pem --load-ca-privkey ca-key.pem;

[0104] Based on this, you can obtain the generated ca.pem, which is a CA certificate. It can be used to verify the key and certificate on the logging server and client. cert.pem is the public key, and key.pem is the private key. At this point, the private key, public key, and certificate required for encrypted transmission have been generated. The next step is to configure rsyslog on the client and server. The client is the BMC, and the server is the remote security server.

[0105] Phase 1: Set up CA; generate a self-signed CA certificate and protect CA-key.pem;

[0106] Phase 2, identifying machines through certificates: CA copies CA's certificate to each machine; each machine generates a certificate request and sends it to CA; CA signs the certificate and sends it back to each machine CA. Phase 2 corresponds to Figure 4 shown.

[0107] It should be noted that the configuration of the server and client is only to set some parameters for the interaction between the two parties.

[0108] Through this embodiment, the communication security between the client and the server can be ensured, and man-in-the-middle attacks and data tampering can be prevented.

[0109] In an exemplary embodiment, when the first hash value and the second hash value are the same, configuring a designated log service for the baseboard management controller and restarting the configured designated log service include:

[0110] S51, when the first hash value and the second hash value are the same, creating a configuration file for the specified log service in a specified file directory to obtain a target configuration file;

[0111] S52: Add a set of configuration items for the specified log service in the target configuration file to configure the specified log service, and restart the configured specified log service, wherein the set of configuration items includes at least one of the following: a copy of a specified CA certificate, a server public key, and a random number.

[0112] Optionally, in this embodiment, set the server-side rsyslog configuration:

[0113] Create a new file in the server / etc / rsyslog.d / directory, for example tlS_server.conf.

[0114] To encrypt communications, the configuration file must contain the path to the server's certificate file, the selected authentication method, and a stream driver that supports TLS encryption. The configuration in the tls_server.conf file is as follows:

[0115] #Set certificate files;

[0116] global( / / Set global variables. The NetstreamDriver here is the same as the StreamDriver.Name below, which is the encrypted stream driver used. For example, ossl is used in this embodiment, and gtls can also be used. ossl and gtls are two different drivers.

[0117] DefaultNetstreamDriverCAFile = "ca.pem" / / Set the path of the default NetstreamDriver server root certificate;

[0118] DefaultNetstreamDriverCertFile = "cert.pem" / / Set the path of the default NetstreamDriver public key;

[0119] DefaultNetstreamDriverKeyFile = "key.pem" / / Set the path of the default NetstreamDriver private key; )

[0121] #TCP listener

[0122] module(

[0123] load=″imtcp″

[0124] StreamDriver.AuthMode = "x509 / name" / / Set the mutual authentication mode between the server and the client;

[0125] StreamDriver.Mode = "1" / / Setting the mode to 1 means that the driver runs in TLS-only mode, that is, only runs TLS encryption.

[0126] StreamDriver.Name = "ossl" / / Indicates that the encrypted stream driver used is rsyslog-openssl )

[0128] #Establish a listener for port 514, with the transmission type being TCP

[0129] input(

[0130] type="imtcp"

[0131] port="514" / / According to rsyslog regulations, TCP monitoring is done through port 514 )

[0133] Optionally, in this example, set the client rsyslog configuration:

[0134] Create a new client configuration file, such as tls_client.conf, in the / etc / rsyslog.d directory on the client. Add the following configuration to tls_client.conf:

[0135] #Set certificate files

[0136] global(

[0137] DefaultNetstreamDriverCAFile="ca.pem"

[0138] DefaultNetstreamDriverCertFile="cert.pem"

[0139] DefaultNetstreamDriverKeyFile="key.pem" )

[0141] #Set up the action for all messages

[0142] *.*action(

[0143] type="omfwd"

[0144] StreamDriver = "ossl"

[0145] StreamDriverMode="1"

[0146] StreamDriverAuthMode="x509 / name"

[0147] target="server.example.com" port="514" protocol="tcp" )

[0149] Optionally, in this embodiment, after the configuration is complete, restart the rsyslog service on the client and server:

[0150] systemctl restart rsyslog

[0151] In an exemplary embodiment, when the baseboard management controller is started, after reading the configuration information of the first configuration item, the method further includes:

[0152] S61, when it is determined based on the configuration information of the first configuration item that the log file of the baseboard management controller is not to be encrypted, the log file of the baseboard management controller is stored in a second storage path, wherein the second storage path is a storage path of the log file of the baseboard management controller.

[0153] The storage path of the BMC log file varies depending on the hardware manufacturer and BMC software. In this embodiment, the storage path of the BMC log file can be determined by, but is not limited to, following the steps below:

[0154] Step 1: Check the documentation or user manual of the BMC device to learn about the default settings of the log file storage path.

[0155] Step 2: Log in to the BMC. Use a browser or other remote management tool to log in to the BMC web interface or command line interface.

[0156] Step 3: Find the log settings. In the BMC settings or configuration options, find the settings related to log files, including the log file storage location, log level, and log rotation policy.

[0157] Step 4: Determine the storage path. According to the BMC settings and configurations, determine the storage path for the log file. Optionally, the second storage path can be a file system path, such as / var / log / bmc.log, or a network storage path, such as \\\\10.0.0.1\\logs\bmc.log.

[0158] Step 5: Adjust settings (if necessary) in the BMC settings to change the log file storage path. Note that changing the storage path may require reconfiguring the BMC or restarting the BMC service.

[0159] Step 6: Verify the changes. After changing the log file storage path, check whether the BMC is recording logs normally and ensure that the log files are saved in the new location.

[0160] Optionally, in this embodiment, to ensure the security of the BMC log, access to the log may be restricted, and the log may be reviewed regularly to identify potential security issues.

[0161] As an optional exemplary embodiment, a log file is taken as a BMC log file as an example to explain the storage method of the log file.

[0162] This application proposes a configurable protection mode that encrypts logs upon BMC startup and transmits them to a secure server for protection. This mode provides a security solution for log system security vulnerabilities, complementing and enhancing conventional security protection methods and improving the overall security and stability of the BMC system.

[0163] When the BMC starts, it performs two-way encryption authentication on the logs and forwards the logs to a secure server for storage.

[0164] The log file storage system used to implement the log file storage method includes three main modules: log configuration module, log encryption module, and log storage module. The log configuration module and log encryption module are implemented in the local BMC, and the log storage module is implemented in the remote security server. The interaction between the modules is as follows: Figure 5 shown.

[0165] Among them, the log configuration module saves the configuration information and chooses whether to notify the log encryption module to perform log encryption transmission according to the configuration; the log encryption module receives the log configuration and transmits the log encryption to the remote target server according to the configuration information; the log storage module receives the encrypted log and saves it in the security server.

[0166] Specifically, 1) Log configuration module:

[0167] The log configuration module provides the following configuration interface:

[0168] {

[0169] Encryption: whether to enable encrypted transmission (true / false),

[0170] RemoteTarget: remote security server address

[0171] }

[0172] After the BMC starts, it will read the configuration. If Encryption is true, the log configuration module will send the configuration information to the log encryption module, triggering the next step.

[0173] 2) Log encryption module:

[0174] The log encryption module receives the log configuration, leverages rsyslog's remote forwarding capabilities to forward the logs in plain text format, and encrypts the logs using TLS. The advantage of this solution is that the logs are encrypted during transmission, and the sender authenticates the receiver, so the receiver knows who is communicating with it. The receiver also authenticates the sender, so the sender can verify that the logs were sent to the intended address. This mutual authentication method is highly secure and can prevent man-in-the-middle attacks.

[0175] The above secure encryption and authentication are implemented based on public / private key security. Therefore, the private key must be securely protected. If the private key is known to a third-party system, security cannot be guaranteed. In addition, secure encryption must be based on x509 certificates and a very limited trust chain.

[0176] 3) Log storage module:

[0177] The log storage module is implemented on a remote security server. The security server receives encrypted logs forwarded through rsyslog and then stores them. Since the security server has stronger security protection capabilities in hardware and software, log security is further guaranteed.

[0178] Specifically, combined Figure 6 The BMC log security protection method can include the following steps:

[0179] Step 1: Read the log encryption configuration after BMC starts;

[0180] Step 2: Determine whether to encrypt based on the configuration information;

[0181] Step 3: If encryption is confirmed, execute rsyslog to encrypt and forward the logs; the remote server receives and stores the logs;

[0182] Step 4: If encryption is not required, store the log in a non-encrypted state.

[0183] It should be noted that any modifications and changes made without departing from the spirit and scope of this application, especially the two-way encryption authentication when the BMC is started and the storage of logs on the remote security server, are within the scope of protection of this application.

[0184] Through the description of the above implementation methods, those skilled in the art can clearly understand that the method according to the above embodiment can be implemented by means of software plus the necessary general hardware platform, and of course it can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes a number of instructions for enabling a terminal device (which can be a mobile phone, computer, server, or network device, etc.) to execute the methods of each embodiment of the present application.

[0185] According to another aspect of the embodiments of the present application, a log file storage device is also provided, which is used to implement the log file storage method provided in the above embodiments. The details that have been described will not be repeated here. As used below, the term "module" may refer to a combination of software and / or hardware that implements a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, implementation using hardware, or a combination of software and hardware, is also possible and contemplated.

[0186] Figure 7 This is a structural block diagram of a log file storage device provided by an embodiment of the present application, such as Figure 7 As shown, the device includes:

[0187] The reading unit 702 is configured to read configuration information of a first configuration item when the baseboard management controller is started, wherein the first configuration item is used to indicate whether to encrypt a log file of the baseboard management controller;

[0188] The processing unit 704 is configured to encrypt the log file of the baseboard management controller to obtain an encrypted log file when it is determined based on the configuration information of the first configuration item that the log file of the baseboard management controller is to be encrypted.

[0189] The transmission unit 706 is configured to transmit the encrypted log file to a security server for storage, wherein the address of the security server is indicated by the configuration information of the second configuration item.

[0190] It should be noted that the reading unit 702 in this embodiment can be used to execute the above step S202, the processing unit 704 in this embodiment can be used to execute the above step S204, and the transmission unit 706 in this embodiment can be used to execute the above step S206.

[0191] Through the embodiments of the present application, when the baseboard management controller is started, the configuration information of the first configuration item is read, wherein the first configuration item is used to indicate whether to encrypt the log file of the baseboard management controller; when it is determined based on the configuration information of the first configuration item that the log file of the baseboard management controller is to be encrypted, the log file of the baseboard management controller is encrypted to obtain an encrypted log file; the encrypted log file is transmitted to a security server for storage, wherein the address of the security server is indicated by the configuration information of the second configuration item, thereby solving the problem of low security of the log file storage method in the related art.

[0192] In an exemplary embodiment, the processing unit includes:

[0193] The first processing module is used to encrypt the log file under the first storage path to obtain an encrypted log file when it is determined based on the configuration information of the first configuration item that the log file of the baseboard management controller is encrypted, wherein the first storage path is the storage path of the log file of the baseboard management controller.

[0194] In an exemplary embodiment, the processing unit includes:

[0195] The second processing module is configured to encrypt a log file of a specified type of the baseboard management controller to obtain an encrypted log file when it is determined based on the configuration information of the first configuration item that the log file of the baseboard management controller is to be encrypted.

[0196] In an exemplary embodiment, a transmission unit includes:

[0197] The transmission module is used to transmit the encrypted log files to the security server for storage through the designated log service, where the designated log service is the rsyslog service.

[0198] In an exemplary embodiment, the apparatus further comprises:

[0199] a receiving unit, configured to receive a copy of a designated certificate authority (CA) certificate and a server public key from a security server before transmitting the encrypted log file to the security server for storage through the designated log service, wherein the server public key is a public key in an asymmetric key pair assigned by the security server, and the designated CA certificate is a CA certificate applied for by the security server;

[0200] The verification unit is used to verify the legitimacy of the specified CA certificate and obtain the legitimacy verification result of the specified CA certificate;

[0201] a storage unit, configured to store the designated CA certificate and the server public key when the legitimacy verification result indicates that the legitimacy verification of the designated CA certificate has passed;

[0202] an execution unit, configured to generate a random number, encrypt the random number using a server public key to obtain an asymmetrically encrypted random number, and transmit the asymmetrically encrypted random number to a secure server;

[0203] a decryption unit configured to, upon receiving symmetrically encrypted data sent by the security server, decrypt the symmetrically encrypted data using a random number to obtain a first interaction message and a first hash value corresponding to the first interaction message, wherein the symmetrically encrypted data is obtained by the security server decrypting an asymmetrically encrypted random number using a private key corresponding to the server's public key to obtain the random number, and then encrypting a second interaction message and a second hash value corresponding to the second interaction message using the random number as a symmetrical encryption key;

[0204] The configuration unit is configured to configure a designated log service for the baseboard management controller and restart the configured designated log service when the first hash value is the same as the second hash value.

[0205] In an exemplary embodiment, the configuration unit includes:

[0206] A creation module is used to create a configuration file for a specified log service in a specified file directory when the first hash value and the second hash value are the same, and obtain a target configuration file;

[0207] The execution module is configured to add a set of configuration items for the specified log service in the target configuration file to configure the specified log service and restart the configured specified log service, wherein the set of configuration items includes at least one of the following: a copy of the specified CA certificate, a server public key, and a random number.

[0208] In an exemplary embodiment, the apparatus further comprises:

[0209] A storage unit is used to, when the baseboard management controller is started, read the configuration information of the first configuration item, and then, if it is determined based on the configuration information of the first configuration item that the log file of the baseboard management controller is not to be encrypted, store the log file of the baseboard management controller in a second storage path, wherein the second storage path is the storage path of the log file of the baseboard management controller.

[0210] An embodiment of the present application further provides a computer program product, which includes a computer program. When the computer program is executed by a processor, the steps in any of the above method embodiments are implemented.

[0211] An embodiment of the present application further provides another computer program product, including a non-volatile computer-readable storage medium, wherein the non-volatile computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of any of the above method embodiments are implemented.

[0212] An embodiment of the present application also provides a computer program, which includes computer instructions, which are stored in a computer-readable storage medium; a processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device performs the steps of any of the above method embodiments.

[0213] An embodiment of the present application further provides a computer-readable storage medium, in which a computer program is stored. The computer program is configured to execute the steps of any of the above method embodiments when run.

[0214] In an exemplary embodiment, the computer-readable storage medium may include, but is not limited to, various media that can store computer programs, such as a USB flash drive, a ROM (Read-Only Memory), a RAM (Random Access Memory), a mobile hard disk, a magnetic disk, or an optical disk.

[0215] An embodiment of the present application further provides an electronic device, comprising a memory and a processor, wherein the memory stores a computer program, and the processor is configured to run the computer program to execute the steps in any one of the above method embodiments.

[0216] In an exemplary embodiment, the electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the processor, and the input / output device is connected to the processor.

[0217] For specific examples in this embodiment, reference may be made to the examples described in the above embodiments and exemplary implementation modes, and this embodiment will not be described in detail here.

[0218] Obviously, those skilled in the art should understand that the modules or steps of the present application described above can be implemented using a general-purpose computing device, they can be concentrated on a single computing device, or distributed across a network composed of multiple computing devices, they can be implemented using program code executable by the computing device, and thus, they can be stored in a storage device and executed by the computing device, and in some cases, the steps shown or described can be performed in a different order than herein, or they can be fabricated into separate integrated circuit modules, or multiple modules or steps can be fabricated into a single integrated circuit module for implementation. Thus, the present application is not limited to any specific combination of hardware and software.

[0219] The above are only preferred embodiments of the present application and are not intended to limit the present application. For those skilled in the art, various modifications and variations of the present application are possible. Any modifications, equivalent substitutions, improvements, etc. made within the principles of the present application shall be included in the scope of protection of the present application.

Claims

1. A method for storing log files, characterized in that: include: When the baseboard management controller is started, read configuration information of a first configuration item, wherein the first configuration item is used to indicate whether to encrypt a log file of the baseboard management controller; In a case where it is determined based on the configuration information of the first configuration item that the log file of the baseboard management controller is to be encrypted, encrypting the log file of the baseboard management controller to obtain an encrypted log file; The encrypted log file is transmitted to a security server for storage, wherein the address of the security server is indicated by the configuration information of the second configuration item.

2. The method according to claim 1, characterized in that In the case where it is determined based on the configuration information of the first configuration item that the log file of the baseboard management controller is to be encrypted, encrypting the log file of the baseboard management controller to obtain an encrypted log file includes: When it is determined based on the configuration information of the first configuration item that the log file of the baseboard management controller is to be encrypted, the log file under the first storage path is encrypted to obtain the encrypted log file, wherein the first storage path is the storage path of the log file of the baseboard management controller.

3. The method according to claim 1, characterized in that In the case where it is determined based on the configuration information of the first configuration item that the log file of the baseboard management controller is to be encrypted, encrypting the log file of the baseboard management controller to obtain an encrypted log file includes: In the case where it is determined based on the configuration information of the first configuration item that the log file of the baseboard management controller is to be encrypted, the log file of a specified type of the baseboard management controller is encrypted to obtain the encrypted log file.

4. The method according to claim 1, characterized in that: The step of transmitting the encrypted log file to a secure server for storage includes: The encrypted log file is transmitted to the security server for storage through a designated log service, wherein the designated log service is an rsyslog service.

5. The method according to claim 4, characterized in that Before transmitting the encrypted log file to the secure server for storage through the designated log service, the method further includes: Receiving a copy of a designated certificate authority CA certificate and a server public key sent by the security server, wherein the server public key is a public key in an asymmetric key pair allocated by the security server, and the designated CA certificate is a CA certificate applied for by the security server; Verify the legitimacy of the designated CA certificate to obtain a legitimacy verification result of the designated CA certificate; If the legitimacy check result indicates that the legitimacy check of the designated CA certificate has passed, save the designated CA certificate and the server public key; Generate a random number, encrypt the random number using the server public key to obtain an asymmetrically encrypted random number, and transmit the asymmetrically encrypted random number to the security server; upon receiving the symmetric encrypted data sent by the security server, decrypting the symmetric encrypted data using the random number to obtain a first interaction message and a first hash value corresponding to the first interaction message, wherein the symmetric encrypted data is obtained by the security server decrypting the asymmetric encrypted random number using the private key corresponding to the server public key to obtain the random number, and then encrypting the second interaction message and the second hash value corresponding to the second interaction message using the random number as a symmetric encryption key; When the first hash value is the same as the second hash value, the designated log service is configured for the baseboard management controller, and the configured designated log service is restarted.

6. The method according to claim 5, characterized in that When the first hash value is the same as the second hash value, configuring the designated log service for the baseboard management controller and restarting the configured designated log service includes: When the first Hash value is the same as the second Hash value, creating a configuration file for the specified log service in a specified file directory to obtain a target configuration file; A set of configuration items is added for the designated log service in the target configuration file to configure the designated log service, and the configured designated log service is restarted, wherein the set of configuration items includes at least one of the following: a copy of the designated CA certificate, the server public key, and the random number.

7. The method according to any one of claims 1 to 6, characterized in that In the case where the baseboard management controller is started, after reading the configuration information of the first configuration item, the method further includes: When it is determined not to encrypt the log file of the baseboard management controller based on the configuration information of the first configuration item, the log file of the baseboard management controller is stored in a second storage path, wherein the second storage path is the storage path of the log file of the baseboard management controller.

8. A storage device for log files, characterized in that: include: A reading unit, used for reading configuration information of a first configuration item when the baseboard management controller is started, wherein the first configuration item is used to indicate whether to encrypt a log file of the baseboard management controller; a processing unit, configured to encrypt the log file of the baseboard management controller to obtain an encrypted log file when it is determined based on the configuration information of the first configuration item that the log file of the baseboard management controller is to be encrypted; A transmission unit is used to transmit the encrypted log file to a security server for storage, wherein the address of the security server is indicated by the configuration information of the second configuration item.

9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, wherein the computer program implements the steps of the method according to any one of claims 1 to 7 when executed by a processor.

10. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 7 are implemented.

Citation Information

Patent Citations

  • SSD internal log encoding and decoding method and device, computer equipment and storage medium

    CN111897497A

  • Method and system for collecting and verifying BMC log integrity

    CN112463516A

  • Log collection system, server for use in log collection system and medium recorded with server control program

    JP2002297540A

Cited By

  • Configuration file processing method, device and equipment and computer readable storage medium

    CN120429007A