Rails Console Access via Teleport
Use this guide to open a Rails console session using Teleport’s tsh
command-line tool. If you prefer, you can alternatively open a session directly
through the
web UI.
Prerequisites
Section titled “Prerequisites”- Teleport access via Okta (see getting access).
tshis installed (see installation instructions).
Process
Section titled “Process”Request access
Section titled “Request access”-
Identify the role you need:
Env Access type Role Non-prod Read-only No request needed, skip to Log in. Prod Read-only prod-rails-console-ro -
Log in to Teleport:
Terminal window tsh login --proxy=production.teleport.gitlab.net -
Request the role:
Terminal window tsh request create \--roles=<Role> \--reason="<GitLab issue URL / ZenDesk ticket URL>" -
An automated message will appear in the #teleport-requests Slack channel. If you’re a member of Engineering or Security, tag your direct manager to review the request. Otherwise, ask in the #eng-managers channel for review by any available engineering manager.
For more information, refer to the Teleport Approver Workflow.
-
Once approved, the Slack bot will notify you in #teleport-requests.
Log in
Section titled “Log in”-
Log in to
tshagain, providing the ID of your approved access requestTerminal window tsh login --request-id=<request-id> -
Open an SSH session to the target rails host:
Terminal window tsh ssh <username>@<hostname> # see below table for <username> & <hostname>Env Access type username hostname Non-prod Read-only rails-ro console-ro-01-sv-gstg Prod Read-only rails-ro console-ro-01-sv-gprd
Next Steps
Section titled “Next Steps”- Access requests are temporary and expire after 12 hours, but may be used across multiple sessions. Renew it before or after expiration using the same request process.
- Learn about tsh’s features in Teleport’s docs.
Support
Section titled “Support”- For help with Teleport or the approval process, ask in #security_help.
- To report a Teleport bug, open an issue with Infrastructure Security.
Troubleshooting
Section titled “Troubleshooting”tsh request create timed out
Section titled “tsh request create timed out”tsh request create will wait for approval and return once the request is
approved, denied, or expires.
If it times out before a decision, check #teleport-requests slack channel or the Teleport Web UI for the request ID — you don’t need to re-request if it was approved.
Terminal type error
Section titled “Terminal type error”Symptom:
[WARNING] Could not load command "rails/commands/console/console_command". Error: The terminalcould not be found, or that it is a generic type, having too little information for cursesapplications to run.Fix: Set TERM to xterm-256color:
TERM=xterm-256color tsh ssh rails-ro@console-ro-01-sv-gprdError: failed to add one or more keys to the agent
Section titled “Error: failed to add one or more keys to the agent”See getting_access.md — Troubleshooting.
Verbose output
Section titled “Verbose output”tsh --debug ssh rails-ro@console-ro-01-sv-gprd