gravitational / teleport

The easiest, and most secure way to access and protect all of your infrastructure.
https://goteleport.com
GNU Affero General Public License v3.0
17.29k stars 1.73k forks source link

Add Code Examples of automated SSH workflows with Teleport using Go #5489

Closed pschisa closed 1 month ago

pschisa commented 3 years ago

Documentation request: Request to have documentation or examples provided for using Teleport with Go to perform simple automated SSH workflows such as establishing an ssh session with teleport and running some commands over the established session.

ptgott commented 1 year ago

@pschisa Just to make sure I understand, does "teleport" mean the Proxy Service, a host running the SSH Service, or both? What would be some examples of commands to run? Thanks!

pschisa commented 1 year ago

The intention was to provide an example in golang utilizing the API to perform a functional action like retrieve/reference credentials, ssh in to a node, and execute a command.

ptgott commented 1 year ago

@pschisa When would users want to build a custom API client for retrieving credentials and SSHing into a host vs., say, managing host certificates via Machine ID (https://goteleport.com/docs/machine-id/guides/host-certificate/) and using a standard SSH client to access the host?

strideynet commented 1 month ago

I figure that we'd be better off documenting the use of Machine ID (rather than directly interacting with the Teleport API) with tools like Ansible / common libraries for Python/Go etc. To some extent, we could consider the Ansible element of this done and just throw together some quick references on using the Machine ID SSH multiplexer with Go or Python.