Skip to content

Commit b1ba280

Browse files
committed
update README
1 parent efd51b6 commit b1ba280

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

README.md

+18
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,24 @@ envbuilder will assume SSH authentication. You have the following options:
185185
ghcr.io/coder/envbuilder
186186
```
187187

188+
1. Fetch the SSH key from Coder: as long as `CODER_AGENT_URL` and
189+
`CODER_AGENT_TOKEN` are set, then envbuilder will attempt to fetch the
190+
corresponding Git SSH key directly from Coder. Example:
191+
192+
```terraform
193+
resource "docker_container" "workspace" {
194+
count = data.coder_workspace.me.start_count
195+
image = "ghcr.io/coder/envbuilder:version"
196+
name =
197+
"coder-${data.coder_workspace.me.owner}-${lower(data.coder_workspace.me.name)}"
198+
199+
env = [
200+
"CODER_AGENT_TOKEN=${coder_agent.dev.token}",
201+
"CODER_AGENT_URL=${data.coder_workspace.me.access_url}",
202+
...
203+
]
204+
```
205+
188206
1. Agent-based authentication: set `SSH_AUTH_SOCK` and mount in your agent socket, for example:
189207

190208
```bash

git.go

+7
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,13 @@ func LogHostKeyCallback(log LoggerFunc) gossh.HostKeyCallback {
176176
// If SSH_PRIVATE_KEY_PATH is set, an SSH private key will be read from
177177
// that path and the SSH auth method will be configured with that key.
178178
//
179+
// If no SSH_PRIVATE_KEY_PATH is set, but CODER_AGENT_URL and CODER_AGENT_TOKEN
180+
// are both specified, envbuilder will attempt to fetch the corresponding
181+
// Git SSH key for the user.
182+
//
183+
// Otherwise, SSH authentication will fall back to SSH_AUTH_SOCK, in which
184+
// case SSH_AUTH_SOCK must be set to the path of a listening SSH agent socket.
185+
//
179186
// If SSH_KNOWN_HOSTS is not set, the SSH auth method will be configured
180187
// to accept and log all host keys. Otherwise, host key checking will be
181188
// performed as usual.

0 commit comments

Comments
 (0)