@@ -18,6 +18,10 @@ pub struct Api;
1818struct CheckSshHostKeyRequest {
1919 host : String ,
2020 port : u16 ,
21+ username : Option < String > ,
22+ allow_insecure_algos : Option < bool > ,
23+ auth : Option < SSHTargetAuth > ,
24+ jump_host : Option < warpgate_common:: SSHJumpHostOptions > ,
2125}
2226
2327#[ derive( Object ) ]
@@ -55,11 +59,14 @@ impl Api {
5559 RCCommand :: Connect ( TargetSSHOptions {
5660 host : body. host . clone ( ) ,
5761 port : body. port ,
58- username : String :: new ( ) ,
59- allow_insecure_algos : None ,
60- auth : SSHTargetAuth :: Password ( SshTargetPasswordAuth {
61- password : String :: new ( ) . into ( ) ,
62+ username : body. username . clone ( ) . unwrap_or_default ( ) ,
63+ allow_insecure_algos : body. allow_insecure_algos ,
64+ auth : body. auth . clone ( ) . unwrap_or_else ( || {
65+ SSHTargetAuth :: Password ( SshTargetPasswordAuth {
66+ password : String :: new ( ) . into ( ) ,
67+ } )
6268 } ) ,
69+ jump_host : body. jump_host . clone ( ) ,
6370 } ) ,
6471 None ,
6572 ) ) ;
@@ -68,6 +75,10 @@ impl Api {
6875 let key = loop {
6976 match handles. event_rx . recv ( ) . await {
7077 Some ( RCEvent :: HostKeyReceived ( key) ) => break key,
78+ Some ( RCEvent :: HostKeyUnknown ( key, reply) ) => {
79+ let _ = reply. send ( true ) ;
80+ break key;
81+ } ,
7182 Some ( RCEvent :: ConnectionError ( err) ) => return Err ( anyhow:: Error :: from ( err) ) ,
7283 Some ( RCEvent :: Error ( err) ) => return Err ( err) ,
7384 None => anyhow:: bail!( "Failed to connect to target" ) ,
0 commit comments