Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KNOX-2631 - Webshell #639

Merged
merged 77 commits into from Oct 21, 2022
Merged

KNOX-2631 - Webshell #639

merged 77 commits into from Oct 21, 2022

Conversation

moresandeep
Copy link
Contributor

@moresandeep moresandeep commented Sep 28, 2022

What changes were proposed in this pull request?

This feature enables shell access to the machine running Apache Knox. Users can SSO into Knox and then access shell using the KnoxShell URL on knox homepage.

image

image

Configuration:
Webshell is not turned on by default. To enable Webshell following properties needs to be changed in gateway-site.xml

 <property>
        <name>gateway.websocket.feature.enabled</name>
        <value>true</value>
        <description>Enable/Disable websocket feature.</description>
    </property>

<property>
        <name>gateway.webshell.feature.enabled</name>
        <value>true</value>
        <description>Enable/Disable webshell feature.</description>
    </property>
<!-- in case JWT cookie validation for websockets is needed -->
<property>
        <name>gateway.websocket.JWT.validation.feature.enabled</name>
        <value>true</value>
        <description>Enable/Disable websocket JWT validation feature.</description>
    </property>

Create a sudoers file /etc/sudoers.d/knox with entries for all the users that need webshell acess. e.g. the following config file let's user sam login to webshell. Further restrictions on what user sam
can do can be performed with sudoers file. More info: https://linux.die.net/man/5/sudoers

Defaults env_keep += JAVA_HOME
Defaults always_set_home
knox ALL=(sam:ALL) NOPASSWD: /bin/bash
knox ALL=(knoxui:ALL) NOPASSWD: /bin/bash

How was this patch tested?

This patch was tested on my local machine.

…n logic, WebshellWebsocketAdapter extend ProxyWebSocketAdapter
# Conflicts:
#	pom.xml
@moresandeep moresandeep changed the title KNOX-2631 - Webshell WIP KNOX-2631 - Webshell Sep 28, 2022
@moresandeep moresandeep changed the base branch from webshell to master September 28, 2022 14:08
@moresandeep moresandeep changed the title WIP KNOX-2631 - Webshell KNOX-2631 - Webshell Oct 2, 2022
Copy link
Contributor

@lmccay lmccay left a comment

Choose a reason for hiding this comment

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

Looks good, asked some questions and we need to update the LICENSE file for pty4j EPLv1 license.

@moresandeep
Copy link
Contributor Author

Thanks @lmccay ! For license I added Pty4j to the existing EPLv1 license text, is that fine or should I be copying the entire license text? There is no language in the license that indicates I need a separate copy as long as we clearly indicate that Pty4j uses EPLv1 license (followed by the license text)

Copy link
Contributor

@smolnar82 smolnar82 left a comment

Choose a reason for hiding this comment

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

LGTM

@moresandeep moresandeep merged commit 070ccf3 into apache:master Oct 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
5 participants