Updated on 2026-06-27 GMT+08:00

Adding a Ranger Access Permission Policy for HetuEngine

Scenarios

In data analytics scenarios of an enterprise big data platform, HetuEngine functions as a high-performance SQL query engine, enabling rapid cross-source data queries and analysis. Business analysts rely on HetuEngine to query multi-source database tables and columns to generate business reports, while developers use it to debug SQL statements and validate data processing logic. If database, table, and column access permissions for all data sources are granted directly, sensitive data may be leaked, or unauthorized users may accidentally modify the table structure. If only simple, data source-level permission control is implemented, the data granularity is insufficient to meet the precise access requirements of different users.

Administrators can use Ranger to configure fine-grained permission policies for HetuEngine users to manage data source databases, tables, and columns.

Prerequisites

  • The Ranger service has been installed and is running properly in the cluster.
  • The users, user groups, or roles requiring permissions must already be created in the cluster. For newly created users, you can configure permission policies only after the users are automatically synchronized to Ranger.
  • The corresponding users have been added to the hetuuser group.
  • Before using HetuEngine, ensure that the client operator or user in the data source configuration file has the required operation permissions. If the user lacks these permissions, configure them by referring to the corresponding data source permission requirements.

Procedure

  1. Log in to the Ranger web UI as the Ranger administrator. For details, see Logging In to the Ranger Web UI.
  2. On the homepage, click HetuEngine in the PRESTO area.
  3. On the Access tab page, click Add New Policy to add a HetuEngine permission control policy.
  4. Configure the parameters listed in the table below based on the service demands.

    Granting the access policy to the catalog where the table is located is a basic policy and must be configured before you configure other policies. For details, see Table 2.

    Table 1 HetuEngine permission parameters

    Parameter

    Description

    Policy Name

    Policy name, which can be customized and must be unique in the service.

    • Enabled: Enable the current policy.
    • Disabled: Disable the current policy.

    Policy Conditions

    IP address filtering policy, which can be customized. You can enter one or more IP addresses or IP address segments. An IP address can contain the wildcard character (*), for example, 192.168.1.10,192.168.1.20 or 192.168.1.*.

    Policy Label

    A label specified for the current policy. You can search for reports and filter policies based on labels.

    Presto Catalog

    Name of the data source catalog to which the policy applies. If this parameter is set to *, the policy applies to all catalogs.

    • Include: The policy applies to the current input object.
    • Exclude: The policy applies to objects other than the current input.

    Schema

    Name of the schema to which the policy applies. The value * indicates all schemas.

    • Include: The policy applies to the current input object.
    • Exclude: The policy applies to objects other than the current input.

    table

    Name of the table or view to which the policy applies. If this parameter is set to *, the policy applies to all tables.

    • Include: The policy applies to the current input object.
    • Exclude: The policy applies to objects other than the current input.

    Column

    Name of the column to which the policy applies. The value * indicates all columns.

    Description

    Policy description.

    Audit Logging

    Whether to generate an audit log when a request matches the policy.

    • Yes: An audit log is generated whenever an access request matches the policy, regardless of whether the result is Allow or Deny.
    • No: No audit log is generated when an access request matches the policy.

    Allow Conditions

    Policy allow conditions, which define the permissions and exceptions authorized by this policy.

    In the Select Role, Select Group, and Select User columns, select the role, user group, or user to which you want to assign permissions.

    Click Add Conditions to add the IP address range to which the policy applies and click Add Permissions to add corresponding permissions.

    • Select: permission to query data
    • Insert: permission to insert data
    • Create: permission to create data
    • Drop: permission to drop data
    • Delete: permission to delete data
    • Use: permission to use data
    • Alter: permission to alter data
    • Update: permission to update data
    • Admin: the Admin permission
    • All: all permissions (including the Admin permission)
    • Select/Deselect All: permission to select or deselect all

    To add multiple permission control rules, click .

    If users or user groups in the current condition need to manage this policy, select Delegate Admin. These users will become the agent administrators. The agent administrators can update and delete this policy and create sub-policies based on the original policy.

    Deny Conditions

    Policy deny conditions, which define the permissions and exceptions that must be rejected by the policy. The configuration method is identical to that of Allow Conditions.

    Table 2 Common permission configuration scenarios

    Task

    Role Authorization

    Granting the access policy to the catalog where the table is located

    This policy is a prerequisite. Before configuring other policies, ensure that this policy has been configured.

    1. Enter the policy name in Policy Name.
    2. In Presto Catalog, enter the catalog of the resource to be authorized, for example, hive.
    3. Enter the authorized Hetu user in the Select User text box.
    4. In Permissions, select Select.

    Granting the permission to access the remote HetuEngine table

    This policy is a prerequisite for remote HetuEngine tables. Before configuring other policies, ensure that this policy has been configured.

    1. Enter the policy name in Policy Name.
    2. In Presto Catalog, enter the catalog of the table to be authorized, for example, systemremote and svc.
    3. Select schema from the drop-down list box under Presto Catalog and enter * in the text box.
    4. Select table from the drop-down list box under schema and enter * in the text box.
    5. Select column from the drop-down list box under table and enter * in the text box.
    6. Enter the authorized remote HetuEngine user in the Select User text box.
    7. In Permissions, select Create, Drop, Select, and Insert.

    Creating a schema

    1. Enter the policy name in Policy Name.
    2. In Presto Catalog, enter the catalog of the target table to be authorized, for example, hive.
    3. Select schema from the drop-down list box under Presto Catalog and enter the name of the target schema to be authorized in the text box. If this parameter is set to *, all schemas under the current catalog are authorized.
    4. Enter the authorized Hetu user in the Select User text box.
    5. In Permissions, select Create.

    Deleting a schema

    1. Enter the policy name in Policy Name.
    2. In Presto Catalog, enter the catalog of the target table to be authorized, for example, hive.
    3. Select schema from the drop-down list box under Presto Catalog and enter the name of the target schema to be authorized in the text box. If this parameter is set to *, all schemas under the current catalog are authorized.
    4. Enter the authorized Hetu user in the Select User text box.
    5. In Permissions, select Drop.

    Creating a table

    1. Enter the policy name in Policy Name.
    2. In Presto Catalog, enter the catalog of the target table to be authorized, for example, hive.
    3. Select schema from the drop-down list box under Presto Catalog and enter the name of the schema where the target table to be authorized resides in the text box, for example, default.
    4. Select table from the drop-down list box under schema and enter the name of the target table to be authorized in the text box. If this parameter is set to *, all tables under the current schema are authorized.
    5. Enter the authorized Hetu user in the Select User text box.
    6. In Permissions, select Create.

    Deleting a table

    1. Enter the policy name in Policy Name.
    2. In Presto Catalog, enter the catalog of the target table to be authorized, for example, hive.
    3. Select schema from the drop-down list box under Presto Catalog and enter the name of the schema where the target table to be authorized resides in the text box, for example, default.
    4. Select table from the drop-down list box under schema and enter the name of the target table to be authorized in the text box. If this parameter is set to *, all tables under the current schema are authorized.
    5. Enter the authorized Hetu user in the Select User text box.
    6. In Permissions, select Drop.

    Modifying the table structure (ALTER TABLE)

    1. Enter the policy name in Policy Name.
    2. In Presto Catalog, enter the catalog of the target table to be authorized, for example, hive.
    3. Select schema from the drop-down list box under Presto Catalog and enter the name of the schema where the target table to be authorized resides in the text box, for example, default.
    4. Select table from the drop-down list box under schema and enter the name of the target table to be authorized in the text box. If this parameter is set to *, all tables under the current schema are authorized.
    5. Enter the authorized Hetu user in the Select User text box.
    6. In Permissions, select Alter.

    ALTER TABLE table_name DROP [IF EXISTS] PARTITION partition_spec[, PARTITION partition_spec, ...]; requires the table-level delete and column-level select permissions.

    Viewing data tables (SHOW TABLES)

    1. Enter the policy name in Policy Name.
    2. In Presto Catalog, enter the catalog of the target table to be authorized, for example, hive.
    3. Select schema from the drop-down list box under Presto Catalog and enter the name of the target schema that allows to show table in the text box, for example, default.
    4. Enter the authorized Hetu user in the Select User text box.
    5. In Permissions, select Select.

    Inserting table data (INSERT TABLE)

    1. Enter the policy name in Policy Name.
    2. In Presto Catalog, enter the catalog of the target table to be authorized, for example, hive.
    3. Select schema from the drop-down list box under Presto Catalog and enter the name of the schema where the target table to be authorized resides in the text box, for example, default.
    4. Select table from the drop-down list box under schema and enter the name of the target table to be authorized in the text box. If this parameter is set to *, all tables under the current schema are authorized.
    5. Enter the authorized Hetu user in the Select User text box.
    6. In Permissions, select Insert.

    Deleting data (DELETE)

    1. Enter the policy name in Policy Name.
    2. In Presto Catalog, enter the catalog of the target table to be authorized, for example, hive.
    3. Select schema from the drop-down list box under Presto Catalog and enter the name of the schema where the target table to be authorized resides in the text box, for example, default.
    4. Select table from the drop-down list box under schema and enter the name of the target table to be authorized in the text box. If this parameter is set to *, all tables under the current schema are authorized.
    5. Enter the authorized Hetu user in the Select User text box.
    6. In Permissions, select Delete.

    Querying data (SELECT)

    1. Enter the policy name in Policy Name.
    2. In Presto Catalog, enter the catalog of the target table to be authorized, for example, hive.
    3. Select schema from the drop-down list box under Presto Catalog and enter the name of the schema where the target table to be authorized resides in the text box, for example, default.
    4. Select table from the drop-down list box under schema and enter the name of the target table to be authorized in the text box. If this parameter is set to *, all tables under the current schema are authorized.
    5. Select column from the drop-down list box under table and enter the name of the target column to be authorized in the text box. If this parameter is set to *, all columns under the current table are authorized.
    6. Enter the authorized Hetu user in the Select User text box.
    7. In Permissions, select Select.

    Viewing table fields (SHOW COLUMNS)

    1. Enter the policy name in Policy Name.
    2. In Presto Catalog, enter the catalog of the target table to be authorized, for example, hive.
    3. Select schema from the drop-down list box under Presto Catalog and enter the name of the schema where the target table to be authorized resides in the text box, for example, default.
    4. Select table from the drop-down list box under schema and enter the name of the target table to be authorized in the text box. If this parameter is set to *, all tables under the current schema are authorized.
    5. Select column from the drop-down list box under table and enter the name of the target column to be authorized in the text box. If this parameter is set to *, all columns under the current table are authorized.
    6. Enter the authorized Hetu user in the Select User text box.
    7. In Permissions, select Select.

    Configuring session parameters (SET SESSION)

    1. Enter the policy name in Policy Name.
    2. Enter * in the Presto Catalog text box.
    3. Enter the authorized Hetu user in the Select User text box.
    4. Select Delegate Admin.
    • The configuration takes effect approximately 30 seconds after the permissions are configured.
    • The current permission control is available to columns.

  5. (Optional) Configure the policy validity period. Click Add Validity period in the upper right corner of the page, set Start Time and End Time, and select Time Zone. Click Save.

    To add multiple policy validity periods, click . To delete a policy validity period, click .

  6. Click Add to view basic information about the policy in the policy list. After the policy takes effect, check whether the related permissions are normal.

    To disable a policy, click and set the policy to Disabled.

    If a policy is no longer used, click to delete it.

Configuring HetuEngine Data Masking

Ranger supports data masking for HetuEngine data. It masks sensitive information by processing the results returned by your SELECT operations.

  1. Log in to the Ranger web UI. Click HetuEngine in the PRESTO area on the homepage.
  2. On the Masking tab page, click Add New Policy to add a HetuEngine data masking policy.
  3. Configure the parameters listed in the table below based on the service demands.

    Table 3 HetuEngine data masking parameters

    Parameter

    Description

    Policy Name

    Policy name, which can be customized and must be unique in the service.

    Policy Conditions

    IP address filtering policy, which can be customized. You can enter one or more IP addresses or IP address segments. An IP address can contain the wildcard character (*), for example, 192.168.1.10,192.168.1.20 or 192.168.1.*.

    Policy Label

    A label specified for the current policy. You can search for reports and filter policies based on labels.

    Presto Catalog

    Name of the catalog to which the current policy applies.

    Presto Schema

    Name of the database to which the current policy applies.

    Presto Table

    Name of the table to which the current policy applies.

    Presto Column

    Name of the column to which the current policy applies.

    Description

    Policy description.

    Audit Logging

    Whether to generate an audit log when a request matches the policy.

    • Yes: An audit log is generated whenever an access request matches the policy, regardless of whether the result is Allow or Deny.
    • No: No audit log is generated when an access request matches the policy.

    Transfer Mask

    Whether the policy is automatically transferred when dynamic masking is enabled.

    For details about how to configure HetuEngine dynamic masking, see Using the HetuEngine Dynamic Masking Function.

    Mask Conditions

    In the Select Role, Select Group, and Select User columns, choose the specific roles, groups, or users to whom the permissions will be granted. Click Add Conditions and specify the IP address range to which this policy applies. Click Add Permissions and select Select.

    Click Select Masking Option and select a data masking policy.

    • Redact: Use x to mask all letters and 0 to mask all digits.
    • Partial mask: show last 4: Only the last four characters are displayed. Other characters are masked with x. Masking of Chinese characters is not supported.
    • Partial mask: show first 4: Only the first four characters are displayed. Other characters are masked with x. Masking of Chinese characters is not supported.
    • Hash: Replace the original value with the hash value.
    • Nullify: Replace the original value with the NULL value.
    • Unmasked (retain original value): Keep the original value.
    • Custom: You customize policies using any valid return data type which is the same as the data type in the masked column.

    To add a multi-column masking policy, click .

  4. Click Add to view basic information about the policy in the policy list.
  5. When you use the HetuEngine client to perform a SELECT operation on a table configured with a data masking policy, the system processes the data and displays the masked results.

Configuring HetuEngine Row-level Data Filtering

Ranger allows you to filter data at the row level when you perform the select operation on a HetuEngine data table.

  1. Log in to the Ranger web UI. Click HetuEngine in the PRESTO area on the homepage.
  2. On the Row Level Filter tab page, click Add New Policy to add a row data filtering policy.
  3. Configure the parameters listed in the table below based on the service demands.

    Table 4 Parameters for filtering HetuEngine row data

    Parameter

    Description

    Policy Name

    Policy name, which can be customized and must be unique in the service.

    Policy Conditions

    IP address filtering policy, which can be customized. You can enter one or more IP addresses or IP address segments. An IP address can contain the wildcard character (*), for example, 192.168.1.10,192.168.1.20 or 192.168.1.*.

    Policy Label

    A label specified for the current policy. You can search for reports and filter policies based on labels.

    Presto Catalog

    Name of the catalog to which the current policy applies.

    Presto Schema

    Name of the database to which the current policy applies.

    Presto Table

    Name of the table to which the current policy applies.

    Description

    Policy description.

    Audit Logging

    Whether to generate an audit log when a request matches the policy.

    • Yes: An audit log is generated whenever an access request matches the policy, regardless of whether the result is Allow or Deny.
    • No: No audit log is generated when an access request matches the policy.

    Row Filter Conditions

    In the Select Role, Select Group, and Select User columns, choose the specific roles, groups, or users to whom the permissions will be granted. Click Add Conditions and specify the IP address range to which this policy applies. Click Add Permissions and select Select.

    Click Row Level Filter and enter data filtering rules.

    For example, to filter out data where the name column equals zhangsan in table A, configure the filtering rule as name <> 'zhangsan'. For more information, see the Apache Ranger official documentation.

    To add more rules, click .

  4. Click Add to view basic information about the policy in the policy list.
  5. After a user performs the select operation on a table for which a data masking policy has been configured on a HetuEngine client, the system processes the data and displays it.

Helpful Links