Operating system authorization control method, device, electronic device, storage medium and program product
By correcting the custom variable directory path, the authentication problem in the hybrid image-software package mechanism operating system is solved, simple and efficient authorization control is realized, and the consumption of computing resources is reduced.
Patent Information
- Application Number
- CN202410893429.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-04
- Publication Date
- 2024-09-03
- Estimated Expiration
- 2044-07-04
AI Technical Summary
In operating systems that use a hybrid image-software package mechanism, authentication in authorization control cannot be easily implemented, resulting in increased consumption of computing resources.
By correcting the custom variable directory path and removing the part of the specified directory, ensure that the YUM library can successfully read the custom identity variable and add it to the request message for authentication.
It achieves simple and efficient identity verification, reduces computing resource consumption, and ensures efficient authorization management and control.
Smart Images

Figure CN118427162B
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of computers, and in particular to an authorization management method, device, electronic device, storage medium, and program product for an operating system. Background Art
[0002] The authorization control of the operating system mainly includes the control of software installation / upgrade behavior and operating system version update behavior. After the operating system authorization is activated, users can install / upgrade software for the operating system and update the operating system version through the official server.
[0003] For operating systems that use the RPM (RPM Package Manager, originally named Red Hat Package Manager, now a recursive abbreviation, an open source software package management system that can install, uninstall, verify, query, and update software packages packaged in RPM format) package management system, the operating system consists of RPM packages. For such operating systems, the operating system version update is completed by updating all RPM packages installed in the operating system, that is, the operating system version update can be divided into a series of RPM package updates. For such operating systems, the control of software installation / upgrade behavior and operating system version update behavior only requires the control of software package installation / upgrade behavior to achieve the purpose of controlling the above two behaviors. Users can use the YUM (Yellow-Dog Updater Modified, used to improve the package management of RPM software package installation) / DNF (Dandified YUM, the next generation version of YUM) components to implement authorization control. Specifically, the RPM software package can be pulled for installation / upgrade through the YUM repository located on the remote HTTP server, and the username and password used for HTTP Basic authentication can be dynamically modified by configuring the YUM custom identity variable for the YUM repository. When the YUM / DNF component sends a request message to the remote HTTP server, it can read the value of the YUM custom identity variable from the YUM custom variable directory and then add it to the request message for the remote HTTP server to perform Basic authentication. At this time, since the YUM custom variable directory is fixedly stored in the system root directory, the YUM / DNF component can successfully find the directory and read the YUM custom identity variable in it.
[0004] However, in an operating system using a hybrid image-package mechanism represented by rpm-ostree (an open source system that uses a hybrid image / package mechanism, combining the features of RPM and OSTree (an open source system for updating Linux distribution operating systems), providing RPM-based software package installation management on the one hand, and OSTree-based operating system version updates on the other hand), the operating system is based on an image, and the operating system version is updated through the OSTree warehouse, and the software package is installed / upgraded through the YUM warehouse. Its authorization control is implemented by the rpm-ostree component, and the same control method is used for the operating system version and the software package. It does not have the ability to normally parse the YUM custom identity variable, and cannot imitate the RPM mechanism to implement Basic identity authentication by adding the value of the YUM custom identity variable in the request message. Instead, other more complex methods need to be used, resulting in more computing resource consumption. Summary of the invention
[0005] The present disclosure provides an authorization management method, device, electronic device, storage medium and program product for an operating system, so as to at least solve the problem of how to easily implement identity authentication in authorization management in related technologies.
[0006] According to a first aspect of an embodiment of the present disclosure, there is provided an authorization management method for an operating system, the authorization management method comprising: setting the identity authentication information of a target data warehouse as a custom identity variable, wherein the custom identity variable is stored in a custom variable directory, and the custom variable directory is a subdirectory under a specified directory; obtaining a first directory path, wherein the first directory path is used to describe the location of the custom variable directory in a file system; correcting the first directory path to remove a portion of the first directory path corresponding to a second directory path to obtain a corrected first directory path, wherein the second directory path is used to describe the location of the specified directory in the file system; reading the value of the custom identity variable under the specified directory according to the corrected first directory path; and sending a target request to a server of the target data warehouse, wherein the target request includes the value of the custom identity variable for the server to perform identity authentication.
[0007] Optionally, the first directory path is modified to remove the portion of the first directory path corresponding to the second directory path to obtain a modified first directory path, including: obtaining the second directory path; deleting the portion of the first directory path that repeats with the second directory path to obtain the modified first directory path.
[0008] Optionally, the method of deleting the portion that is repeated with the second directory path from the first directory path to obtain the revised first directory path includes: counting the number of path layers contained in the second directory path; and deleting the directory paths of the corresponding number of front layers from the first directory path according to the number of path layers to obtain the revised first directory path.
[0009] Optionally, the first directory path is modified to remove the portion of the first directory path corresponding to the second directory path to obtain a modified first directory path, including: in the case of a default custom directory path, using the default custom directory path as the modified first directory path, wherein the concatenation of the second directory path and the default custom directory path is the same as the first directory path.
[0010] Optionally, the modifying the first directory path to remove the portion of the first directory path corresponding to the second directory path to obtain a modified first directory path includes: in a case where it is determined that the designated directory is not a system root directory, modifying the first directory path to remove the portion of the first directory path corresponding to the second directory path to obtain the modified first directory path.
[0011] Optionally, the step of modifying the first directory path to remove the portion of the first directory path corresponding to the second directory path to obtain a modified first directory path further includes: in a case where it is determined that the designated directory is the system root directory, using the first directory path as the modified first directory path.
[0012] Optionally, the target data warehouse includes at least one of the following warehouses: a software package warehouse, an operating system image warehouse.
[0013] According to a second aspect of an embodiment of the present disclosure, an authorization control device of an operating system is provided, the authorization control device comprising: a setting unit, configured to set the identity authentication information of a target data warehouse as a custom identity variable, wherein the custom identity variable is stored in a custom variable directory, and the custom variable directory is a subdirectory under a specified directory; an acquisition unit, configured to acquire a first directory path, wherein the first directory path is used to describe the location of the custom variable directory in a file system; a correction unit, configured to correct the first directory path to remove a portion of the first directory path corresponding to a second directory path to obtain a corrected first directory path, wherein the second directory path is used to describe the location of the specified directory in a file system; a reading unit, configured to read the value of the custom identity variable in the specified directory according to the corrected first directory path; a request unit, configured to send a target request to a server of the target data warehouse, wherein the target request includes the value of the custom identity variable for the server to perform identity authentication.
[0014] Optionally, the correction unit is further configured to: obtain the second directory path; and delete the portion that is repeated with the second directory path from the first directory path to obtain the corrected first directory path.
[0015] Optionally, the correction unit is further configured to: count the number of path layers included in the second directory path; and delete the directory paths of the corresponding number of layers from the first directory path according to the number of path layers to obtain the corrected first directory path.
[0016] Optionally, the correction unit is further configured to: in the case of a default custom directory path, use the default custom directory path as the corrected first directory path, wherein a concatenation of the second directory path and the default custom directory path is the same as the first directory path.
[0017] Optionally, the correction unit is further configured to, when it is determined that the designated directory is not a system root directory, correct the first directory path to remove a portion of the first directory path corresponding to the second directory path to obtain the corrected first directory path.
[0018] Optionally, the correction unit is further configured to use the first directory path as the corrected first directory path when it is determined that the designated directory is the system root directory.
[0019] Optionally, the target data warehouse includes at least one of the following warehouses: a software package warehouse, an operating system image warehouse.
[0020] According to a third aspect of an embodiment of the present disclosure, an electronic device is provided, comprising: at least one processor; and at least one memory storing computer executable instructions, wherein the computer executable instructions, when executed by the at least one processor, prompt the at least one processor to execute an authorization management method for an operating system according to an exemplary embodiment of the present disclosure.
[0021] According to a fourth aspect of an embodiment of the present disclosure, a computer-readable storage medium is provided. When instructions in the computer-readable storage medium are executed by at least one processor, the at least one processor is prompted to execute an authorization management method for an operating system according to an exemplary embodiment of the present disclosure.
[0022] According to a fifth aspect of an embodiment of the present disclosure, a computer program product is provided, comprising computer instructions, which, when executed by at least one processor, prompt the at least one processor to execute an authorization management method for an operating system according to an exemplary embodiment of the present disclosure.
[0023] The technical solution provided by the embodiments of the present disclosure brings at least the following beneficial effects:
[0024] According to the authorization management method, device, electronic device, storage medium and program product of the operating system disclosed in the present invention, by correcting the first directory path describing the custom variable directory and removing the part (i.e., the part corresponding to the second directory path) describing the specified directory (i.e., the directory of the current operating system version) where the custom variable directory is located, the custom variable directory can be successfully located under the directory of the current operating system version, thereby reading the value of the custom identity variable and adding it to the target request initiated to the target data warehouse, thereby achieving effective and simple identity authentication, reducing computing resource consumption, and ensuring efficient authorization management.
[0025] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS
[0026] The drawings herein are incorporated into and constitute a part of the specification, illustrate embodiments consistent with the present disclosure, and together with the description are used to explain the principles of the present disclosure, and do not constitute improper limitations on the present disclosure.
[0027] Figure 1 is a flowchart of an authorization management method of an operating system according to an exemplary embodiment of the present disclosure.
[0028] Figure 2 It is a flowchart of an authorization control method for an operating system according to a specific embodiment of the present disclosure.
[0029] Figure 3is a block diagram of an authorization control apparatus for an operating system according to an exemplary embodiment of the present disclosure.
[0030] Figure 4 is a block diagram of an electronic device according to an exemplary embodiment of the present disclosure. DETAILED DESCRIPTION
[0031] In order to enable ordinary persons in the art to better understand the technical solutions of the present disclosure, the technical solutions in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the accompanying drawings.
[0032] It should be noted that the terms "first", "second", etc. in the specification and claims of the present disclosure and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present disclosure described herein can be implemented in an order other than those illustrated or described herein. The implementation methods described in the following examples do not represent all implementation methods consistent with the present disclosure. Instead, they are merely examples of devices and methods consistent with some aspects of the present disclosure as detailed in the attached claims.
[0033] It should be noted that the phrase "at least one of the items" in the present disclosure includes three types of parallel situations: "any one of the items", "a combination of any number of the items", and "all of the items". For example, "including at least one of A and B" includes the following three types of parallel situations: (1) including A; (2) including B; (3) including A and B. Another example is "executing at least one of step 1 and step 2" which means the following three types of parallel situations: (1) executing step 1; (2) executing step 2; (3) executing step 1 and step 2.
[0034] Hereinafter, an authorization management method, an apparatus, an electronic device, a storage medium, and a program product for an operating system according to exemplary embodiments of the present disclosure will be described in detail with reference to the accompanying drawings.
[0035] Through a detailed analysis of the operating system using the rpm-ostree mechanism, it can be found that in this type of operating system, each time an operating system version is updated, a new directory will be generated under the system root directory, thereby forming an operating system environment of the corresponding version, so that the system root directory can include multiple subdirectories, and each environment directory has a corresponding YUM library. At this time, in order to achieve the control of different operating system versions, the rpm-ostree component responsible for authorization control obtains the complete directory path starting from the system root directory when obtaining the directory path. At this time, for the Basic authentication of the software package installation / upgrade behavior, if you want to imitate the RPM mechanism and add the value of the YUM custom identity variable in the request message, you need to read the value of the YUM custom identity variable by calling the YUM library. However, the YUM library can only work in the environment of the operating system version in which it is located, and can only read files in the directory of the environment in which it is located. It is for this reason that the YUM library cannot recognize the complete YUM custom variable directory path obtained by the rpm-ostree component, and cannot read the required custom identity variable, so the Basic authentication method cannot be used. In short, the information description (i.e., the YUM custom variable directory path obtained by the rpm-ostree component) does not match the information reading capability (i.e., the YUM library can only read files in its own environment directory).
[0036] Based on this analysis, according to the authorization management method of the operating system of the exemplary embodiment of the present invention, by correcting the first directory path describing the custom variable directory and removing the part describing the specified directory where the custom variable directory is located (that is, the directory of the current operating system version), the YUM library can successfully locate the custom variable directory under the directory of the current operating system version, so that the information description matches the information reading capability, thereby reading the value of the custom identity variable and adding it to the target request initiated to the target data warehouse, thereby realizing effective and simple identity authentication, reducing computing resource consumption, and ensuring efficient authorization management.
[0037] Figure 1 The flowchart of the authorization control method of the operating system according to the exemplary embodiment of the present disclosure is applied to the authorization control component of the operating system, for example, but not limited to, the rpm-ostree component.
[0038] Reference Figure 1 , in step 101, the authentication information of the target data warehouse is set as a custom identity variable.
[0039] This step is used to specify the target data warehouse on the one hand, and to set the identity authentication information for the target data warehouse on the other hand. The custom identity variables used for the identity authentication information are saved in the custom variable directory, which is a subdirectory under the specified directory.
[0040] Specifically, the target data warehouse is a warehouse from which data needs to be obtained, such as a target YUM warehouse. In the current operating system version, there may be multiple data warehouses of the same type, such as multiple YUM warehouses, so it is necessary to specify which data warehouse or warehouses of the same type are to be managed and controlled this time, and the specified warehouse is used as the target data warehouse. As an example, the target data warehouse can be preset by the operating system or manually configured by the user, and the present disclosure does not limit this.
[0041] When setting the identity authentication information for the target data warehouse, it is specifically set as a custom identity variable. It should be clear that here it is set as a "variable" rather than a "value of the variable", so that the identity authentication information of the target data warehouse corresponds to the custom identity variable. Subsequently, the identity authentication information of the target data warehouse can be automatically modified by modifying the value of the custom identity variable, so as to realize the dynamic update of the identity authentication information. It should also be noted that the definition, assignment, and dynamic update of the value of the custom identity variable are usually performed by the authorized client program in the operating system that is specifically responsible for the custom variable. Specifically, a subdirectory is generated under the directory of the current operating system version (recorded as the designated directory) as a custom variable directory, and a file is generated under the custom variable directory and filled with the file content, wherein the file name is the same as the specific custom variable name, and the file content is used as the value of the specific custom variable. By dynamically modifying the file content, the value of the specific custom variable can be dynamically modified. It should be understood that a plurality of custom variables can be stored in the custom variable directory, and these multiple custom variables include custom identity variables, such as a custom user name (for example, represented by auth_u) and a custom password (for example, represented by auth_p).
[0042] As an example, step 101 may be specifically performed by adding username and password fields for identity authentication in the configuration file of the target data warehouse, and then assigning values to the custom username and custom password respectively.
[0043] In step 102, a first directory path is obtained.
[0044] The first directory path is used to describe the location of the custom variable directory in the file system. The file system is a mechanism or structure used by the operating system to manage and store file data. It defines how files are organized on storage devices, including file naming, organization, access rights, and storage locations. The file system is part of the operating system and is responsible for handling file creation, deletion, reading, and writing operations. The operating system provides data organization and management through the file system. Since the directory path is obtained by the authorization control component, it is a complete directory path starting from the system root directory.
[0045] In step 103, the first directory path is modified to remove the portion of the first directory path corresponding to the second directory path, thereby obtaining a modified first directory path.
[0046] The second directory path is used to describe the location of the specified directory in the file system. By removing the corresponding part in the first directory path, only the directory path of the custom variable directory in the specified directory will be retained. For example, the first directory path is / ostree / deploy / fedora / deploy / 1 / etc / yum / vars / , and the second directory path is / ostree / deploy / fedora / deploy / 1 / . At this time, the corrected first directory path is / etc / yum / vars / .
[0047] In step 104, the value of the user-defined identity variable is read in the specified directory according to the modified first directory path.
[0048] Since the corrected first directory path only retains the directory path of the custom variable directory in the specified directory, it can be recognized by tools (such as the YUM library) in the current operating system, thereby achieving reliable reading of the custom identity variables.
[0049] As mentioned above, the custom variable directory described by the first directory path can store multiple custom variables, including custom identity variables. Still taking the example that the custom identity variables include the custom username auth_u and the custom password auth_p, step 104 can be specifically performed as reading the contents of the files named auth_u and auth_p in the custom variable directory under the specified directory according to the modified first directory path as the values of the corresponding custom identity variables.
[0050] In step 105, a target request is sent to the server of the target data warehouse, wherein the target request includes the value of the custom identity variable for the server to perform identity authentication.
[0051] By adding the value of the read custom identity variable as the authentication information to the target request and sending it to the server of the target data warehouse for the server to verify whether the authentication information in the target request is correct, the authentication information can be sent while sending the target request. There is no need to configure additional authentication operations, thus achieving effective and simple authentication and ensuring efficient authorization management and control.
[0052] As an example, the target request may be a request to install / upgrade software. Such a request may be sent in the form of a message. In this case, the value of a custom identity variable serving as authentication information may be added to a specified location in the message, such as in a message header.
[0053] Next, the authorization management method of the operating system according to the exemplary embodiment of the present disclosure is further introduced.
[0054] Regarding how to perform the correction operation in step 103, in some embodiments, optionally, step 103 includes: obtaining a second directory path; deleting the portion that repeats with the second directory path from the first directory path to obtain a corrected first directory path. The authorization management component has the ability to obtain a complete directory path starting from the system root directory. By using this capability to obtain the directory path of the specified directory, that is, the second directory path, and then deleting the corresponding content from the first directory path, the correction of the first directory path can be achieved. It should be understood that since the directory path often contains symbols for distinguishing different levels of directories, such as " / ", when deleting the portion that repeats with the second directory path, it is necessary to ensure that the remaining portion is complete in form, rather than simply deleting all the content that repeats with the second directory path. Still taking the case where the first directory path is / ostree / deploy / fedora / deploy / 1 / etc / yum / vars / and the second directory path is / ostree / deploy / fedora / deploy / 1 / as an example, the " / " must be retained at the beginning of the corrected first directory path, so the path that is actually deleted is " / ostree / deploy / fedora / deploy / 1".
[0055] Further optionally, the above-mentioned operation of deleting the portion that repeats with the second directory path from the first directory path to obtain a revised first directory path includes: counting the number of path layers contained in the second directory path; and deleting the directory paths of the corresponding number of layers at the front from the first directory path according to the number of path layers to obtain a revised first directory path. By specifically calculating the number of path layers and deleting the directory paths of the corresponding number of layers at the front when deleting the portion that repeats with the second directory path, there is no need to compare the actual text of the second directory path, which helps to further reduce the consumption of computing resources. Still taking the above-mentioned example of the first directory path and the second directory path, it can be counted that the number of path layers contained in the second directory path is 5, so the first 5 directory paths in the first directory path can be deleted.
[0056] Regarding how to perform the correction operation in step 103, in other embodiments, optionally, step 103 includes: in the case of a default custom directory path (such as / etc / yum / vars / ), the default custom directory path is used as the corrected first directory path, wherein the concatenation of the second directory path and the default custom directory path is the same as the first directory path. In the case of a default custom directory path, since the concatenation of the second directory path and the default custom directory path is exactly the same as the first directory path, the corrected first directory path must be the same as the default custom directory path. In this regard, by directly using the default custom directory path as the corrected first directory path, the correction operation with the same effect can be achieved without obtaining the second directory path, which can fully reduce the computing resource consumption of the correction operation.
[0057] Regarding the triggering condition for executing the correction in step 103, optionally, step 103 includes: in the case of determining that the designated directory is not the system root directory, correcting the first directory path to remove the portion of the first directory path corresponding to the second directory path, and obtaining a corrected first directory path. For operating systems that use a hybrid image-software package mechanism represented by rpm-ostree, since authorization control is performed under a specific operating system version, the designated directory is often not the system root directory, but for operating systems that use a software package mechanism represented by RPM, the designated directory is often the system root directory, and there is no need to correct the first directory path. By configuring the triggering condition that the designated directory is not the system root directory for the correction operation, an additional insurance can be added to confirm in advance whether the correction operation needs to be performed, thereby reducing unnecessary correction operations and corresponding computing resource consumption.
[0058] Further optionally, step 103 also includes: when it is determined that the specified directory is the system root directory, taking the first directory path as the corrected first directory path. By making full use of the above trigger condition, when the trigger condition is not met, directly taking the first directory path as the corrected first directory path, that is, not performing the correction operation, and continuing to perform subsequent steps based on the first directory path to implement authorization control, the authorization control method according to the exemplary embodiment of the present disclosure can be compatible with the hybrid image-software package mechanism and the software package mechanism at the same time, so that the authorization control method can be conveniently reused in operating systems using different mechanisms.
[0059] Regarding the type of target warehouse, optionally, the target data warehouse includes at least one of the following warehouses: software package warehouse, operating system image warehouse. In operating systems using software package mechanisms represented by RPM, custom identity variables are maturely applied, and accordingly, custom identity variables specifically belong to YUM custom variables, so the target data warehouse can support software package warehouses, such as YUM warehouses, so as to meet the basic software package installation / upgrade behavior management and control. However, in operating systems using hybrid image-software package mechanisms represented by rpm-ostree, operating system version update behavior is not included in the management and control, resulting in that when the operating system is not authorized to be activated, the operating system version can still be updated through the official OSTree warehouse address preset by the system. By further adding operating system image warehouses, such as OSTree warehouses, as warehouse types supported by the target data warehouse, custom identity variables under conventional software package mechanisms can be extended and applied to the management and control of operating system version update behavior, ensuring comprehensive management and control.
[0060] Next, combine Figure 2 A method for authorization control of an operating system according to a specific embodiment of the present disclosure is introduced.
[0061] In this specific embodiment, the operating system uses the rpm-ostree mechanism, so the authorization control component is the rpm-ostree component, and the rpm-ostree component reads the value of the custom identity variable by calling the YUM library.
[0062] Before the rpm-ostree component executes the authorization control method, the authorization client program in the operating system must first define the YUM custom variables auth_u and auth_p, that is, the YUM custom identity variables including the YUM custom username and YUM custom password. The specific operation is to generate the / etc / yum / vars / directory in the current operating system version directory, generate a file with the same name in the directory and fill in the file content. The file content is used for HTTP Basic authentication of the remote HTTP server where the controlled YUM repository and the controlled OSTree repository (that is, the target data repository) are located.
[0063] Next, the rpm-ostree component executes the authorization control method.
[0064] Reference Figure 2 , in step 201, configure the username and password fields of the managed YUN warehouse.
[0065] This step pre-sets or manually configures a managed YUM repository in the / etc / yum.repos.d / directory in the operating system, adds the username and password fields for HTTP Basic authentication, and assigns them to the auth_u and auth_p variables respectively. When manually configured by the user, the rpm-ostree component can receive the user's configuration results.
[0066] In step 202, HTTP Basic authentication information is configured for the managed OSTree repository address URL (Uniform Resource Locator).
[0067] This step also adds the username and password required for HTTP Basic authentication to the OSTree repository configuration URL using the YUM custom variables auth_u and auth_p, either pre-set or manually configured by the user.
[0068] Step 201 and step 202 correspond to Figure 1 Step 101 in the above description is respectively directed to two different types of data warehouses, namely, the YUM warehouse and the OSTree warehouse, and is executed in respective adaptive ways.
[0069] In step 203, the YUM custom variable directory path, that is, the first directory path, is obtained.
[0070] This step corresponds to Figure 1 Step 102 in .
[0071] In step 204 , it is determined whether a non-system root directory is designated as the root directory for software package installation. If so, the process proceeds to step 205 ; if not, the process proceeds to step 208 .
[0072] The root directory for installing the software package is the directory of the current operating system version, which is the specified directory mentioned above. This step corresponds to Figure 1 The correction operation triggering condition judgment of step 103 in FIG.
[0073] In step 205, the actual system path of the software package installation root directory, ie, the second directory path, is obtained.
[0074] In step 206, the number of YUM custom variable path levels that need to be canceled, that is, the number of path levels of the second directory path, is counted.
[0075] In step 207, the YUM custom variable directory path is modified according to the count.
[0076] Steps 205 to 207 correspond to Figure 1 The correction operation of step 103 in .
[0077] In step 208, the actual variable values of the YUM custom variables auth_u and auth_p are read.
[0078] This step corresponds to Figure 1 Step 104 in the above method is to read all files in the YUM defined variable directory, use the file name as the variable name, and use the file content as the variable value, wherein the content of the files named auth_u and auth_p is the actual variable value of the YUM custom variables auth_u and auth_p.
[0079] In step 209, YUM custom variables are replaced when parsing the YUM repository configuration.
[0080] This step specifically obtains the username and password field values of the YUM repository configuration and replaces the YUM custom variables auth_u and auth_p with the actual variable values.
[0081] In step 210, an identity authentication message header is added to the YUM repository request message.
[0082] This step specifically adds an Authorization header using the username and password field values configured in the YUM repository to all HTTP request messages sent by the remote HTTP server where the managed YUM repository is located.
[0083] In step 211, an identity authentication message header is added to the OSTree repository request message.
[0084] This step specifically adds the Authorization header to all HTTP request messages sent by the remote HTTP server where the managed OSTree repository is located, using the actual variable values of the YUM custom variables auth_u and auth_p.
[0085] Steps 209 to 211 correspond to Figure 1 Step 105 in the above description. Wherein, steps 209 and 210 are for software package installation / upgrade behavior based on the YUM repository, and step 211 is for operating system version update behavior based on the OSTree repository.
[0086] After receiving the HTTP request message, the remote HTTP server will perform HTTPBasic identity authentication according to the Authorization message header. If the authentication is successful, an HTTP response message with a status code of 200 and containing the requested resource will be returned. If the authentication is unsuccessful, an HTTP response message with a status code of 401 and not containing the requested resource will be returned.
[0087] In step 212, the response message is parsed, that is, the HTTP response message returned from the remote HTTP server where the managed YUM repository and the managed OSTree repository are located is parsed.
[0088] It should be noted that each time a software package installation / upgrade behavior or an operating system version update behavior is executed, it is necessary to execute the authorization control method according to the exemplary embodiment of the present disclosure to achieve authorization control. However, it should be understood that here, in order to exemplarily and comprehensively illustrate the authorization control method of the present disclosure, the authorization control of the software package and the operating system are described to indicate that the authorization control component has the ability to perform authorization control on both the software package and the operating system. In practice, except for steps 203 to 208 and step 212, which are steps that must be executed, other steps can be selectively executed according to the objects involved in the actual control. In other words, steps 201, 209 and 210 can be executed when only the software package needs to be controlled, and steps 202 and 211 are not executed. When only the operating system needs to be controlled, steps 202 and 211 are executed, and steps 201, 209 and 210 are not executed.
[0089] In addition, under reasonable circumstances, the execution order of the above specific steps is adjustable and optional. For example, step 201 only needs to be executed before step 209, and does not need to be executed before steps 203 to 208. The same applies to step 202, and the steps for the YUM repository and the steps for the OSTree repository can be executed in parallel, so there is no dependency on the execution order of steps 201 and 202. For another example, regardless of the judgment result of step 204, step 203 must be executed. Therefore, in order to facilitate drawing the flowchart, step 203 is placed before step 204, but in fact step 203 does not need to be executed before step 204. If the judgment result of step 204 is yes, step 203 only needs to be executed before step 207; if the judgment result of step 204 is no, step 203 only needs to be executed before step 208.
[0090] It should also be understood that whether it is the control of the software package or the operating system, it needs to be performed in the current operating system version directory. If the operating system version update behavior is performed, a new operating system version directory will be generated, and the installation / upgrade behavior of the software package will be controlled in the new directory. In particular, when it is necessary to roll back to an old version of the operating system, the operation is performed in the directory of the old version of the operating system.
[0091] Figure 3 is a block diagram of an authorization control device of an operating system according to an exemplary embodiment of the present disclosure. Figure 3 The device includes a setting unit 301, an acquisition unit 302, a correction unit 303, a reading unit 304, and a request unit 305.
[0092] The setting unit 301 can set the identity authentication information of the target data warehouse as a custom identity variable, wherein the custom identity variable is saved in a custom variable directory, which is a subdirectory under the specified directory.
[0093] Optionally, the target data warehouse includes at least one of the following warehouses: a software package warehouse, an operating system image warehouse.
[0094] The acquisition unit 302 may acquire a first directory path, where the first directory path is used to describe a location of a custom variable directory in a file system.
[0095] The correction unit 303 may correct the first directory path to remove the portion of the first directory path corresponding to the second directory path to obtain a corrected first directory path, wherein the second directory path is used to describe the location of the designated directory in the file system.
[0096] Optionally, the correction unit 303 may further: obtain a second directory path; and delete a portion of the first directory path that is repeated with the second directory path to obtain a corrected first directory path.
[0097] Optionally, the correction unit 303 may further: count the number of path levels included in the second directory path; and delete the directory paths of the corresponding number of levels from the first directory path according to the number of path levels to obtain a corrected first directory path.
[0098] Optionally, the correction unit 303 may further: when there is a default custom directory path, use the default custom directory path as the corrected first directory path, wherein a concatenation result of the second directory path and the default custom directory path is the same as the first directory path.
[0099] Optionally, when determining that the designated directory is not the system root directory, the correction unit 303 may correct the first directory path to remove the portion of the first directory path corresponding to the second directory path to obtain a corrected first directory path.
[0100] Optionally, the correction unit 303 may further use the first directory path as the corrected first directory path when determining that the designated directory is the system root directory.
[0101] The reading unit 304 may read the value of the user-defined identity variable in the specified directory according to the modified first directory path.
[0102] The request unit 305 may send a target request to the server of the target data warehouse, wherein the target request includes the value of the custom identity variable for the server to perform identity authentication.
[0103] According to an embodiment of the present disclosure, an electronic device may be provided. Figure 4 It is a block diagram of an electronic device 400 according to an embodiment of the present disclosure, and the electronic device includes at least one memory 401 and at least one processor 402, wherein the at least one memory stores a computer executable instruction set 4011 and an operating system 4012, and when the computer executable instruction set 4011 is executed by the at least one processor 402, the authorization management method of the operating system according to the embodiment of the present disclosure is executed.
[0104] As an example, the electronic device 400 may be a PC, a tablet device, a personal digital assistant, a smart phone, or other device capable of executing the above instruction set. Here, the electronic device 400 is not necessarily a single electronic device, but may also be any device or circuit collection capable of executing the above instructions (or instruction sets) individually or in combination. The electronic device 400 may also be part of an integrated control system or system manager, or may be configured as a portable electronic device interconnected with a local or remote (e.g., via wireless transmission) interface.
[0105] In the electronic device 400, the processor 402 may include a central processing unit (CPU), a graphics processing unit (GPU), a programmable logic device, a dedicated processor system, a microcontroller or a microprocessor. As an example and not a limitation, the processor 402 may also include an analog processor, a digital processor, a microprocessor, a multi-core processor, a processor array, a network processor, etc.
[0106] The processor 402 may execute instructions or codes stored in the memory, wherein the memory 401 may also store data. Instructions and data may also be sent and received over a network via a network interface device, wherein the network interface device may employ any known transmission protocol.
[0107] The memory 401 may be integrated with the processor 402, for example, by placing RAM or flash memory within an integrated circuit microprocessor or the like. In addition, the memory 401 may include a separate device, such as an external disk drive, a storage array, or any other storage device that can be used by a database system. The memory 401 and the processor 402 may be operationally coupled, or may communicate with each other, such as through an I / O port, a network connection, etc., so that the processor 402 can read files stored in the memory 401.
[0108] In addition, the electronic device 400 may further include a video display (such as a liquid crystal display) and a user interaction interface (such as a keyboard, a mouse, a touch input device, etc.) All components of the electronic device may be connected to each other via a bus and / or a network.
[0109] According to an embodiment of the present disclosure, a computer-readable storage medium may also be provided, wherein when instructions in the computer-readable storage medium are executed by at least one processor, the at least one processor is prompted to execute the authorization control method of the operating system of the embodiment of the present disclosure. Examples of computer-readable storage media here include: read-only memory (ROM), random access programmable read-only memory (PROM), electrically erasable programmable read-only memory (EEPROM), random access memory (RAM), dynamic random access memory (DRAM), static random access memory (SRAM), flash memory, non-volatile memory, CD-ROM, CD-R, CD+R, CD-RW, CD+RW, DVD-ROM, DVD-R, DVD+R, DVD-RW, DVD+RW, DVD-RAM, BD-ROM, BD-R, BD-R LTH, BD-RE, Blu-ray or optical disk storage, hard disk drive (HDD), solid state drive (SSD), card storage (such as, multimedia card, secure digital (SD) card or extreme digital (XD) card), magnetic tape, floppy disk, magneto-optical data storage device, optical data storage device, hard disk, solid state disk and any other device, any other device is configured to store computer programs and any associated data, data files and data structures in a non-transitory manner and provide the computer programs and any associated data, data files and data structures to a processor or computer so that the processor or computer can execute the computer program. The computer program in the above-mentioned computer-readable storage medium can be run in an environment deployed in a computer device such as a client, a host, an agent device, a server, etc. In addition, in one example, the computer program and any associated data, data files and data structures are distributed on a networked computer system, so that the computer program and any associated data, data files and data structures are stored, accessed and executed in a distributed manner by one or more processors or computers.
[0110] According to an embodiment of the present disclosure, a computer program product is provided, including computer instructions, which, when executed by a processor, implement the authorization management method of the operating system of the embodiment of the present disclosure.
[0111] Those skilled in the art will readily appreciate other embodiments of the present disclosure after considering the specification and practicing the invention disclosed herein. The present disclosure is intended to cover any variations, uses or adaptations of the present disclosure, which follow the general principles of the present disclosure and include common knowledge or customary techniques in the art that are not disclosed in the present disclosure. The description and examples are intended to be exemplary only, and the true scope and spirit of the present disclosure are indicated by the appended claims.
[0112] It should be understood that the present disclosure is not limited to the exact structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.
Claims
1. An authorization control method for an operating system, It is characterized in that The authorization control method includes: Setting the identity authentication information of the target data warehouse as a custom identity variable, wherein the custom identity variable is stored in a custom variable directory, which is a subdirectory under a specified directory; Obtain a first directory path, wherein the first directory path is used to describe the location of the custom variable directory in the file system; In the case where it is determined that the designated directory is not a system root directory, the first directory path is modified to remove a portion of the first directory path corresponding to a second directory path, thereby obtaining a modified first directory path, wherein the second directory path is used to describe a location of the designated directory in the file system; In the case where it is determined that the designated directory is the system root directory, using the first directory path as the corrected first directory path; According to the modified first directory path, reading the value of the custom identity variable in the designated directory; Sending a target request to a server of the target data warehouse, wherein the target request includes a value of the custom identity variable for the server to perform identity authentication; The step of modifying the first directory path to remove a portion of the first directory path corresponding to the second directory path to obtain a modified first directory path includes: Get the second directory path, Deleting the portion of the first directory path that is repeated with the second directory path to obtain the modified first directory path; or In the case of a default custom directory path, the default custom directory path is used as the corrected first directory path, wherein a concatenation result of the second directory path and the default custom directory path is the same as the first directory path.
2. The authorization control method according to claim 1, It is characterized in that The deleting the portion of the first directory path that is repeated with the second directory path to obtain the corrected first directory path includes: Counting the number of path layers included in the second directory path; According to the number of path levels, the directory paths of the corresponding number of levels are deleted from the first directory path to obtain the corrected first directory path.
3. The authorization control method according to claim 1 or 2, It is characterized in that The target data warehouse includes at least one of the following warehouses: a software package warehouse and an operating system image warehouse.
4. An authorization control device for an operating system, It is characterized in that The authorization control device comprises: A setting unit is configured to set the identity authentication information of the target data warehouse as a custom identity variable, wherein the custom identity variable is stored in a custom variable directory, and the custom variable directory is a subdirectory under a specified directory; An acquiring unit is configured to acquire a first directory path, wherein the first directory path is used to describe a location of the custom variable directory in a file system; a correction unit configured to, when determining that the designated directory is not a system root directory, correct the first directory path to remove a portion of the first directory path corresponding to a second directory path, to obtain a corrected first directory path, wherein the second directory path is used to describe a location of the designated directory in the file system; The correction unit is further configured to use the first directory path as the corrected first directory path when it is determined that the designated directory is the system root directory; a reading unit configured to read the value of the custom identity variable in the designated directory according to the modified first directory path; A request unit, configured to send a target request to a server of the target data warehouse, wherein the target request includes a value of the custom identity variable for the server to perform identity authentication; The modifying unit modifies the first directory path to remove the portion of the first directory path corresponding to the second directory path to obtain a modified first directory path, including: Get the second directory path, Deleting the portion of the first directory path that is repeated with the second directory path to obtain the modified first directory path; or In the case of a default custom directory path, the default custom directory path is used as the corrected first directory path, wherein a concatenation result of the second directory path and the default custom directory path is the same as the first directory path.
5. An electronic device, It is characterized in that include: at least one processor; at least one memory storing computer executable instructions, Wherein, when the computer executable instructions are executed by the at least one processor, the at least one processor is prompted to execute the authorization management method of the operating system as described in any one of claims 1 to 3.
6. A computer-readable storage medium, It is characterized in that When the instructions in the computer-readable storage medium are executed by at least one processor, the at least one processor is prompted to execute the authorization management method of the operating system as described in any one of claims 1 to 3.
7. A computer program product comprising computer instructions, It is characterized in that When the computer instructions are executed by at least one processor, the at least one processor is prompted to execute the authorization management method of the operating system according to any one of claims 1 to 3.
