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

[bash.bashrc] Add reverse SSH script to bash.bashrc #5438

Merged
merged 3 commits into from
Nov 24, 2020

Conversation

Blueve
Copy link
Contributor

@Blueve Blueve commented Sep 23, 2020

- Why I did it

To support reverse SSH for console connection, we need to add the script to attach to console line automatically after user login with reverse SSH.
(see HLD for more detail: https://github.com/Azure/SONiC/blob/master/doc/console/SONiC-Console-Switch-High-Level-Design.md#313-reverse-ssh)

The script will be executed only when this feature is available in SONiC: Blueve/openssh-portable#1

- How I did it

Add script to /etc/bash.bashrc to support reverse ssh function.

- How to verify it

Functional Test

  • Test similar script on my WSL ubuntu (sudo picocom instead of sudo connect)
  • Test on Physical DUT with dummy environment variable
  • Build image with this change and test image on Physical DUT

- Which release branch to backport (provide reason below if selected)

  • 201811
  • 201911
  • 202006

- Description for the changelog

- A picture of a cute animal (not mandatory but encouraged)
image
My first pet. My cutest boy. My favorite friend, My family. My cat, the cat I'll never to be seen again... R.I.P Cloud·Cake (2020-09-24)

files/image_config/bash/bash.bashrc Outdated Show resolved Hide resolved
@Blueve
Copy link
Contributor Author

Blueve commented Sep 28, 2020

retest please

@Blueve Blueve marked this pull request as ready for review October 24, 2020 02:39
yxieca
yxieca previously approved these changes Oct 27, 2020
@Blueve
Copy link
Contributor Author

Blueve commented Oct 27, 2020

Hi @jleveque, I have updated the PR. Could you please take a look?

@jleveque jleveque requested a review from lguohan October 27, 2020 03:00
@Blueve
Copy link
Contributor Author

Blueve commented Nov 20, 2020

@yxieca @lguohan I've update the script.

Now it will exit directly when:

  • The SSH_TARGET_CONSOLE_LINE is not a number
  • The connect command returns a failure that the user input is invalid

And it will enter the session when:

  • The console switch feature is not enabled

@Blueve Blueve merged commit 6a6e583 into sonic-net:master Nov 24, 2020
@Blueve Blueve deleted the dev/jika/ressh branch November 24, 2020 06:12
santhosh-kt pushed a commit to santhosh-kt/sonic-buildimage that referenced this pull request Feb 25, 2021
* [bash.bashrc] Add reverse SSH script to bash.bashrc
* Fix command issue and add emptt line before EOF
* Add checks for SSH_TARGET_CONSOLE_LINE

Signed-off-by: Jing Kan [email protected]
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.

4 participants