You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@ambari.apache.org by Anita Jebaraj <aj...@us.ibm.com> on 2017/05/01 20:00:59 UTC

Re: Review Request 58429: After pam setup- Hive View user home test fails

-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/58429/
-----------------------------------------------------------

(Updated May 1, 2017, 8 p.m.)


Review request for Ambari, Attila Doroszlai, Di Li, Vishal Ghugare, Henning Kropp, Robert Levas, and Tim Thorpe.


Bugs: AMBARI-20760
    https://issues.apache.org/jira/browse/AMBARI-20760


Repository: ambari


Description
-------

After setting up PAM, tried to login as PAM user and access hive view, user home test fails with the error as in screen shot.

This issue was pointed out by Henning Kropp in the jira AMBARI-12263, but was not incorporated in the code. Pasting the comment from Henning below.

Something we noticed is that in a secured cluster we have issues with the views, getting the following exception for the Hive view as an example:

Struct:TOpenSessionResp(status:TStatus(statusCode:ERROR_STATUS, infoMessages:[*org.apache.hive.service.cli.HiveSQLException:Failed to validate proxy privilege of ambari for org.apache.ambari.server.security.authorization.AmbariPamAuthenticationProvider$1@34511119:33:32,
.....
sqlState:08S01, errorCode:0, errorMessage:Failed to validate proxy privilege of ambari for org.apache.ambari.server.security.authorization.AmbariPamAuthenticationProvider$1@34511119), serverProtocolVersion:null)

As you can see it tries to impersonte "org.apache.ambari.server.security.authorization.AmbariPamAuthenticationProvider$1@34511119:33:32". Changing the UsernamePasswordAuthenticationToken from Principal to username fixes this.

So instead of :

UsernamePasswordAuthenticationToken token = new UsernamePasswordAuthenticationToken(principal, null, userAuthorities);

We use:

UsernamePasswordAuthenticationToken token = new UsernamePasswordAuthenticationToken(user.getUserName(), null, userAuthorities);

What could potential also work is, overriding toString of the principal like:

Principal principal = new Principal() {
@Override
public String getName()
{ return user.getUserName(); }

@Override
public String toString()
{ return user.getUserName().toString(); }

};

We did not test this!


Diffs (updated)
-----

  ambari-server/src/main/java/org/apache/ambari/server/security/authorization/AmbariPamAuthenticationProvider.java ca7cd31 
  ambari-server/src/test/java/org/apache/ambari/server/security/authorization/AmbariPamAuthenticationProviderTest.java 5b3acd0 


Diff: https://reviews.apache.org/r/58429/diff/2/

Changes: https://reviews.apache.org/r/58429/diff/1-2/


Testing
-------

Ran mvn test and also manually tested the scenario


File Attachments
----------------

error screenshot
  https://reviews.apache.org/media/uploaded/files/2017/04/13/4a43b897-e030-41a7-b702-f711432b03b9__error.PNG


Thanks,

Anita Jebaraj


Re: Review Request 58429: After pam setup- Hive View user home test fails

Posted by Robert Levas <rl...@hortonworks.com>.

> On May 1, 2017, 4:09 p.m., Robert Levas wrote:
> > Ship It!
> 
> Anita Jebaraj wrote:
>     Thank you Robert, can you please help in pushing the changes

Sure. On it now.


- Robert


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/58429/#review173498
-----------------------------------------------------------


On May 1, 2017, 4 p.m., Anita Jebaraj wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/58429/
> -----------------------------------------------------------
> 
> (Updated May 1, 2017, 4 p.m.)
> 
> 
> Review request for Ambari, Attila Doroszlai, Di Li, Vishal Ghugare, Henning Kropp, Robert Levas, and Tim Thorpe.
> 
> 
> Bugs: AMBARI-20760
>     https://issues.apache.org/jira/browse/AMBARI-20760
> 
> 
> Repository: ambari
> 
> 
> Description
> -------
> 
> After setting up PAM, tried to login as PAM user and access hive view, user home test fails with the error as in screen shot.
> 
> This issue was pointed out by Henning Kropp in the jira AMBARI-12263, but was not incorporated in the code. Pasting the comment from Henning below.
> 
> Something we noticed is that in a secured cluster we have issues with the views, getting the following exception for the Hive view as an example:
> 
> Struct:TOpenSessionResp(status:TStatus(statusCode:ERROR_STATUS, infoMessages:[*org.apache.hive.service.cli.HiveSQLException:Failed to validate proxy privilege of ambari for org.apache.ambari.server.security.authorization.AmbariPamAuthenticationProvider$1@34511119:33:32,
> .....
> sqlState:08S01, errorCode:0, errorMessage:Failed to validate proxy privilege of ambari for org.apache.ambari.server.security.authorization.AmbariPamAuthenticationProvider$1@34511119), serverProtocolVersion:null)
> 
> As you can see it tries to impersonte "org.apache.ambari.server.security.authorization.AmbariPamAuthenticationProvider$1@34511119:33:32". Changing the UsernamePasswordAuthenticationToken from Principal to username fixes this.
> 
> So instead of :
> 
> UsernamePasswordAuthenticationToken token = new UsernamePasswordAuthenticationToken(principal, null, userAuthorities);
> 
> We use:
> 
> UsernamePasswordAuthenticationToken token = new UsernamePasswordAuthenticationToken(user.getUserName(), null, userAuthorities);
> 
> What could potential also work is, overriding toString of the principal like:
> 
> Principal principal = new Principal() {
> @Override
> public String getName()
> { return user.getUserName(); }
> 
> @Override
> public String toString()
> { return user.getUserName().toString(); }
> 
> };
> 
> We did not test this!
> 
> 
> Diffs
> -----
> 
>   ambari-server/src/main/java/org/apache/ambari/server/security/authorization/AmbariPamAuthenticationProvider.java ca7cd31 
>   ambari-server/src/test/java/org/apache/ambari/server/security/authorization/AmbariPamAuthenticationProviderTest.java 5b3acd0 
> 
> 
> Diff: https://reviews.apache.org/r/58429/diff/2/
> 
> 
> Testing
> -------
> 
> Ran mvn test and also manually tested the scenario
> 
> 
> File Attachments
> ----------------
> 
> error screenshot
>   https://reviews.apache.org/media/uploaded/files/2017/04/13/4a43b897-e030-41a7-b702-f711432b03b9__error.PNG
> 
> 
> Thanks,
> 
> Anita Jebaraj
> 
>


Re: Review Request 58429: After pam setup- Hive View user home test fails

Posted by Anita Jebaraj <aj...@us.ibm.com>.

> On May 1, 2017, 8:09 p.m., Robert Levas wrote:
> > Ship It!

Thank you Robert, can you please help in pushing the changes


- Anita


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/58429/#review173498
-----------------------------------------------------------


On May 1, 2017, 8 p.m., Anita Jebaraj wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/58429/
> -----------------------------------------------------------
> 
> (Updated May 1, 2017, 8 p.m.)
> 
> 
> Review request for Ambari, Attila Doroszlai, Di Li, Vishal Ghugare, Henning Kropp, Robert Levas, and Tim Thorpe.
> 
> 
> Bugs: AMBARI-20760
>     https://issues.apache.org/jira/browse/AMBARI-20760
> 
> 
> Repository: ambari
> 
> 
> Description
> -------
> 
> After setting up PAM, tried to login as PAM user and access hive view, user home test fails with the error as in screen shot.
> 
> This issue was pointed out by Henning Kropp in the jira AMBARI-12263, but was not incorporated in the code. Pasting the comment from Henning below.
> 
> Something we noticed is that in a secured cluster we have issues with the views, getting the following exception for the Hive view as an example:
> 
> Struct:TOpenSessionResp(status:TStatus(statusCode:ERROR_STATUS, infoMessages:[*org.apache.hive.service.cli.HiveSQLException:Failed to validate proxy privilege of ambari for org.apache.ambari.server.security.authorization.AmbariPamAuthenticationProvider$1@34511119:33:32,
> .....
> sqlState:08S01, errorCode:0, errorMessage:Failed to validate proxy privilege of ambari for org.apache.ambari.server.security.authorization.AmbariPamAuthenticationProvider$1@34511119), serverProtocolVersion:null)
> 
> As you can see it tries to impersonte "org.apache.ambari.server.security.authorization.AmbariPamAuthenticationProvider$1@34511119:33:32". Changing the UsernamePasswordAuthenticationToken from Principal to username fixes this.
> 
> So instead of :
> 
> UsernamePasswordAuthenticationToken token = new UsernamePasswordAuthenticationToken(principal, null, userAuthorities);
> 
> We use:
> 
> UsernamePasswordAuthenticationToken token = new UsernamePasswordAuthenticationToken(user.getUserName(), null, userAuthorities);
> 
> What could potential also work is, overriding toString of the principal like:
> 
> Principal principal = new Principal() {
> @Override
> public String getName()
> { return user.getUserName(); }
> 
> @Override
> public String toString()
> { return user.getUserName().toString(); }
> 
> };
> 
> We did not test this!
> 
> 
> Diffs
> -----
> 
>   ambari-server/src/main/java/org/apache/ambari/server/security/authorization/AmbariPamAuthenticationProvider.java ca7cd31 
>   ambari-server/src/test/java/org/apache/ambari/server/security/authorization/AmbariPamAuthenticationProviderTest.java 5b3acd0 
> 
> 
> Diff: https://reviews.apache.org/r/58429/diff/2/
> 
> 
> Testing
> -------
> 
> Ran mvn test and also manually tested the scenario
> 
> 
> File Attachments
> ----------------
> 
> error screenshot
>   https://reviews.apache.org/media/uploaded/files/2017/04/13/4a43b897-e030-41a7-b702-f711432b03b9__error.PNG
> 
> 
> Thanks,
> 
> Anita Jebaraj
> 
>


Re: Review Request 58429: After pam setup- Hive View user home test fails

Posted by Robert Levas <rl...@hortonworks.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/58429/#review173498
-----------------------------------------------------------


Ship it!




Ship It!

- Robert Levas


On May 1, 2017, 4 p.m., Anita Jebaraj wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/58429/
> -----------------------------------------------------------
> 
> (Updated May 1, 2017, 4 p.m.)
> 
> 
> Review request for Ambari, Attila Doroszlai, Di Li, Vishal Ghugare, Henning Kropp, Robert Levas, and Tim Thorpe.
> 
> 
> Bugs: AMBARI-20760
>     https://issues.apache.org/jira/browse/AMBARI-20760
> 
> 
> Repository: ambari
> 
> 
> Description
> -------
> 
> After setting up PAM, tried to login as PAM user and access hive view, user home test fails with the error as in screen shot.
> 
> This issue was pointed out by Henning Kropp in the jira AMBARI-12263, but was not incorporated in the code. Pasting the comment from Henning below.
> 
> Something we noticed is that in a secured cluster we have issues with the views, getting the following exception for the Hive view as an example:
> 
> Struct:TOpenSessionResp(status:TStatus(statusCode:ERROR_STATUS, infoMessages:[*org.apache.hive.service.cli.HiveSQLException:Failed to validate proxy privilege of ambari for org.apache.ambari.server.security.authorization.AmbariPamAuthenticationProvider$1@34511119:33:32,
> .....
> sqlState:08S01, errorCode:0, errorMessage:Failed to validate proxy privilege of ambari for org.apache.ambari.server.security.authorization.AmbariPamAuthenticationProvider$1@34511119), serverProtocolVersion:null)
> 
> As you can see it tries to impersonte "org.apache.ambari.server.security.authorization.AmbariPamAuthenticationProvider$1@34511119:33:32". Changing the UsernamePasswordAuthenticationToken from Principal to username fixes this.
> 
> So instead of :
> 
> UsernamePasswordAuthenticationToken token = new UsernamePasswordAuthenticationToken(principal, null, userAuthorities);
> 
> We use:
> 
> UsernamePasswordAuthenticationToken token = new UsernamePasswordAuthenticationToken(user.getUserName(), null, userAuthorities);
> 
> What could potential also work is, overriding toString of the principal like:
> 
> Principal principal = new Principal() {
> @Override
> public String getName()
> { return user.getUserName(); }
> 
> @Override
> public String toString()
> { return user.getUserName().toString(); }
> 
> };
> 
> We did not test this!
> 
> 
> Diffs
> -----
> 
>   ambari-server/src/main/java/org/apache/ambari/server/security/authorization/AmbariPamAuthenticationProvider.java ca7cd31 
>   ambari-server/src/test/java/org/apache/ambari/server/security/authorization/AmbariPamAuthenticationProviderTest.java 5b3acd0 
> 
> 
> Diff: https://reviews.apache.org/r/58429/diff/2/
> 
> 
> Testing
> -------
> 
> Ran mvn test and also manually tested the scenario
> 
> 
> File Attachments
> ----------------
> 
> error screenshot
>   https://reviews.apache.org/media/uploaded/files/2017/04/13/4a43b897-e030-41a7-b702-f711432b03b9__error.PNG
> 
> 
> Thanks,
> 
> Anita Jebaraj
> 
>