@@ -40,7 +40,7 @@ export class LocalSSHGatewayServer {
40
40
workspaceId: clientUsername,
41
41
instanceId: '',
42
42
failureCode: SendLocalSSHUserFlowStatusRequest_Code.CODE_NO_WORKSPACE_AUTO_INFO,
43
- failureReason: e?.toString(), // TODO remove, and report to error reporting
43
+ // TODO remove, and report to error reporting
44
44
daemonVersion: getDaemonVersion(),
45
45
extensionVersion: getRunningExtensionVersion(),
46
46
connType: SendLocalSSHUserFlowStatusRequest_ConnType.CONN_TYPE_UNSPECIFIED,
@@ -72,16 +72,16 @@ export class LocalSSHGatewayServer {
72
72
this . clientCount += 1 ;
73
73
session . onAuthenticating ( ( e ) => {
74
74
e . authenticationPromise = this . authenticateClient ( e . username ! ) . then ( s => {
75
- this . logger . info ( 'authenticate with ' + e . username ) ;
76
- pipeSession = s ;
77
- return { } ;
78
- } ) . catch ( e => {
79
- this . logger . error ( e , 'failed to authenticate client' ) ;
80
- // TODO not sure how to get gitpod host here
81
- // this.localsshService.sendErrorReport(e.username, undefined, e, 'failed to authenticate client');
82
- session . close ( SshDisconnectReason . hostNotAllowedToConnect , 'auth failed or workspace is not running' ) ;
83
- return null ;
84
- } ) ;
75
+ this . logger . info ( 'authenticate with ' + e . username ) ;
76
+ pipeSession = s ;
77
+ return { } ;
78
+ } ) . catch ( e => {
79
+ this . logger . error ( e , 'failed to authenticate client' ) ;
80
+ // TODO not sure how to get gitpod host here
81
+ // this.localsshService.sendErrorReport(e.username, undefined, e, 'failed to authenticate client');
82
+ session . close ( SshDisconnectReason . hostNotAllowedToConnect , 'auth failed or workspace is not running' ) ;
83
+ return null ;
84
+ } ) ;
85
85
} ) ;
86
86
session . onClientAuthenticated ( async ( ) => {
87
87
try {
@@ -144,7 +144,6 @@ export class LocalSSHGatewayServer {
144
144
workspaceId : workspaceInfo . workspaceId ,
145
145
instanceId : workspaceInfo . instanceId ,
146
146
failureCode : SendLocalSSHUserFlowStatusRequest_Code . CODE_SSH_CANNOT_CONNECT ,
147
- failureReason : e ?. toString ( ) , // TODO remove, and report to error reporting
148
147
daemonVersion : getDaemonVersion ( ) ,
149
148
extensionVersion : getRunningExtensionVersion ( ) ,
150
149
connType : SendLocalSSHUserFlowStatusRequest_ConnType . CONN_TYPE_SSH ,
@@ -154,12 +153,12 @@ export class LocalSSHGatewayServer {
154
153
}
155
154
156
155
private async getTunnelSSHConfig ( workspaceInfo : GetWorkspaceAuthInfoResponse ) : Promise < SshClientSession > {
157
- const ssh = new SupervisorSSHTunnel ( this . logger , workspaceInfo , this . localsshService ) ;
158
- const connConfig = await ssh . establishTunnel ( ) ;
159
- const config = new SshSessionConfiguration ( ) ;
160
- const session = new SshClientSession ( config ) ;
161
- session . onAuthenticating ( ( e ) => e . authenticationPromise = Promise . resolve ( { } ) ) ;
162
156
try {
157
+ const ssh = new SupervisorSSHTunnel ( this . logger , workspaceInfo , this . localsshService ) ;
158
+ const connConfig = await ssh . establishTunnel ( ) ;
159
+ const config = new SshSessionConfiguration ( ) ;
160
+ const session = new SshClientSession ( config ) ;
161
+ session . onAuthenticating ( ( e ) => e . authenticationPromise = Promise . resolve ( { } ) ) ;
163
162
await session . connect ( new NodeStream ( connConfig . sock ! ) ) ;
164
163
// we need to convert openssh to pkcs8 since dev-tunnels-ssh not support openssh
165
164
const credentials : SshClientCredentials = { username : connConfig . username , publicKeys : [ await importKeyBytes ( parsePrivateKey ( connConfig . privateKey , 'openssh' ) . toBuffer ( 'pkcs8' ) ) ] } ;
@@ -169,14 +168,14 @@ export class LocalSSHGatewayServer {
169
168
}
170
169
return session ;
171
170
} catch ( e ) {
171
+ this . localsshService . sendErrorReport ( workspaceInfo . gitpodHost , workspaceInfo . userId , workspaceInfo . workspaceId , workspaceInfo . instanceId , e , 'failed to connect with tunnel ssh' ) ;
172
172
this . localsshService . sendTelemetry ( {
173
173
gitpodHost : workspaceInfo . gitpodHost ,
174
174
userId : workspaceInfo . userId ,
175
175
status : SendLocalSSHUserFlowStatusRequest_Status . STATUS_FAILURE ,
176
176
workspaceId : workspaceInfo . workspaceId ,
177
177
instanceId : workspaceInfo . instanceId ,
178
178
failureCode : SendLocalSSHUserFlowStatusRequest_Code . CODE_TUNNEL_NO_ESTABLISHED_CONNECTION ,
179
- failureReason : e ?. toString ( ) , // TODO remove, and report to error reporting
180
179
daemonVersion : getDaemonVersion ( ) ,
181
180
extensionVersion : getRunningExtensionVersion ( ) ,
182
181
connType : SendLocalSSHUserFlowStatusRequest_ConnType . CONN_TYPE_TUNNEL ,
0 commit comments