[ 
https://issues.apache.org/jira/browse/IMPALA-9047?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17027074#comment-17027074
 ] 

ASF subversion and git services commented on IMPALA-9047:
---------------------------------------------------------

Commit 135fa1613dac4999fec666d428e8fbe9ad1dfc60 in impala's branch 
refs/heads/master from Fang-Yu Rao
[ https://gitbox.apache.org/repos/asf?p=impala.git;h=135fa16 ]

IMPALA-9149: part 2: Re-enable Ranger-related EE tests

In IMPALA-9047, we disabled some Ranger-related FE and BE tests due to
changes in Ranger's behavior after upgrading Ranger from 1.2 to 2.0.
This patch aims to re-enable those disabled EE tests in
tests/authorization/test_authorized_proxy.py and
tests/authorization/test_ranger.py to increase Impala's test coverage of
authorization via Ranger.

The Ranger-related tests in test_authorized_proxy.py test Impala's
delegation for clients. Two types of delegation are supported in Impala,
i.e., a user can delegate the execution of a query to either 1) another
user, or 2) a group of users. In the former case, Ranger will check
whether or not the delegated user specified in the option
'authorized_proxy_user_config' possesses sufficient privileges to access
the resources, whereas in the latter case, before checking the delegated
group is granted sufficient privileges, Ranger will check with the help
of Impala whether or not the delegated user specified in
'authorized_proxy_user_config' belongs to the delegated group specified
in 'authorized_proxy_group_config' in the underlying OS. This type of
delegation requires Impala to retrieve the groups the delegated user
belongs to from the underlying OS and thus if the delegated user does
not exist in the underlying OS, Impala would inform Ranger that the
delegated user does not belong to any group, which in turn would fail
the authorization even though in the policies on the Ranger server, the
delegated user belongs to the delegated group and the delegated group is
granted sufficient privileges.

The re-enabled Ranger tests in test_authorized_proxy.py involve queries
in which the delegated user, i.e., 'non_owner', does not exist in the
underlying OS. We use 'non_owner' as the delegated user instead of
getuser() so that we will have to explicitly grant 'non_owner'
sufficient privileges of accessing the resources. To avoid the need for
creating an actual delegated user and its corresponding delegated groups
in the underlying OS when running the EE tests, we added to
'impalad_args' an additional option, i.e.,
'use_customized_user_groups_mapper_for_ranger', which, when set to true,
allows Impala to use a customized user-to-groups mapping when performing
authorization via Ranger. On the other hand, we set the delegated user
to getuser() when running the respective Sentry related tests to avoid
the need for having to provide Sentry with a customized user-to-groups
mapping.

To re-enable test_legacy_catalog_ownership() in test_ranger.py, we
removed in _test_ownership() a test query that was expected to fail the
authorization in Ranger 1.2 but passes the authorization in Ranger 2.0.
This is due to the fact that in Ranger 2.0, a user does not have to be
explicitly granted the privileges of accessing a resource as long as the
user is the owner of the resource.

Testing:
- Passed FE tests.
- Passed the tests in test_authorized_proxy.py.
- Passed the tests in test_ranger.py.

Change-Id: I17420d7ff9beacd1b4d2ad72b68b8b54983e60cb
Reviewed-on: http://gerrit.cloudera.org:8080/15088
Reviewed-by: Impala Public Jenkins <[email protected]>
Tested-by: Impala Public Jenkins <[email protected]>


> Some Ranger related test cases fail when using a newer version of Ranger 
> -------------------------------------------------------------------------
>
>                 Key: IMPALA-9047
>                 URL: https://issues.apache.org/jira/browse/IMPALA-9047
>             Project: IMPALA
>          Issue Type: Bug
>          Components: Frontend
>            Reporter: Fang-Yu Rao
>            Assignee: Fang-Yu Rao
>            Priority: Major
>             Fix For: Impala 3.4.0
>
>         Attachments: Ranger_policy_after_cdp_number_bump.png, 
> Ranger_policy_before_cdp_number_bump.png
>
>
> Some Ranger related E2E tests and FE tests would fail when we are using a 
> newer version of Ranger (e.g., {{ranger-2.0.0.7.0.2.0-98}} instead of 
> {{ranger-1.2.0.7.1.0.0-33}}) due to the changes to the default Ranger 
> policies described at https://issues.apache.org/jira/browse/RANGER-2536. In 
> the attachment the screenshots of the policies of "\{{all - database, table, 
> column}}" before and after using the newer Ranger are also provided.
> Some operations which were not authorized previously could now be authorized 
> successfully because of the changes. In this regard, we also have to change 
> the test cases in at least 4 files of Impala's E2E tests and FE tests, which 
> are listed in the following.
>  # test_authorized_proxy.py
>  # test_ranger.py
>  # AuthorizationStmtTest.java
>  # RangerAuditLogTest.java



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to