SSH: return with an error if the host key is wrong, rather than denying authentication

[?]
Feb 26, 2021, 10:54 AM
MU6P2JXG6RQEUOUV7HIZNA2734BGUCYMJYXAOLOO2CSGMNKVIH5QC

Dependencies

  • [2] TPEH2XNB 1.0.0-alpha.28, with Tokio 1.0
  • [3] UDHP4ZVB Fixing SSH asynchronicity issues
  • [4] SZWBLWZ4 Reading ~/.ssh/config
  • [5] CCLLB7OI Upgrading to Sanakirja 0.15 + version bump
  • [6] SXEYMYF7 Fixing the bad changes in history (unfortunately, by rebooting).

Change contents

  • replacement in pijul/src/remote/ssh.rs at line 94
    [3.28092][3.813:942](),[3.942][3.28167:28274](),[3.28167][3.28167:28274]()
    let authenticated = self
    .auth_agent(&mut h, &mut key_path)
    .await
    .unwrap_or(false)
    || self.auth_pk(&mut h, &mut key_path).await
    || self.auth_password(&mut h).await?;
    [3.28092]
    [3.28274]
    let authenticated = match self.auth_agent(&mut h, &mut key_path).await {
    Ok(true) => true,
    Ok(false) => {
    self.auth_pk(&mut h, &mut key_path).await || self.auth_password(&mut h).await?
    }
    Err(e) => return Err(e.into()),
    };
  • replacement in pijul/src/remote/ssh.rs at line 129
    [3.1056][3.1056:1095]()
    ) -> Result<bool, anyhow::Error> {
    [3.1056]
    [3.28905]
    ) -> Result<bool, thrussh::Error> {
  • edit in pijul/src/remote/ssh.rs at line 157
    [3.29953]
    [2.141]
    (_, Err(thrussh::AgentAuthError::Send(e))) => {
    debug!("send error {:?}", e);
    return Err(thrussh::Error::SendError);
    }
  • replacement in pijul/src/remote/ssh.rs at line 317
    [3.33620][3.33620:33679]()
    error!("Key changed for {:?}", self.addr);
    [3.33620]
    [2.713]
    writeln!(std::io::stderr(), "Key changed for {:?}", self.addr).unwrap_or(());