HDFS permission convergence grayscale online implementation method based on Ranger strategy
By setting the HDFS ACL blacklist policy in Ranger Admin, it takes effect dynamically and centrally manages HDFS permissions, which solves the problem of HDFS being unable to meet multi-user permission settings in multi-tenant scenarios and achieves dynamic grayscale convergence and centralized management of HDFS permissions. Simplified authority management and improved business stability.
Patent Information
- Application Number
- CN202410177259.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-02-08
- Publication Date
- 2024-08-30
- Estimated Expiration
- 2044-02-08
AI Technical Summary
HDFS cannot meet the need to set multiple user permissions for the same resource in a multi-tenant scenario. Especially when using Ranger for centralized permission management, the UGO and ACLs authentication functions of HDFS cannot be dynamically enabled, making permission management complex and inconvenient. Centralized management.
Adopt the grayscale implementation method of HDFS permission convergence based on Ranger policy. By setting the HDFS ACL blacklist policy in Ranger Admin, configure the users or groups that need to be converged into the blacklist, which will take effect dynamically without restarting the HDFS cluster. Implement centralized management of permissions, support some users to enable HDFS ACL authentication, and some users only use Ranger permissions.
Realizes dynamic grayscale convergence of HDFS permissions, allowing some users to deeply use HDFS itself for authentication, while other users only use Ranger policy permissions, simplifying permission management, reducing potential online problems in the production environment, and improving the stability of business switching nature and authority management and control efficiency.
Smart Images

Figure CN118133340B
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of HDFS permission convergence grayscale online implementation method, and in particular relates to a HDFS permission convergence grayscale online implementation method based on Ranger strategy. Background Art
[0002] (I) HDFS permissions
[0003] As the most widely used distributed file system in the big data field, HDFS implements a set of POSIX-compatible file permission models, including the coarse-grained POSIX UGO model (User, Group, Other) and the fine-grained POSIX ACLs protocol.
[0004] Every time a client performs a file operation, HDFS will verify the user identity authentication, user group mapping, and data access authorization. The client's operation request will first obtain the user name from the local system (NameNode.getRemoteUser()), then the server will match the user name with the group information, and finally check whether the accessed data has been authorized to the user. Once an exception occurs in any link in this process, the client's operation request will fail. The following takes Hadoop 3.3.1 as an example to introduce the current status of HDFS permission management and permission allocation:
[0005] 1. HDFS User Authentication
[0006] User identity authentication does not fall within the scope of HDFS, which means that HDFS is not responsible for checking the legitimacy of user identities. It only relies on related systems to obtain user identities for subsequent authentication. Identity authentication depends entirely on the authentication system used. Currently, HDFS supports three types of user identity authentication: simple authentication, LDAP, and Kerberos authentication.
[0007] Simple authentication: Authentication is performed based on the current user name of the Linux / Unix system where the client process is located. As long as the user can log in to the operating system normally, the authentication is successful. In this way, when the client interacts with the NameNode, the user's login account (consistent with the whoami command output) will be passed to the Namenode as a legal user name. This authentication mechanism has the risk of malicious users forging other people's user names, which poses a great threat to data security. It is generally not recommended to use this solution in online production environments (especially multi-tenant environments).
[0008] LDAP authentication: LDAP (Lightweight Directory Access Protocol), as a lightweight directory access protocol, is a widely used centralized user identity management and authentication solution. It can also be integrated with Hadoop to implement identity authentication. Common implementations of the LDAP protocol include: Microsoft's Active Directory (AD for short), Oracle's Internet Directory, IBM's Directory Server, SUN's SUNONEDirectory Server, and open source OpenLDAP. For example, in the OpenLDAP solution, users can choose a variety of ways to organize user information and then save it in the LDAP Server (slapd). After HDFS enables this authentication method, users access the user information in the LDAP service through the URL for authentication.
[0009] Kerberos authentication: Kerberos is a network authentication protocol that uses key encryption technology to provide strong authentication for client and server applications. It has an AdminServer to manage all account information that needs to be authenticated, and several Key Distribution Servers (KDC) to provide authentication and key distribution services. The user obtains the corresponding Kerberos account name or key file from the Kerberos administrator, and then authenticates Kerberos through kinit and other methods to obtain a TGT (ticket-granting-ticket) ticket. The client transmits the TGT information to the NN (NameNode). After the NN obtains the authentication information, it intercepts the principle header as the client's user name. For example, after successful authentication using hdfs / user1@COMPANY.COM, user1 as the principle header will be used as the client's user name. Using Kerberos can greatly enhance the security of HDFS (it can provide higher security trust between user clients and application servers), especially in a multi-tenant production environment.
[0010] 2. User Group Mapping
[0011] Because HDFS uses a file permission model similar to Linux / Unix systems, namely the UGO model, which is divided into users, groups, and others, after obtaining the user name, NN will further obtain the group list corresponding to the user. The acquisition of groups in HDFS is achieved through an external Group Mapping service. Currently, the community has two main ways to implement the mapping from users to groups:
[0012] 1) Use the system's own solution (that is, the user group system on the NameNode server).
[0013] Based on the user and group implementation of Linux / Unix system, the user and user group information on Linux / Unix system is stored in / etc / passwd and / etc / group files. By default, HDFS uses the org.apache.hadoop.security.ShellBasedUnixGroupsMapping service, which calls the Shell command groups on the NN to obtain the user's group list. The advantage of this solution is that the group mapping service is very stable and not easily affected by external services. However, user and user group management requires root privileges, and a large number of user groups will be generated on the server, which will have a great impact on subsequent management and automated operation and maintenance.
[0014] 2) Use third-party services such as LDAP and set it through the parameter hadoop.security.group.mapping.
[0015] Users and groups are implemented based on LDAP database. OpenLDAP is an open source LDAP database. Users can be easily added and user groups can be modified through management tools such as phpLDAPadmin or related interfaces. HDFS uses LDAP services by configuring org.apache.hadoop.security.LdapGroupsMapping, and can directly obtain the user's group list through the interface. The disadvantage of using LDAP is that the availability and performance of LDAP services must be guaranteed, but the advantages are also obvious. For example, users and groups can be centrally managed, and they can also be connected to other user systems, making it very convenient to add and change users.
[0016] 3. Data authorization (data rights management)
[0017] UGO Rights Management
[0018] The file permissions of HDFS are similar to the UGO model of Linux / Unix systems, but compared with the traditional POSIX model, HDFS does not have setuid and setgid implementations. Similar to Linux / Unix, HDFS can also set the sticky bit in the directory. By setting the sticky bit, different users can share the read and write permissions of a specific directory, and only the owner of the subdirectory has the delete permission.
[0019] Similar to Linux / Unix, HDFS also provides a umask mask to set the default permissions for newly created files and directories in HDFS.
[0020]
[0021] As shown in the above configuration, the default 022 is changed to 027 (in order to cooperate with the permission restrictions of the user group to block the default permissions of other users, it is recommended to set it to 027). Explanation of 022 and 027: If umask is 022 (default value), the mode of the new file is 644, and the mode of the new directory is 755, that is, the umask erases the write permissions of group and other; if umask is 027, the mode of the new file is 640, and the mode of the new directory is 750, that is, the umask erases the write permission of group and the read, write and execute permissions of others.
[0022] HDFS also has a superuser similar to the root account of linux / uinx system. By default, only the user who starts the Namenode process has superuser privileges. However, many operations actually require superuser privileges (such as fsck, etc.), so HDFS can also configure a superuser group. Except for some operations (such as hdfs dfsadmin-report command) that have restrictions on user names, all users in this user group can operate HDFS with superuser privileges. The parameters for enabling the superuser group are as follows:
[0023]
[0024] ACLs permission management
[0025] In addition to supporting the traditional POSIX permission model, HDFS also supports POSIX ACLs (Access Control Lists). ACLs enhance the traditional permission model by setting different permissions for specific users or groups to control access to HDFS files, which can achieve more flexible and fine-grained permission control: allowing users to define access control for any combination of users and groups, rather than a single user (owner) or a single group.
[0026] ACLs Application Scenarios
[0027] HDFS uses a user group permission management model called UGO to meet the security requirements of most scenarios, but it is not competent for some complex scenarios. The following problems exist in actual enterprise applications: for a directory, there may be multiple users with multiple permission requirements, one business user is read-only, and another business user is read-write, but the user group permission can only be set to one of the two.
[0028] HDFS file permissions and ACL access control
[0029] Permission related configuration
[0030]
[0031] (ii) Ranger
[0032] Apache Ranger is a framework that provides centralized permission management. It can perform fine-grained permission access control on components such as HDFS, Hive, and YARN in the Hadoop ecosystem. At the same time, it also provides data desensitization control based on desensitization policies for some components, such as Hive and Trino. For sensitive row data, it can also filter some row data in the table based on row-level filtering policies. Ranger also provides a Web UI for administrators to operate conveniently.
[0033] 1. Introduction to Ranger components
[0034] like Figure 1 As shown, Ranger consists of multiple components, and its permission part mainly consists of three components:
[0035] 1)Ranger Admin
[0036] It mainly includes Admin service, Web UI, and metadata storage. Administrator users can log in to the Web UI to create and update permission policies. The Web UI calls the Admin service through the RESTful API, and the Admin service saves the corresponding policy information to the configured metadata database. Through the Web UI, you can also import and export policies of different component services, view policies, and manage users, roles, and groups. After enabling auditing, you can also view audit information. Among them, the Admin service is an important backend service for all component plugins to periodically poll to obtain policies.
[0037] 2)Ranger Plugins
[0038] Plugin is a lightweight Java program embedded in the process of each cluster component (or engine). For example, Ranger's HDFS component is embedded in the NameNode. These plugins pull policies from the Ranger Admin server and cache them in local files. When receiving a user request from a component, the corresponding component's plugin intercepts the request and evaluates it according to the security policy.
[0039] 3) Ranger UserSync
[0040] Ranger provides a user synchronization tool. By default, it supports pulling user and user group information from Unix or LDAP (of course, it can also be extended to synchronize user and user group information from other systems to Ranger Admin). This user and user group information is stored in the Ranger Admin database and can be used when configuring policies.
[0041] 2. Ranger strategy evaluation process
[0042] As mentioned above, Ranger is a common security framework in the Hadoop ecosystem. Each component implements specific authentication functions through plugins. The evaluation process of Ranger policy is as follows: Figure 2 As shown, including:
[0043] 1) Evaluate all rejection conditions first.
[0044] 2) When the request matches the deny condition in the policy:
[0045] a. If there is no exclusion condition set in the policy, or the request does not match the exclusion condition in the policy, access is denied;
[0046] b. Otherwise, continue processing the next rejection condition.
[0047] 3) If none of the deny conditions deny access, start processing all running conditions.
[0048] 4) When the request matches the allow condition in the policy:
[0049] a. If there is no exclusion or allowance condition in the policy, or if the request does not match the exclusion or allowance condition in the policy, access is allowed;
[0050] b. Otherwise, continue processing to the next enabling condition.
[0051] 5) If no allowed conditions match the request, the access result will be undefined. In this case, most components will be denied, but components like HDFS and YARN will fall back to their own ACLs to further determine access permissions.
[0052] 3. HDFS enables Ranger authentication process
[0053] In the actual online environment, it is necessary to enable HDFS ACL and use Ranger HDFS Plugin to implement permission control in the early stage. After the HDFS cluster is opened, the business starts to use it. With the growth of business and the gradual feedback of cluster management, the implementation of permission planning is completed through Ranger HDFS Plugin. That is, the convergence from Ranger HDFS permission control and HDFS ACL joint control to Ranger HDFS permission control is achieved.
[0054] Ranger HDFS permission control works together with HDFS ACL. The authentication process is as follows: Figure 3 shown.
[0055] HDFS permissions need to be converged, and Hadoop authentication will be skipped by modifying the following Ranger configuration:
[0056]
[0057] 3. Current Problems
[0058] In the above description of the current status of HDFS, we can see that although HDFS's own authentication supports UGO and ACLs, it is not possible to set permissions for multiple users for the same resource. Especially in multi-tenant scenarios, it cannot meet actual needs. Therefore, it is often necessary to introduce other security components.
[0059] Ranger is the solution of choice for most enterprises in this situation. However, after being integrated with HDFS, this solution has also encountered some thorny problems in actual user scenarios. For example, HDFS is often used as a distributed storage system for multiple businesses, on which various applications run. Many users even develop their own clients based on HDFS. In such clients, users may need to rely on the UGO and ACLs authentication functions of HDFS itself. For example, the Hadoop cluster storage in the data center provides services through two protocols, S4 and hdfs. S4 has customized many of its own functions, and its permissions need to rely on the UGO and ACLs authentication functions of HDFS itself. HDFS files store massive amounts of data, including Hive partition table data, user directories, and data export directories. Daily job runs will perform read and write operations on these HDFS directories and files. The HDFS requests of daily jobs of different users or user groups in multiple business departments need to be authenticated through the Ranger HDFS Plugin. Most of these business users need to centralize their permissions to Ranger. Although you can manually change xasecure.add-hadoop-authorization to false, this operation will invalidate the original authentication methods based on HDFS ACL, etc., so it is completely not allowed in a production environment.
[0060] In summary, there is an urgent need in this field to develop a method for implementing HDFS permission convergence grayscale launch, so as to dynamically enable HDFS's own UGO and ACLs authentication functions for some users (groups, roles), while other users only use Ranger permissions. Summary of the invention
[0061] In view of the above-mentioned defects in the prior art, both HDFS and Ranger are unable to enable HDFS ACL authentication only for specific users (or groups). Especially when using Ranger for centralized authority management, in actual business scenarios, there is an urgent need for a solution that can converge HDFS authority grayscale to Ranger. Based on this, the present invention proposes a new and feasible HDFS authority convergence grayscale online implementation method based on Ranger policy. Through this method, the UGO and ACLs authentication functions of HDFS itself can be dynamically enabled for some users (groups and roles are also supported), while other users only use Ranger permissions. This allows some users to deeply use customized clients based on HDFS authentication itself, and allows some business users to only use Ranger policy permissions. At the same time, the original user grayscale based on HDFS authentication itself can be converged to Ranger for centralized management.
[0062] In general, the method of the present invention adopts a blacklist strategy to solve the above problems. For users (or groups) who need to converge all permissions to Ranger for centralized management, they are configured in the HDFS ACL blacklist strategy. The blacklist strategy takes effect dynamically and can take effect dynamically without restarting the HDFS cluster. During the intermediate transition period, users can fully upgrade and migrate. The intermediate transition period has basically no impact on the original business. When all users are converged to Ranger for centralized management, the default xasecure.add-hadoop-authorization configuration can be changed to false. For two scenarios (some users need to enable HDFS ACL authentication, and some users only need Ranger permissions), the above configuration can be retained.
[0063] In order to use Hadoop authentication, you must first ensure that Ranger has the additional Hadoop authentication function enabled (it is enabled by default, and the corresponding configuration is xasecure.add-hadoop-authorization=true) before this function takes effect.
[0064] Specifically, the present invention provides a method for implementing HDFS permission convergence grayscale online based on Ranger strategy, such as Figure 6 As shown, the method comprises the following steps:
[0065] S1. Set the HDFS ACL blacklist policy in Ranger Admin, and configure the users and user groups whose permissions need to be centralized in Ranger to the HDFS ACL blacklist policy;
[0066] S2. The user client obtains a user name from the local system or specifies a user name, and then accesses a resource in HDFS with the user name.
[0067] S3. Use Ranger's default HDFS policy evaluation process to evaluate the resources accessed by the user;
[0068] S4. Determine whether the HDFS resource currently has the Hadoop authentication function enabled, and proceed to the next step after confirming that the function is enabled;
[0069] S5. Determine whether the accessed user name is in the HDFS ACL blacklist. If it is not in the list or the user list is not configured, proceed to the next step.
[0070] S6. Determine the HDFS ACL permissions of the resources accessed by the user;
[0071] S7. Combine the Ranger default HDFS policy evaluation result and the HDFS ACL permission judgment result for the resources accessed by the user, and return the final evaluation result.
[0072] Furthermore, the present invention provides a method for implementing HDFS permission convergence grayscale launch based on Ranger strategy. Before executing the method, it is first confirmed that Ranger has enabled the additional Hadoop authentication function, and the corresponding configuration is xasecure.add-hadoop-authorization=true.
[0073] Furthermore, the HDFS ACL blacklist policy set in step S1 of the HDFS permission convergence grayscale launch implementation method based on Ranger policy of the present invention can be dynamically effective without restarting the HDFS cluster; when all users and user groups are converged to Ranger for centralized management, the administrator can choose to change the default xasecure.add-hadoop-authorization configuration to false.
[0074] Furthermore, in step S4 of the HDFS permission convergence grayscale online implementation method based on the Ranger strategy of the present invention, it is determined whether the HDFS resource currently has the function of additional Hadoop authentication enabled. If the function is not enabled, it returns directly and still uses the Ranger strategy for permission evaluation.
[0075] Furthermore, in step S5 of the HDFS permission convergence grayscale online implementation method based on the Ranger strategy of the present invention, it is determined whether the accessed user name is in the HDFS ACL blacklist. If it is in the list, it is directly returned and the Ranger strategy is still used for permission evaluation.
[0076] Furthermore, in the method for implementing HDFS permission convergence grayscale launch based on the Ranger strategy of the present invention, the HDFS ACL permission of the resource accessed by the user is judged in step S6, including:
[0077] (1) If the user has permission, the system returns "allowed", allowing the user to access the resource as a whole;
[0078] (2) If the user does not have permission, the Ranger default HDFS policy evaluation result is further combined to make a judgment.
[0079] Furthermore, the present invention provides a method for implementing HDFS permission convergence grayscale online based on Ranger strategy. The HDFS ACL blacklist strategy in the method is implemented by extending the function of the RangerHdfsAuthorizer class; the RangerHdfsAuthorizer class inherits from the abstract class InodeAttributeProvider of Hadoop, and the RangerHdfsAuthorizer class contains the internal class RangerAccessControlEnforcer, which implements the AccessControlEnforcer interface of HDFS. The interface contains the checkPermission method, and the checkRangerPermission method is continued to be called in the checkPermission method. When the permission is checked by the checkRangerPermission method, if AuthzStatus is NOT_DETERMINED, the checkDefaultEnforcer method is further called to determine AuthzStatus; in the checkDefaultEnforcer, it is determined whether the additional Hadoop authentication function is enabled for the current resource. After confirmation, the verification logic of the HDFS ACL blacklist strategy is executed. If the AuthzStatus returned by the strategy is ALLOW, it means that the user or user group accessing the resource is in HDFS. If the resource is not in the ACL blacklist policy, the query returns directly without executing the HDFS ACL permission check logic. Otherwise, it indicates that the user or user group accessing the resource is not in the HDFS ACL blacklist policy, and the HDFS ACL permissions of the resource accessed will be further checked.
[0080] Furthermore, the present invention provides a method for implementing HDFS permission convergence grayscale online based on Ranger policy. In this method, the configuration of the HDFS ACL blacklist policy follows the model of the Ranger HDFS policy. The function of the HDFS ACL blacklist policy is to determine whether the HDFS resources accessed by the user require additional Hadoop authentication. In this method, the HDFS ACL blacklist policy is named xasecure.add-hadoop-authorization.black-list, and its resource path is uniformly defined as / *+OPTIONS(xasecure.add-hadoop-authorization.black-list)* / .
[0081] In addition, the present invention also provides a computer-readable storage medium, on which a computer program is stored. When the program is executed by a processor, the steps of the above-mentioned HDFS permission convergence grayscale online implementation method based on the Ranger strategy are implemented.
[0082] In summary, the HDFS permission convergence grayscale online implementation method based on the Ranger strategy of the present invention has the following characteristics:
[0083] (1) In the method of the present invention, the same HDFS cluster can support multiple permission models (Ranger-based permissions, Hadoop-based permissions, or a combination of the two), which can meet the application needs of users in multiple permission scenarios.
[0084] (2) In this method, the blacklist can be configured through the HDFS ACL blacklist policy, and it will take effect automatically and dynamically, supporting user-based and group-based blacklist functions.
[0085] (3) This method uses the Ranger HDFS Plugin to specify a policy configuration user list, and gradually and controllably completes the grayscale permission convergence of the cluster xasecure.add-hadoop-authorization from true to false, that is, converges from the joint authorization of RangerHDFS and HDFS ACL to permissions controlled only by the Ranger HDFS Plugin. Since this method can converge according to the configuration grayscale (gradually and with priority), it is safe, simple, and efficient, reducing potential online production problems that may be caused by overall changes, and achieving the stability of actual business switching and permission control goals. BRIEF DESCRIPTION OF THE DRAWINGS
[0086] In order to more clearly illustrate the background technology and the technical solutions of the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the background technology and the embodiments of the present invention. Obviously, the following drawings are only some embodiments recorded in the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without paying any creative work.
[0087] Figure 1 This is a schematic diagram of the Ranger architecture.
[0088] Figure 2 Schematic diagram of the evaluation process of the Ranger strategy.
[0089] Figure 3 Diagram of the authentication process for enabling Ranger for HDFS.
[0090] Figure 4This is a schematic diagram of the configuration on the Ranger Admin management page for converging the permissions of two users into Ranger for centralized management in an embodiment of the present invention.
[0091] Figure 5 It is a complete flow chart of the permission strategy of the present invention.
[0092] Figure 6 It is a schematic diagram of the implementation process of the method of the present invention. DETAILED DESCRIPTION
[0093] In order to make the purpose, technical solution and advantages of the present invention clearer, the technical solution of the present invention will be clearly and completely described below in conjunction with specific embodiments and corresponding drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of them. The present invention can also be implemented or applied through other different specific implementation methods. The details in this specification can also be modified or changed in various ways based on different viewpoints and applications without departing from the spirit of the present invention.
[0094] At the same time, it should be understood that the protection scope of the present invention is not limited to the specific embodiments described below; it should also be understood that the terms used in the embodiments of the present invention are for describing specific embodiments rather than for limiting the protection scope of the present invention.
[0095] Embodiment: A method for implementing HDFS permission convergence grayscale launch based on Ranger strategy
[0096] In this method, for users (or groups) whose permissions need to be converged to Ranger for centralized management, they are configured in the HDFS ACL blacklist policy. The blacklist policy takes effect dynamically without restarting the HDFS cluster. During the intermediate transition period, users can fully upgrade and migrate, and the intermediate transition period has basically no impact on the original business. When all users are converged to Ranger for centralized management, the administrator can choose to change the default xasecure.add-hadoop-authorization configuration to false. For two scenarios (some users need to enable HDFS ACL authentication, and some users only need Ranger permissions), the above configuration can be retained.
[0097] In order to use Hadoop authentication, you must first ensure that Ranger has the additional Hadoop authentication function enabled (it is enabled by default, and the corresponding configuration is xasecure.add-hadoop-authorization=true) before this function takes effect.
[0098] Implementation of HDFS ACL blacklist policy. We extend the function of RangerHdfsAuthorizer class, which inherits from Hadoop's abstract class INodeAttributeProvider. RangerHdfsAuthorizer has an internal class RangerAccessControlEnforcer, which implements HDFS's AccessControlEnforcer interface, which contains the important method checkPermission. In checkPermission, the checkRangerPermission method will continue to be called. When checking permissions in checkRangerPermission, if AuthzStatus is NOT_DETERMINED, the checkDefaultEnforcer method will be further called to determine AuthzStatus. In checkDefaultEnforcer, it is determined whether the additional Hadoop authentication is currently enabled. After confirming that it is enabled, we add a verification logic for the HDFS ACL blacklist policy. If this policy returns AuthzStatus as ALLOW, it means that the user (or group) accessing the resource is in the HDFS ACL blacklist policy, and it is directly returned, that is, the HDFS ACL permission verification logic is no longer performed. Otherwise, it means that it is not in the HDFS ACL blacklist policy. At this time, we evaluate the HDFS ACL permissions of the resources it accesses.
[0099] The configuration of the blacklist policy follows the model of the Ranger HDFS policy. We have added a new policy named xasecure.add-hadoop-authorization.black-list. This policy is a blacklist policy specifically used to determine whether to attach Hadoop authentication. Its resource path borrows the SQL Hints syntax and is uniformly defined as / *+OPTIONS(xasecure.add-hadoop-authorization.black-list)* / , indicating that it is a special resource path, and its function is the information implied therein (that is, the engine will do the processing of the blacklist resource logic similar to the additional Hadoop authentication). The rest is to configure the permissions of the user (or group). Multiple users (or groups) can be configured. It should be noted that the permissions must be configured as execution permissions, otherwise the entries in the corresponding permission policy will not take effect (similar to the permissions of this entry being disabled).
[0100] The Ranger HDFS service settings and list strategy are described in the following table:
[0101]
[0102]
[0103] For example, if we need to centrally manage the permissions of the two users yore and yore2 in Ranger without requiring them to attach Hadoop authentication, we can do the following on the Ranger Admin page: Figure 4 The configuration shown will take effect automatically in HDFS in about 30 seconds (the corresponding configuration is the ranger.plugin.hdfs.policy.pollIntervalMs configuration item in ranger-hdfs-security.xml). In this way, the HDFS UGO-based ACL permissions for the two users yore and yore2 originally set in HDFS will become invalid, and all permissions will be transferred to Ranger. Then, the user will have the same permissions as the resource permissions configured by the administrator in Ranger Admin.
[0104] Figure 5 The figure shows a complete flowchart of the permission strategy of the present invention. The core of the present invention is the addition of a HDFS ACL blacklist strategy judgment logic unit. The implementation process of the strategy is as follows:
[0105] 1. A user accesses a certain HDFS resource with a specified account (user name).
[0106] 2. Determine whether the HDFS resource currently has the Hadoop authentication function enabled:
[0107] 2.1 If it is not enabled, it will return directly and the evaluation result of the Ranger strategy will prevail;
[0108] 2.2 If it is enabled, proceed to step 3 below.
[0109] 3. Further determine whether the accessing user is in the HDFS ACL blacklist:
[0110] 3.1 If it is, it will return directly, and the evaluation result of Ranger strategy will still prevail;
[0111] 3.2 If not, proceed to step 4 below.
[0112] 4. Determine the HDFS ACL permissions (configured by Hadoop itself) of the resources accessed by the user:
[0113] 4.1 If the user has permission, it returns "allowed", allowing the user to access the resource as a whole;
[0114] 4.2 If the user does not have permission, it is necessary to further make a judgment based on the Ranger default policy evaluation result (see the table below). If the Ranger default policy evaluation result is denied or pending, the user is denied access to this resource as a whole.
[0115] 5. Integrate the Ranger policy evaluation results with the HDFS ACL permission judgment results and return the final evaluation results:
[0116] Evaluation results table
[0117]
[0118] The above description is only a preferred embodiment of the present invention and does not limit the present invention in any form. Any technician familiar with the profession can make some changes or modifications to the technical contents disclosed above without departing from the scope of the technical solution of the present invention to obtain equivalent embodiments of equivalent changes. However, any simple modification, equivalent changes and modifications made to the above embodiments based on the technical essence of the present invention without departing from the content of the technical solution of the present invention should be included in the scope of protection of the claims of the present invention.
Claims
1. A method for implementing HDFS permission convergence grayscale launch based on Ranger strategy, characterized in that: The method comprises: S1. Set up the HDFS ACL blacklist policy in Ranger Admin, and configure the users and user groups whose permissions need to be centralized in Ranger to the HDFS ACL blacklist policy; S2. The user client obtains a user name from the local system or specifies a user name, and then accesses a resource in HDFS with the user name. S3. Use Ranger's default HDFS policy evaluation process to evaluate the resources accessed by the user. S4. Determine whether the HDFS resource currently has the Hadoop authentication function enabled. If the function is enabled, proceed to the next step. If the function is not enabled, return directly and still use the Ranger strategy for permission assessment. S5. Determine whether the accessed user name is in the HDFS ACL blacklist. If it is not in the list or the user list is not configured, proceed to the next step. If it is in the list, return directly and still use the Ranger strategy for permission evaluation. The HDFS ACL blacklist policy in this step is implemented by extending the function of the RangerHdfsAuthorizer class; the RangerHdfsAuthorizer class inherits from the abstract class InodeAttributeProvider of Hadoop. The RangerHdfsAuthorizer class contains the internal class RangerAccessControlEnforcer, which implements the AccessControlEnforcer interface of HDFS. The interface contains the checkPermission method. The checkRangerPermission method is continued to be called in the checkPermission method. When the permission is checked by the checkRangerPermission method, if the AuthzStatus is NOT_DETERMINED, the checkDefaultEnforcer method is further called to determine the AuthzStatus; in the checkDefaultEnforcer, it is determined whether the additional Hadoop authentication function is enabled for the current resource. After confirmation, the verification logic of the HDFS ACL blacklist policy is executed. If the AuthzStatus returned by the policy is ALLOW, it means that the user or user group accessing the resource is in the HDFS ACL blacklist policy, then it is directly returned without executing the HDFS ACL permission verification logic. Otherwise, it means that the user or user group accessing the resource is not in HDFS In the ACL blacklist policy, the HDFS ACL permissions of the resources accessed are further judged; S6. Determine the HDFS ACL permissions of the resources accessed by the user, including: (1) If the user has permission, it returns "allowed", allowing the user to access the resource as a whole; (2) If the user does not have permission, further judgment is made based on the Ranger default HDFS policy evaluation results; S7. Combine the Ranger default HDFS policy evaluation results and HDFS ACL permission judgment results for the resources accessed by the user, and return the final evaluation result.
2. According to the Ranger strategy-based HDFS permission convergence grayscale online implementation method of claim 1, it is characterized in that: Before executing this method, first confirm that Ranger has enabled the additional Hadoop authentication function, and the corresponding configuration is xasecure.add-hadoop-authorization=true.
3. The method for implementing HDFS permission convergence grayscale online based on Ranger strategy according to claim 1 is characterized in that: The HDFS ACL blacklist policy set in step S1 takes effect dynamically without restarting the HDFS cluster; when all users and user groups are converged to Ranger for centralized management, the administrator chooses to change the default xasecure.add-hadoop-authorization configuration to false.
4. The method for implementing HDFS permission convergence grayscale online based on Ranger strategy according to claim 1 is characterized in that: In this method, the configuration of the HDFS ACL blacklist policy follows the model of the Ranger HDFS policy. The function of the HDFS ACL blacklist policy is to determine whether the HDFS resources accessed by the user require additional Hadoop authentication. In this method, the HDFS ACL blacklist policy is named xasecure.add-hadoop-authorization.black-list, and its resource path is uniformly defined as / *+ OPTIONS(xasecure.add-hadoop-authorization.black-list) * / .
5. A computer-readable storage medium having a computer program stored thereon, wherein when the program is executed by a processor, the steps of the method for implementing HDFS permission convergence grayscale online based on the Ranger strategy described in any one of claims 1 to 4 are implemented.
Citation Information
Patent Citations
Big data unified authorization access method and device, electronic equipment and medium
CN114692126A
Data storage system and method for controlling access to data stored in a data storage
WO2022231514A1
