Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,9 @@ cargo run-esp32c6
```
(...)
INFO - WIFI PSK: <PSK>
INFO - Connect to the AP `ssh-stamp` as a DHCP client with IP: 192.168.4.1
INFO - WIFI MAC: <MAC>
INFO - SSH hostkey fingerprint: <FINGERPRINT>
INFO - Connect to the AP `<RANDOM AP NAME>` as a DHCP client with IP: 192.168.4.1
```

2. Connect a laptop/phone to the `ssh-stamp` AP using the printed PSK, then SSH into the device at `root@192.168.4.1`.
Expand Down
17 changes: 17 additions & 0 deletions src/espressif/net.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@ pub async fn if_up(
mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]
);
Efuse::set_mac_address(mac).map_err(|_| sunset::error::BadUsage.build())?;

print_hostkey_fingerprint(&guard.hostkey);
}

let ssid_name = wifi_ssid(config).await;
Expand Down Expand Up @@ -197,6 +199,21 @@ pub async fn wifi_password(config: &'static SunsetMutex<SSHStampConfig>) -> Stri
}
}

fn print_hostkey_fingerprint(hostkey: &sunset::SignKey) {
match hostkey {
sunset::SignKey::Ed25519(_) => {
let pubkey = hostkey.pubkey();
match pubkey.fingerprint(ssh_key::HashAlg::Sha256) {
Ok(fp) => info!("SSH hostkey fingerprint: {}", fp),
Err(e) => warn!("Failed to compute fingerprint: {:?}", e),
}
}
_ => {
warn!("Unsupported key type for fingerprint");
}
}
}

/// Manages the WiFi access point lifecycle.
/// Starts the AP with the configured SSID and password from the config.
/// Handles reconnection if the AP stops.
Expand Down
Loading