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

I want to log with ssh-remote #1099

Closed
soma-yoshida opened this issue Aug 5, 2019 · 4 comments
Closed

I want to log with ssh-remote #1099

soma-yoshida opened this issue Aug 5, 2019 · 4 comments
Labels
*duplicate Issue identified as a duplicate of another issue(s) info-needed Issue requires more information from poster

Comments

@soma-yoshida
Copy link

I would like to develop using ssh-remote, but
I have to log the terminal.
I configured the shell to work after logging in with the script command added to Force command of / etc / ssh / sshd_config to log the terminal.
Installation of ssh-remote code-server fails.
I want to get the terminal log when I connect to the server with ssh-remote. Is there any better way?

@roblourens
Copy link
Member

I have to log the terminal.

Sorry I don't understand what you mean by this. Can you explain some more?

@roblourens roblourens added the info-needed Issue requires more information from poster label Aug 8, 2019
@soma-yoshida
Copy link
Author

What I want to do is to run the login script when accessing vm with remote-ssh from vscode.
I want to execute the script command in the login script.

@roblourens
Copy link
Member

Oh ok, #141

@roblourens roblourens added the *duplicate Issue identified as a duplicate of another issue(s) label Aug 17, 2019
@soma-yoshida
Copy link
Author

soma-yoshida commented Aug 28, 2019

Excuse me.
Instead of reflecting the environment, we want to execute the command.
I received that this is not the answer, is it wrong?
For example, I want to run the following shell, but it is not possible.
And $ SSH_ORIGINAL_COMMAND
It did not move even if I excluded.

# Check that the SSH client did not supply a command
if [[ -z $SSH_ORIGINAL_COMMAND ]]; then
 
  # The format of log files is /var/log/bastion/YYYY-MM-DD_HH-MM-SS_user
  LOG_FILE="`date --date="today" "+%Y-%m-%d_%H-%M-%S"`_`whoami`"
  LOG_DIR="/var/log/bastion/"
 
  # Print a welcome message
  echo ""
  echo "NOTE: This SSH session will be recorded"
  echo "AUDIT KEY: $LOG_FILE"
  echo ""
 
  # I suffix the log file name with a random string. I explain why later on.
  SUFFIX=`mktemp -u _XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX`
 
  # Wrap an interactive shell into "script" to record the SSH session
  script -qf --timing=$LOG_DIR$LOG_FILE$SUFFIX.time $LOG_DIR$LOG_FILE$SUFFIX.data --command=/bin/bash
 
else
 
  # The "script" program could be circumvented with some commands (e.g. bash, nc).
  # Therefore, I intentionally prevent users from supplying commands.
 
  echo "This bastion supports interactive sessions only. Do not supply a command"
  exit 1
 
fi

@vscodebot vscodebot bot locked and limited conversation to collaborators Oct 1, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
*duplicate Issue identified as a duplicate of another issue(s) info-needed Issue requires more information from poster
Projects
None yet
Development

No branches or pull requests

2 participants