When logging in via sso on the command line, tsh will open the URL using the operating system's default browser.
If for whatever reason, the browser does not open or you get some other unexpected behavior, it is helpful to know what tsh is actually doing to launch the system's default web browser.
This information can be used to mimic what tsh is doing and see if the unexpected behavior is repeatable.
Mac
tsh will execute:
open http://127.0.0.1:44407/d4eda9e7-394b-4034-9274-82af6418a000
By default, open
is at /usr/bin/open
on a mac. This binary's man page describes its behavior as "The open command opens a file (or a directory or URL), just as if you had double-clicked the file's icon."
Linux
tsh will execute:
xdg-open http://127.0.0.1:44407/d4eda9e7-394b-4034-9274-82af6418a000
The xdg-open
command is part of the xdg-utils
package, which is part of the cross-desktop group to allow interoperability across multiple graphical desktop environments (such as KDE, Gnome, etc).
The xdg-open
command is at /usr/bin/xdg-open
in many distributions, but Teleport will respect the $PATH
variable.
Windows
tsh will execute:
rundll32.exe url.dll,FileProtocolHandler http://127.0.0.1:44407/d4eda9e7-394b-4034-9274-82af6418a000
rundll32.exe
is a Microsoft utility to call functions in dll files: https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/rundll32url.dll
has the FileProtocolHandler function that will take an argument and open it by invoking the default web browser in Windows.
This is implemented in the SSHAgentSSOLogin
function in lib/client/weblogin.go in the teleport codebase.
Comments
0 comments
Article is closed for comments.