Skip to content

Commit cbc3083

Browse files
authored
[ssh] flexible auth user (#18880)
1 parent b9750dd commit cbc3083

File tree

6 files changed

+301
-92
lines changed

6 files changed

+301
-92
lines changed

components/ide/jetbrains/gateway-plugin/src/main/kotlin/io/gitpod/jetbrains/gateway/GitpodConnectionProvider.kt

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -374,10 +374,15 @@ class GitpodConnectionProvider : GatewayConnectionProvider {
374374
hostKeys = listOf(SSHHostKey(keyPair.hostKey.type, keyPair.hostKey.value))
375375
}
376376

377+
var userName = keyPair.userName
378+
if (userName == null) {
379+
userName = "gitpod"
380+
}
381+
377382
return resolveCredentials(
378383
"localhost",
379384
sshWebSocketServer.port,
380-
"gitpod",
385+
userName,
381386
null,
382387
privateKeyFile.absolutePathString(),
383388
hostKeys
@@ -637,5 +642,5 @@ class GitpodConnectionProvider : GatewayConnectionProvider {
637642

638643
private data class SSHPublicKey(val type: String, val value: String)
639644

640-
private data class CreateSSHKeyPairResponse(val privateKey: String, val hostKey: SSHPublicKey?)
645+
private data class CreateSSHKeyPairResponse(val privateKey: String, val hostKey: SSHPublicKey?, val userName: String?)
641646
}

components/supervisor-api/control.proto

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ message CreateSSHKeyPairResponse {
4444
string private_key = 1;
4545
// Return hostKey used by client to verify fingerprint
4646
SSHPublicKey host_key = 2;
47+
// Return userName used by client to authenticate
48+
string user_name = 3;
4749
}
4850

4951
message SSHPublicKey {

components/supervisor-api/go/control.pb.go

Lines changed: 71 additions & 60 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)