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 command line flag to prevent 'tsh login' from opening a browser #3321

Closed
clement-escolano opened this issue Feb 3, 2020 · 8 comments · Fixed by #3611
Closed

Add command line flag to prevent 'tsh login' from opening a browser #3321

clement-escolano opened this issue Feb 3, 2020 · 8 comments · Fixed by #3611
Labels
feature-request Used for new features in Teleport, improvements to current should be #enhancements good-starter-issue Good starter issue to start contributing to Teleport tsh tsh - Teleport's command line tool for logging into nodes running Teleport.

Comments

@clement-escolano
Copy link

What happened:
I logged in by running: tsh --proxy=teleport.corp.blablacar.com login.
My default browser Safari opened.

What you expected to happen:
Nothing (or at least an option to open a specific browser or no browser).

How to reproduce it (as minimally and precisely as possible):
Just run tsh --proxy=teleport.corp.blablacar.com login.

Environment:

  • Teleport version (use teleport version): Teleport v4.2.2 git: go1.13.6
  • Tsh version (use tsh version): Teleport v4.2.2 git: go1.13.6
  • OS (e.g. from /etc/os-release): macOS 10.14

Browser environment

  • Browser Version (for UI-related issues): Safari 12
  • Install tools: ?
  • Others: ?
@webvictim
Copy link
Contributor

Your browser needs to be open in order to actually pass the authentication data from the identity provider back to Teleport, so I don't think what you're asking is possible.

@clement-escolano
Copy link
Author

I know that I need to open some browser to authenticate.
However, the default browser on my computer is not the one I use to authenticate. So everytime I want to login, Safari opens above everything, I have to close it then enter the link in the shell inside my other browser.
If there was an option to do nothing, I could just get the link and then paste it in my browser.

@webvictim
Copy link
Contributor

webvictim commented Feb 3, 2020

On OS X, tsh just calls open http://127.0.0.1:12345/etc to load the browser, so it'll use whatever your default browser is set to. On Linux it uses xdg-open, on Windows rundll32.exe url.dll,FileProtocolHandler etc.

Is changing your default browser to the correct one not an option?

@webvictim
Copy link
Contributor

At any rate, adding a command-line flag to say "don't open the browser for me" is probably the easiest way to fix this and should be fairly easy to do.

@webvictim webvictim added the feature-request Used for new features in Teleport, improvements to current should be #enhancements label Feb 3, 2020
@webvictim webvictim changed the title Prevent Teleport to open my browser everytime Add command line flag to prevent 'tsh login' from opening a browser Feb 3, 2020
@webvictim webvictim added the good-starter-issue Good starter issue to start contributing to Teleport label Feb 4, 2020
@clement-escolano
Copy link
Author

Thank you for your answers.

On OS X, tsh just calls open http://127.0.0.1:12345/etc to load the browser, so it'll use whatever your default browser is set to. On Linux it uses xdg-open, on Windows rundll32.exe url.dll,FileProtocolHandler etc.

I tried to alias open to something else to prevent the opening of the browser but it didn't work unfortunately.

Is changing your default browser to the correct one not an option?

I have a browser for work (the one with authentication) and another for personal life (the default one). That's why I would like to keep separated the two.

@hooksie1
Copy link
Contributor

I'd like to take a stab at a PR for this. Looks like I need to add the flag for login, add a boolean to the TeleportClient and the Config structs, and then just check if it's true or false. Do you want the output to be different? Instead of saying "If browser window doesn't open automatically...", just say "click the following URL".

@webvictim
Copy link
Contributor

Yes, if the auto-open behaviour is suppressed then the message should be changed to indicate that the URL needs to be clicked manually.

@hooksie1
Copy link
Contributor

Opened PR #3611 for this.

@benarent benarent linked a pull request Apr 23, 2020 that will close this issue
@benarent benarent added the tsh tsh - Teleport's command line tool for logging into nodes running Teleport. label Apr 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request Used for new features in Teleport, improvements to current should be #enhancements good-starter-issue Good starter issue to start contributing to Teleport tsh tsh - Teleport's command line tool for logging into nodes running Teleport.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants