Debugging OSS Teleport with Dlv and VSCode #5629
stevenGravy
started this conversation in
Show and tell
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
If you're experiencing an issue or just curious here are steps to setup debugging with Teleport OSS. The examples here were done in a Ubuntu 20.04.2.0 desktop env on Teleport V6 alpha-2. This example shows running with
sudo. You can certainly run withoutsudoif you choose not to do assh_serviceand use folders your user owns.Ex Debugging:
Prerequisites:
makesudorights on the machine1. Clone the current master
If you are investigating an issue on a particular version pull that branch.
2. Confirm Teleport build
make fullshould produce Teleport executes in
buildfolder withtctl,teleport, andtsh.3. Configure Teleport.yaml
If you don't already have a teleport instance here is a sample configuration to start with.
/etc/teleport.yamlBuild with Debug enabled
Open VSCode
Add a attach option
{ "version": "0.2.0", "configurations": [ { "name": "Attach", "type": "go", "request": "attach", "mode": "remote", "remotePath": "", "port":2345, "host":"127.0.0.1", "showLog": true, "trace": "log", "logOutput": "rpc" } ] }Start Teleport with dlv
Return to VSCode and Start Attach
Set a breakpoint in function
CheckAndSetDefaultsinlib/auth/resetpasswordtoken.goor another location you're interested in.Start the Attach launch configuration. You may need to do Restart on the debug menu to start Teleport.
Create a user and then reset
The breakpoint will be triggered.

Step through or continue.
Ready to exit
When you're ready to exit
Additional:
If you'd like to run or debug from VSCode directly you can configure other launch configurations.
{ "name": "TshLogin", "type": "go", "request": "launch", "mode": "auto", "program": "${fileDirname}", "env": {}, "args": ["login", "--proxy=teleport.example.com"] }Open the
tool/tsh/tsh.goand run this Launch configuration.Beta Was this translation helpful? Give feedback.
All reactions