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

Use original user/host/port when invoking plugins #4

Open
turicas opened this issue May 6, 2012 · 2 comments
Open

Use original user/host/port when invoking plugins #4

turicas opened this issue May 6, 2012 · 2 comments
Assignees
Labels
Milestone

Comments

@turicas
Copy link
Owner

turicas commented May 6, 2012

When a client connects to a remote machine using sbc ssh, sbc creates a file named $HOME/.sbc/config on remote with some environment variables that tell remote sbc which username and port to use when connecting to local machine to execute a plugin. sbc also gets remote machine's host and port from SSH_CONNECTION environment variable (on remote) and send it to the plugin on local machine, so the plugin can use it to create other connects (the cp plugin uses it to copy files using scp, for example).
The bug appears when you connect to a remote machine using another IP/port pair than that pair in SSH_CONNECTION (it can happen if you have a port-forward in the middle of the connection). So, remote machine will think as you connected to that IP/port (because ot received the connection from there) but local machine connected to another IP/port (which was forwarded by the middle machine).
To solve this bug sbc should record on remote machine the original user/host/port used on sbc ssh and use it instead of SSH_CONNECTION.

@turicas
Copy link
Owner Author

turicas commented May 7, 2012

Probably the best option is to parse $@ before connecting to get user, hostname and port, since we can't know the real user, port and hostname used in remote machine. getopt and getops can help in this case.

@turicas turicas closed this as completed in d970777 May 7, 2012
@turicas turicas reopened this May 17, 2012
@turicas
Copy link
Owner Author

turicas commented May 17, 2012

It must use the same username/password/port provided in SSH command - if some of them was not provided, sbc should not use them explicitly (because user can have some specific configuration on ~/.ssh/config). For example, the parser is wrong when no username is provided, try: sbc ssh host
The bug is that it'll use ssh $USER@host instead of only ssh host to execute sbc plugins - it is wrong because I can have the UserName setting in my ~/.ssh/cofing for something different from $USER.

@ghost ghost assigned turicas Jul 21, 2012
@turicas turicas modified the milestones: 0.1.0, 0.2.0 Aug 17, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant