Skip to content

Conversation

@prabhjyotsingh
Copy link
Contributor

@prabhjyotsingh prabhjyotsingh commented Oct 23, 2016

Have recreated this from #1322

What is this PR for?

While running a Notebook using shell, spark, python uses same user as which zeppelin server is running. Which means these interprets have same permission on file system as zeppelin server.
IMO users should be able to impersonate themselves as a complete security system.

What type of PR is it?

[Improvement]

Todos

  • - Update doc
  • - FIX NPEs
  • - FIX CI

What is the Jira issue?

How should this be tested?

  • Enable shiro auth in shiro.ini
  • Add ssh key for the same user you want to try and impersonate (say user1).
adduser user1
ssh-keygen
ssh user1@localhost mkdir -p .ssh
cat ~/.ssh/id_rsa.pub | ssh user1@localhost 'cat >> .ssh/authorized_keys'
  • Start zeppelin server, try and run following in paragraph in a notebook
  • Go to interpreter setting page, and enable "User Impersonate" in any of the interpreter (in my example its shell interpreter)
%sh
whoami

Check that it should run as new user, i.e. "user1"

Screenshots (if appropriate)

user impersonate

Questions:

  • Does the licenses files need update? no
  • Is there breaking changes for older versions? no
  • Does this needs documentation? yes

@prabhjyotsingh prabhjyotsingh changed the title [ZEPPELIN-1320] Run zeppelin interpreter process as web front end user [WIP] [ZEPPELIN-1320] Run zeppelin interpreter process as web front end user Oct 23, 2016
@prabhjyotsingh
Copy link
Contributor Author

prabhjyotsingh commented Oct 23, 2016

know issue: restart of interpreter does not work as expected.

@Leemoonsoo
Copy link
Member

@prabhjyotsingh Do you think is there a way to impersonate without adding ssh key when user logged in using PAM authentication #1589?

@prabhjyotsingh
Copy link
Contributor Author

Sure let me check, I think it could be possible.

@prabhjyotsingh prabhjyotsingh changed the title [WIP] [ZEPPELIN-1320] Run zeppelin interpreter process as web front end user [ZEPPELIN-1320] Run zeppelin interpreter process as web front end user Nov 11, 2016
@prabhjyotsingh
Copy link
Contributor Author

Updated screen shot, ready for review.

@Leemoonsoo I'll try to take care of "PAM authentication" in a different PR.

@r-kamath
Copy link
Member

@prabhjyotsingh LGTM.
Thanks for the documentation.

getZeppelinVersion
;;
u)
ZEPPELIN_SSH_COMMAND="ssh ${OPTARG}@localhost "
Copy link
Member

@Leemoonsoo Leemoonsoo Nov 15, 2016

Choose a reason for hiding this comment

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

How about make ZEPPELIN_SSH_COMMAND configurable? because some user may run ssh in non standard port, some user may even want to use different command, like sudo, to impersonate.

The idea is, we can make this part just get impersonate user

u)
    ZEPPELIN_IMPERSONATE_USER="${OPTARG}"

and then we can define ZEPPELIN_IMPERSONATE_CMD from bin/common.sh in configurable way

if [[ -z "$ZEPPELIN_IMPERSONATE_CMD" ]]; then
  ZEPPELIN_IMPERSONATE_CMD=`echo "ssh ${ZEPPELIN_IMPERSONATE_USER}@localhost"`
else
  ZEPPELIN_IMPERSONATE_CMD=$(eval "echo ${ZEPPELIN_IMPERSONATE_CMD}")
fi

So user can override ZEPPELIN_IMPERSONATE_CMD in conf/zeppelin-env.sh or inside of interpreter property, for example

ZEPPELIN_IMPERSONATE_CMD='sudo -u ${ZEPPELIN_IMPERSONATE_USER}'

what do you think?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, sure, that totally make sense. I'll do it right away.

@Leemoonsoo
Copy link
Member

LGTM and merge to master if there're no further comments.

@asfgit asfgit closed this in 31f584c Nov 18, 2016
tae-jun pushed a commit to tae-jun/zeppelin that referenced this pull request Nov 23, 2016
Have recreated this from apache#1322
### What is this PR for?

While running a Notebook using shell, spark, python uses same user as which zeppelin server is running. Which means these interprets have same permission on file system as zeppelin server.
IMO users should be able to impersonate themselves as a complete security system.
### What type of PR is it?

[Improvement]
### Todos
- [x] - Update doc
- [x] - FIX NPEs
- [x] - FIX CI
### What is the Jira issue?
- [ZEPPELIN-1320](https://issues.apache.org/jira/browse/ZEPPELIN-1320)
### How should this be tested?
- Enable shiro auth in shiro.ini
- Add ssh key for the same user you want to try and impersonate (say user1).

```
adduser user1
ssh-keygen
ssh user1localhost mkdir -p .ssh
cat ~/.ssh/id_rsa.pub | ssh user1localhost 'cat >> .ssh/authorized_keys'
```
- Start zeppelin server, try and run following in paragraph in a notebook
- Go to interpreter setting page, and enable "User Impersonate" in any of the interpreter (in my example its shell interpreter)

```
%sh
whoami
```

Check that it should run as new user, i.e. "user1"
### Screenshots (if appropriate)

![user impersonate](https://cloud.githubusercontent.com/assets/674497/20213127/f32fdc52-a82c-11e6-8e33-aebd6a943c5f.gif)

### Questions:
- Does the licenses files need update? no
- Is there breaking changes for older versions? no
- Does this needs documentation? yes

Author: Prabhjyot Singh <[email protected]>

Closes apache#1554 from prabhjyotsingh/ZEPPELIN-1320-2 and squashes the following commits:

dc69c9d [Prabhjyot Singh] @Leemoonsoo review comment: making ZEPPELIN_SSH_COMMAND configurable
1b26cc0 [Prabhjyot Singh] add doc
5a76839 [Prabhjyot Singh] show User Impersonate only when interpreter setting is "per user" and "isolated"
02c3084 [Prabhjyot Singh] Merge remote-tracking branch 'origin/master' into ZEPPELIN-1320-2
03b2f20 [Prabhjyot Singh] use user instead of ""
0ff80ec [Prabhjyot Singh] Merge remote-tracking branch 'origin/master' into ZEPPELIN-1320-2
dd0731d [Prabhjyot Singh] fix missing test cases
aff1bf0 [Prabhjyot Singh] user should have option to run these interpreters as different user.
asfgit pushed a commit that referenced this pull request Nov 29, 2016
### What is this PR for?
#1554 added a `processenduser.md`, but the navigation menu different name on it's link `userimpersonation.html`

This PR changes filename from `processenduser.md` to `userimpersonation.md`.

### What type of PR is it?
Hot Fix

### Todos
* [x] - Change file name

### What is the Jira issue?
#1554

### How should this be tested?
build docs and navigate "Interpreter -> Interpreter User Impersonation"

### Screenshots (if appropriate)

### Questions:
* Does the licenses files need update? no
* Is there breaking changes for older versions? no
* Does this needs documentation? no

Author: Lee moon soo <[email protected]>

Closes #1704 from Leemoonsoo/fix_link and squashes the following commits:

8ede96e [Lee moon soo] Change filename
@prabhjyotsingh prabhjyotsingh deleted the ZEPPELIN-1320-2 branch February 25, 2018 03:46
Sign up for free to 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.

3 participants