Skip to content

ZEPPELIN-1701: User impersonation not work with SPARK_HOME set. - #1672

Closed
prabhjyotsingh wants to merge 8 commits into
apache:masterfrom
prabhjyotsingh:ZEPPELIN-1701
Closed

ZEPPELIN-1701: User impersonation not work with SPARK_HOME set.#1672
prabhjyotsingh wants to merge 8 commits into
apache:masterfrom
prabhjyotsingh:ZEPPELIN-1701

Conversation

@prabhjyotsingh

@prabhjyotsinghprabhjyotsingh commented Nov 23, 2016

Copy link
Copy Markdown
Contributor

What is this PR for?

User impersonation of front end user does not work with SPARK_HOME set.

What type of PR is it?

[Bug Fix | Hot Fix]

Todos

  • - Fix log file permission issue

What is the Jira issue?

How should this be tested?

set SPARK_HOME zeppelin-env.sh and then try to run

%spark
System.getProperty("user.name")

Screenshots (if appropriate)

Questions:

  • Does the licenses files need update? N/A
  • Is there breaking changes for older versions? N/A
  • Does this needs documentation? Yes

@prabhjyotsingh

Copy link
Copy Markdown
ContributorAuthor

CC: @zjffdu can you help review this.

@zjffdu

Copy link
Copy Markdown
Contributor

It still doesn't work for me.
This is the error I get, it seems permission issue because it use another user to run the interpreter process.

DEBUG [2016-11-23 16:13:06,100] ({Exec Stream Pumper} RemoteInterpreterManagedProcess.java[processLine]:189) - java.io.FileNotFoundException: /Users/jzhang/github/zeppelin/logs/zeppelin-interpreter-spark-jzhang-jzhangMBPr.local.log (Permission denied)

@prabhjyotsingh

Copy link
Copy Markdown
ContributorAuthor

can you try

chmod 777 /Users/jzhang/github/zeppelin/logs/zeppelin-interpreter-spark-jzhang-jzhangMBPr.local.log

@zjffdu

Copy link
Copy Markdown
Contributor

I can do that, but it doesn't make sense to force user to do that.

@prabhjyotsingh

Copy link
Copy Markdown
ContributorAuthor

I assumed this log file should have group permission to log into this file. What do you recommend ?

@zjffdu

Copy link
Copy Markdown
Contributor

I found another crtitical issue is that all the enviroment variables defined in zeppelin-env.sh (like HADOOP_CONF_DIR) won't be passed to the interpreter process because you use ssh. This will cause interpreter process fail to start.

@prabhjyotsingh

Copy link
Copy Markdown
ContributorAuthor

I think that should be fine;

...
ZEPPELIN_INTP_CLASSPATH+=":${HADOOP_CONF_DIR}"
...
CLASSPATH+=":${ZEPPELIN_INTP_CLASSPATH}"
...
SPARK_SUBMIT_RUN=` echo ${SPARK_SUBMIT} --class ${ZEPPELIN_SERVER} --driver-class-path \"${ZEPPELIN_INTP_CLASSPATH_OVERRIDES}:${CLASSPATH}\" --driver-java-options \"${JAVA_INTP_OPTS}\" ${SPARK_SUBMIT_OPTIONS} ${SPARK_APP_JAR} ${PORT}`
...

https://github.com/apache/zeppelin/blob/master/bin/interpreter.sh#L171
https://github.com/apache/zeppelin/blob/master/bin/interpreter.sh#L186
https://github.com/apache/zeppelin/pull/1672/files#diff-8d3bd42a5de342ebad38e1d113d9f75cR189

@zjffdu

Copy link
Copy Markdown
Contributor

Actually it doesn't work for spark interpreter if you try that. https://github.com/apache/zeppelin/blob/master/bin/interpreter.sh#L171 is for pig. And it is not safe if we add other enviroment variables that is not in classpath. Could we run zeppelin-env.sh after ssh ?

@prabhjyotsingh

Copy link
Copy Markdown
ContributorAuthor

I see your point, let me check that.

@prabhjyotsinghprabhjyotsingh changed the title ZEPPELIN-1701: User impersonation not work with SPARK_HOME set.[WIP] ZEPPELIN-1701: User impersonation not work with SPARK_HOME set.Nov 23, 2016
@prabhjyotsinghprabhjyotsingh changed the title [WIP] ZEPPELIN-1701: User impersonation not work with SPARK_HOME set.ZEPPELIN-1701: User impersonation not work with SPARK_HOME set.Nov 25, 2016
@prabhjyotsingh

prabhjyotsingh commented Nov 25, 2016

Copy link
Copy Markdown
ContributorAuthor

@zjffdu Here is what I've done

Can you review this and/or suggest more changes.

@felixcheung

Copy link
Copy Markdown
Member

as an aside, I'd update the JIRA/PR - it might not be obvious what "when SPARK_HOME is set" means. If external Spark is broken then I think it is a much much serious problem :)

@prabhjyotsingh

prabhjyotsingh commented Nov 28, 2016

Copy link
Copy Markdown
ContributorAuthor

This is ready for review, have checked this in few flavours of linux, and it was working as expected.

I'll add more documentation in a while.

@zjffdu

Copy link
Copy Markdown
Contributor

@prabhjyotsingh It works now, but log file permission issue is still here which make the spark interpreter fail to run unless user manually set permission

@prabhjyotsingh

Copy link
Copy Markdown
ContributorAuthor

@zjffdu did you try it again, as this is working for me, or if you can let me know your environment I can try on the same.

@r-kamath

Copy link
Copy Markdown
Member

LGTM 👍

@Leemoonsoo

Copy link
Copy Markdown
Member

#1704 changes the filename processenduser.md to userimpersonation.md. Could you resolve conflict?

@prabhjyotsingh

Copy link
Copy Markdown
ContributorAuthor

@Leemoonsoo resolved conflict. Thank you for the quick fix.

Comment threadbin/interpreter.sh
CLASSPATH+=":${ZEPPELIN_INTP_CLASSPATH}"

if [[ ! -z "$ZEPPELIN_IMPERSONATE_USER" ]]; then
INTERPRETER_RUN_COMMAND=${ZEPPELIN_IMPERSONATE_RUN_CMD}" '"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this seem tricky so maybe I'm missing something, we are appending ' here?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and this follows immediately with source in L195, so it will be 'source - no space between ' and source?

@prabhjyotsinghprabhjyotsinghNov 30, 2016

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes the ' starts here (L193) and ends at L206. I can add a space between ' and source but since it was working I didn't do it.

@prabhjyotsingh

Copy link
Copy Markdown
ContributorAuthor

Merging this if no more discussion.

@asfgitasfgit closed this in d1fc86bDec 2, 2016
@zjffdu

Copy link
Copy Markdown
Contributor

@prabhjyotsingh I can not run pyspark interpreter. Can you try that in your enviroment ?

@zjffdu

Copy link
Copy Markdown
Contributor

Please ignore it,I can ran it successfully now.

@prabhjyotsingh

Copy link
Copy Markdown
ContributorAuthor

Thank you for the verification.

@prabhjyotsingh
prabhjyotsingh deleted the ZEPPELIN-1701 branch February 25, 2018 03:47
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants

@prabhjyotsingh@zjffdu@felixcheung@r-kamath@Leemoonsoo