Editors and plain SSH
Ringleader keeps an SSH configuration for every workstation you can reach, so SSH tools and your editor connect by name.
Ringleader keeps an SSH configuration for every workstation you can reach, so SSH tools and
your editor connect by name. ssh, scp, rsync, git, JetBrains Gateway, Ansible and the
Remote-SSH extension of VS Code or Cursor then work with no rl in the loop. A workstation can
also run VS Code itself, which you open in a browser tab.
Ringleader’s SSH configuration
While the Ringleader background service runs, it writes an OpenSSH configuration for every
workstation you can reach. It rewrites that configuration as workstations are created,
started, stopped and deleted. You add it to your own SSH configuration once, with one
Include line.
That line points at Ringleader’s ~/.ringleader/ssh/config, which includes one .conf file
for each workstation. The service owns these files and regenerates them on every change. Each
file carries:
- The workstation’s current address, port and login user, refreshed when they change.
- A key that Ringleader keeps on your computer, as the
IdentityFile, withIdentitiesOnly yes, so none of your own keys are offered. - A
known_hostsfile of its own for the workstation, with the host key recorded once Ringleader has confirmed it. Your own~/.ssh/known_hostsis never touched, and creating a workstation again under the same name can’t produce a host-key-changed warning. - Connection sharing (
ControlMaster), so repeated commands reuse one connection instead of starting a new one. Windows doesn’t get it, because the Windows OpenSSH client doesn’t support it.
The configuration is only as fresh as the background service. When rl daemon isn’t running,
the files keep their last state, and a workstation that changed address since then doesn’t
connect. rl daemon status shows whether it runs.
Never edit a generated file
.conf file are overwritten, and deleting a workstation deletes
its file.Names for a workstation
Each workstation answers to three host names: the bare name (my-box), the name with
its namespace (my-box.local) and a fully qualified form
(my-box.local.ringleader). The .ringleader suffix doesn’t resolve as a real
domain, so the qualified form can never hide a real host.
The bare name claims that name in your SSH configuration. A workstation called prod would
hide a Host prod of your own. When in doubt, use the <name>.<namespace>.ringleader form.
Position of the include
OpenSSH keeps the first value it reads for each setting, and an Include after a Host line
applies to that host alone. So an Include below your own rules can lose. A Host * block
with an IdentityFile above it makes ssh offer your key instead of Ringleader’s, and the
workstation refuses it.
An Include at the end might never be read
Include at the end of the file might never be read, and then ssh offers the wrong key.Put the Include line above every Host and Match block. rl ssh-config install does
that, and when the block sits in the wrong place, running it again moves the block back to
the top. rl ssh-config lists what
status reports about the position.
The rl code command
rl code opens a workstation in VS Code, Cursor or VS Code Insiders on your computer, over
Remote-SSH. It addresses the workstation by its <name>.<namespace>.ringleader name and opens
the first path of spec.sources in the resolved configuration. With no sources, the editor
connects with no folder open. It picks the first editor it finds, in the order code,
cursor, code-insiders. When it finds no editor command, rl code opens the editor
through its URL handler instead, and fails if nothing on your computer opens the editor’s
links.
Remote-SSH runs your system ssh and reads your own ~/.ssh/config, so Ringleader’s
Include must be there. Before the editor opens, rl code runs ssh -G with the
workstation’s <name>.<namespace>.ringleader name to see whether ssh finds a host by it.
If ssh finds none, rl code opens nothing, prints one line that says why and what to do
next, and exits with status 3. The line names one of three fixes:
- Run
rl ssh-config install, when theIncludeis missing, in the wrong place, or points at another data directory. - Make sure
rl daemonis running and the workstation is Running, when Ringleader hasn’t written the workstation’s SSH configuration yet. - Run
rl ssh-config statusto see why, in any other case.
In three cases, rl code doesn’t refuse. It warns instead if the Include looks wrong, or if
Ringleader hasn’t written the workstation’s SSH configuration yet:
sshis missing, fails, or doesn’t answer within five seconds.rl codeopens the editor.- The editor’s user settings mention
remote.SSH.configFileorremote.SSH.path, which make Remote-SSH read another SSH configuration or run anotherssh.rl codeskipsssh -Gand opens the editor. - You pass
--print.rl codeskipsssh -G, prints the command and launches nothing.
The editor also needs its Remote - SSH extension. rl code warns when the extension is
missing, and still opens the editor. As it opens the editor, rl code prints a line that
names what the window shows once it connects: SSH: my-box.local.ringleader in the
bottom-left corner. That is how you tell a window on the workstation from one on your own
computer.
The first time you connect, VS Code downloads its own server, about 100 MB, onto the
workstation from update.code.visualstudio.com. A workstation whose outbound access is
restricted can sit at “Setting up SSH Host” until that download completes.
To set editor settings on the workstation before you first connect, use the
vscode-server toolconfig.
VS Code in a browser
The vscode-web devtool installs code-server, which is VS Code in a browser tab, on the
workstation. Only the port forward from your computer reaches it, so you can turn off its
password with auth: none.
VS Code in a browser needs three things in the workstation’s configuration:
- The
vscode-webdevtool, which installs it. - The
vscode-webtoolconfig, which tells it how to run. - A forward for its port, which a
defaultLocalBindingprovides.
vscode-web lists its extensions, says how it starts and where it listens, and names the distributions it supports.
Connect your own SSH tools
To use ssh, scp, rsync or git with a workstation, follow
Connect to a workstation with SSH. It adds the
Include line from the application or the command line, and shows how to check and remove
it.
Open a workstation in your editor
To open a workstation in your editor, add Ringleader’s SSH configuration as Connect your own SSH tools describes, then run:
rl code my-box -n localTo choose the editor or the folder, add --editor cursor or --path /home/dev/other-repo.
Add --print to see the command without launching anything.
Set up VS Code in your browser
To run VS Code in a browser tab, add the devtool, the toolconfig, a declared port and a forward to a WorkstationConfig. The file selects your workstations by label:
apiVersion: workstations.ringleader.dev/v1
kind: WorkstationConfig
metadata:
name: browser-ide
namespace: local
spec:
selector:
matchLabels:
ide: browser
devtools:
- name: vscode-web
toolconfigs:
- id: vscode-web
name: vscode-web
config:
auth: none
ports:
- 8080
defaultLocalBinding:
enabled: true
autoForward:
forwardAll: trueApply the file, and wait until the workstation is Configured. Then open
http://127.0.0.1:8080 on your computer. That is the workstation’s VS Code.
If that is all you need, you are done. The next two sections add a password and move the port.
Require a password for VS Code in a browser
To ask for a password, store it as a Secret, then point the toolconfig at it:
rl secret create vscode-web-password -n local \
--from-string vscode-web-password=<choose-a-password>toolconfigs:
- id: vscode-web
name: vscode-web
config:
auth: password
password: "${secret:vscode-web-password}"Changing the password later restarts code-server for you, because it reads the password only when it starts.
Change the port of VS Code in a browser
If something else on the workstation already uses port 8080, move code-server off it. Set
port and auth together, and declare both ports:
toolconfigs:
- id: vscode-web
name: vscode-web
config:
port: 8081
auth: none
ports:
- 8080 # your app
- 8081 # the IDESet auth with port
auth whenever you set port, or nobody can sign in.config fields says why and
lists the other fields.
Tool configuration is applied before your provisioning scripts run, so code-server has already moved by the time a script starts your app on 8080.
Next steps
- Connect to a workstation with SSH adds Ringleader’s SSH configuration to yours, and checks or removes it.
rl ssh-configdescribes every form of the command, whatinstallwrites and how to readstatus.rl codelists the flags of the editor command.- vscode-web lists the toolconfig’s fields and editor settings.
- Port and socket forwarding explains the forward that VS Code in a browser relies on.