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

Add sonic-launch-shell to invoke appropriate shell based upon user's … #14466

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/sh
# Launch the "preferred" shell based on the groups that the user belongs to.
# The preferred shell is either:
# /bin/bash: If the user belongs to group "admin"
# /usr/bin/sonic-cli: Otherwise

# Uncomment "set -x" for debugging
#set -x

if /usr/bin/id -Gn | tr " " "\n" | /bin/grep -qw "^admin$"; then
exec /bin/bash "$@"
else
exec /usr/bin/sonic-cli

Choose a reason for hiding this comment

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

Current sonic-cli does not provide all commands supported, like the Click commands. Hence, it is not a good idea to launch sonic-cli for remote user. Instead, bash shall be launched where the user can perform CRUD operations via Click commands.

Also, for TACACS, bash is being launched now. Hence to maintain consistency across all remote users, we shall retain TACACS shell launch behavior for RADIUS too.

#13141 addressing the proper approach.

fi
1 change: 1 addition & 0 deletions rules/docker-sonic-mgmt-framework.mk
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ $(DOCKER_MGMT_FRAMEWORK)_RUN_OPT += -v /var/run/dbus:/var/run/dbus:rw
$(DOCKER_MGMT_FRAMEWORK)_RUN_OPT += --mount type=bind,source="/var/platform/",target="/mnt/platform/"

$(DOCKER_MGMT_FRAMEWORK)_BASE_IMAGE_FILES += sonic-cli:/usr/bin/sonic-cli
$(DOCKER_MGMT_FRAMEWORK)_BASE_IMAGE_FILES += sonic-launch-shell:/usr/bin/sonic-launch-shell

SONIC_BUSTER_DOCKERS += $(DOCKER_MGMT_FRAMEWORK)
SONIC_BUSTER_DBG_DOCKERS += $(DOCKER_MGMT_FRAMEWORK_DBG)