Skip to content
Subject: Secure credential-silent SSH tunnel for private MySQL — Railway CLI 5.71.0
glenn5879
OP

6 days ago

Hi everyone,

We're migrating an application to Railway and need to connect a temporary local operator tool to a private MySQL 8.4 service.

We're using Railway CLI 5.71.0 and have three questions:

  1. Credential disclosure: railway connect --ssh --tunnel-only prints database credentials and the full connection URL. Is there a supported way to establish the tunnel without exposing these values in terminal output?

  2. Scoped credentials: Can we securely retrieve only MYSQLUSER and MYSQLPASSWORD for a specific service without fetching its entire variable map?

  3. SSH verification: What's the recommended way to verify Railway's SSH host identity and ensure the tunnel connects to the intended service and environment?

We already have our own MySQL CA and server certificate, with strict certificate-chain and hostname verification.

We don't want to expose MySQL publicly, weaken TLS security, or deploy a permanent bastion.

Has anyone implemented a secure workflow like this, or can someone from Railway clarify what's officially supported?

Thanks!

Solved$20 Bounty

Pinned Solution

For private database patterns, the closest fit is the Tailscale Forwarder, deployed only for the migration for example and deleted afterwards. The Console does solve the host-key problem, but it just moves the operator process off your machine, meaning the process would run inside the MySQL container.

Hope this helps!

4 Replies

Status changed to Awaiting Railway Response Railway • 6 days ago


Railway
BOT

6 days ago

This thread has been opened as a bounty so the community can help solve it.

Status changed to Open Railway • 6 days ago


  1. No, there's no flag or setting for it. --tunnel-only always prints the host, user, password and full URL.
  2. No, the API can't return just those two. The only queries that return values (variables and variablesForServiceDeployment) retrieve the whole list.
  3. The SSH server is a relay at ssh.railway.com. The SSH username is the service's ID, and it's used to route you to the right container.

darseen

1. No, there's no flag or setting for it. `--tunnel-only` always prints the host, user, password and full URL. 2. No, the API can't return just those two. The only queries that return values (`variables` and `variablesForServiceDeployment`) retrieve the whole list. 3. The SSH server is a relay at `ssh.railway.com`. The SSH username is the service's ID, and it's used to route you to the right container.

glenn5879
OP

6 days ago

Thanks, Darseen. That's very helpful and confirms the CLI and API limitations.

One final question: since Railway does not publish independently verifiable SSH host keys, would the authenticated Railway Dashboard Console be the safer supported alternative for a temporary operator process that needs private MySQL access?

Our challenge is that the same workflow also needs locally verified Google OAuth and Windows Hello approvals. We already have our own MySQL CA and enforce strict TLS hostname verification.

Is there an established Railway pattern for this without enabling a public database proxy or exposing database credentials through the CLI?

Thanks again!


For private database patterns, the closest fit is the Tailscale Forwarder, deployed only for the migration for example and deleted afterwards. The Console does solve the host-key problem, but it just moves the operator process off your machine, meaning the process would run inside the MySQL container.

Hope this helps!


darseen

For private database patterns, the closest fit is the Tailscale Forwarder, deployed only for the migration for example and deleted afterwards. The Console does solve the host-key problem, but it just moves the operator process off your machine, meaning the process would run inside the MySQL container. Hope this helps!

glenn5879
OP

6 days ago

Thanks, Darseen! Really appreciate the detailed answers and the Tailscale recommendation. This gives us a promising way forward. I'll mark your answer as the accepted solution. Cheers!


Status changed to Solved 0x5b62656e5d • 4 days ago


Welcome!

Sign in to your Railway account to join the conversation.

Loading...