diff --git a/LICENSE b/LICENSE index ddf2c369..e6924bb3 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2026 Blueflare +Copyright (c) 2026 BlueFlare Energy Solutions Inc. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/ci/package-windows.py b/ci/package-windows.py index e7e92ba7..1f904523 100644 --- a/ci/package-windows.py +++ b/ci/package-windows.py @@ -38,7 +38,7 @@ def release(version: str, exe: str, out_dir: str) -> None: "the executable is self-contained and runs on Windows 10 and 11.\r\n" "\r\n" + ( - "The executable is signed by Blueflare (Azure Artifact Signing). To check:\r\n" + "The executable is signed by BlueFlare Energy Solutions Inc. (Azure Artifact Signing). To check:\r\n" "right-click alkane-toolkit.exe > Properties > Digital Signatures.\r\n" if signed else "This build is not code-signed, so Windows SmartScreen may warn on first\r\n" diff --git a/crates/alkane-gui/src/credentials.rs b/crates/alkane-gui/src/credentials.rs index 92acc699..99803c41 100644 --- a/crates/alkane-gui/src/credentials.rs +++ b/crates/alkane-gui/src/credentials.rs @@ -69,13 +69,26 @@ pub fn load_ssh_credentials() -> Option<(String, String)> { load_creds_file(SSH_CREDENTIALS_FILE) } -/// Save the SSH username/password (0600). Retained for a future SSH-login dialog -/// now that the SSH PIC probe that used to save it has been removed (round 14 #5). -#[allow(dead_code)] +/// Save the SSH username/password (0600), from the Credentials dialog. pub fn save_ssh_credentials(user: &str, pass: &str) -> std::io::Result<()> { save_creds_file(SSH_CREDENTIALS_FILE, user, pass) } +/// Remove the saved SSH login, if any. Not an error if none was saved. +pub fn clear_ssh_credentials() -> std::io::Result<()> { + clear_creds_file(SSH_CREDENTIALS_FILE) +} + +/// The SSH username to use: the saved one, or `root` (the control-board login +/// on every firmware the restore flow drives over SSH) when none was entered. +pub fn ssh_user_or_default(user: &str) -> String { + if user.trim().is_empty() { + "root".to_string() + } else { + user.trim().to_string() + } +} + /// Remove the saved web/API credentials, if any. Not an error if none were saved. pub fn clear_credentials() -> std::io::Result<()> { match clear_creds_file(CREDENTIALS_FILE) { @@ -272,6 +285,28 @@ mod tests { assert_eq!(load_credentials(), None, "cleared -> None"); clear_credentials().unwrap(); // idempotent: clearing an already-clear store is not an error + // SSH login: separate file, same 0600 rule, clear is idempotent. + assert_eq!(load_ssh_credentials(), None, "no SSH file -> None"); + save_ssh_credentials("root", "ssh-pass").unwrap(); + assert_owner_only( + &config_path(SSH_CREDENTIALS_FILE), + "SSH creds file must be 0600", + ); + assert_eq!( + load_ssh_credentials(), + Some(("root".to_string(), "ssh-pass".to_string())) + ); + assert_eq!( + load_credentials(), + None, + "SSH save leaves the web login alone" + ); + clear_ssh_credentials().unwrap(); + assert_eq!(load_ssh_credentials(), None, "cleared -> None"); + clear_ssh_credentials().unwrap(); + assert_eq!(ssh_user_or_default(""), "root"); + assert_eq!(ssh_user_or_default(" admin "), "admin"); + // Per-firmware overrides (round 12 #13). Kept in this same test because // HOME is process-global: a second #[test] mutating it would race under // cargo's default parallel runner. diff --git a/crates/alkane-gui/src/restore.rs b/crates/alkane-gui/src/restore.rs index 18e8d6eb..7b91fe9d 100644 --- a/crates/alkane-gui/src/restore.rs +++ b/crates/alkane-gui/src/restore.rs @@ -245,7 +245,7 @@ fn restore_braiins(ip: &str, user: &str, pass: &str) -> (bool, String) { if pass.is_empty() { return ( false, - "Braiins restore needs an SSH password (set the SSH login)".into(), + "Braiins restore needs an SSH password (Credentials > SSH)".into(), ); } let target = format!("{user}@{ip}"); diff --git a/crates/alkane-gui/src/scan.rs b/crates/alkane-gui/src/scan.rs index 1e8e3c88..37af578e 100644 --- a/crates/alkane-gui/src/scan.rs +++ b/crates/alkane-gui/src/scan.rs @@ -86,7 +86,9 @@ pub fn save_scan_concurrency(n: usize) -> std::io::Result<()> { .to_string(), ) } -pub const DEFAULT_RANGE: &str = "10.255.1.0/24"; +/// The usual home/site router subnet. Host bits are masked off, so this scans +/// 192.168.1.0/24. +pub const DEFAULT_RANGE: &str = "192.168.1.1/24"; /// Default seconds between automatic rescans. pub const DEFAULT_AUTO_SECS: u64 = 300; @@ -2267,6 +2269,13 @@ mod tests { ); } + #[test] + fn default_range_covers_the_whole_192_168_1_subnet() { + let ips = parse_line(DEFAULT_RANGE).unwrap(); + let cidrs = targets_to_cidrs(&ips); + assert_eq!(cidrs, vec![(Ipv4Addr::new(192, 168, 1, 0), 24)]); + } + #[test] fn cidr_aggregation_round_trips() { // a /24 must aggregate back to exactly one /24 block diff --git a/crates/alkane-gui/src/ui.rs b/crates/alkane-gui/src/ui.rs index 71f86c0b..88900873 100644 --- a/crates/alkane-gui/src/ui.rs +++ b/crates/alkane-gui/src/ui.rs @@ -770,6 +770,8 @@ pub struct App { // Credentials dialog (round 13 #2). Empty when no global credential is set. creds_user_input: Widget, creds_pass_input: Widget, + ssh_user_input: Widget, + ssh_pass_input: Widget, // The Credentials dialog (round 13 #2): the global login above plus one // (firmware name, user field, pass field) row per registry firmware. fwcreds_dialog: Widget, @@ -1138,6 +1140,8 @@ pub fn build(frame: Widget) -> App { header_menu_col: None, creds_user_input: frame, creds_pass_input: frame, + ssh_user_input: frame, + ssh_pass_input: frame, fwcreds_dialog: frame, fwcreds_rows: Vec::new(), access_probe: None, @@ -2355,6 +2359,7 @@ impl App { vnish_pass }; let (ssh_user, ssh_pass) = credentials::load_ssh_credentials().unwrap_or_default(); + let ssh_user = credentials::ssh_user_or_default(&ssh_user); let ips: Vec = targets.iter().map(|t| t.ip.clone()).collect(); self.restore_dialog.close(1); crate::logs::log(format!("restore {} miner(s) to stock", ips.len())); @@ -3112,6 +3117,52 @@ impl App { ); self.creds_user_input = user_input; self.creds_pass_input = pass_input; + // SSH login for the control board (Braiins restore-to-stock). Same rule + // as the global login: the password is never shown, blank keeps it. + let (ssh_user, ssh_pass) = credentials::load_ssh_credentials().unwrap_or_default(); + let s_hint = if ssh_pass.is_empty() { + "SSH (restore)" + } else { + "SSH (password saved; blank keeps it)" + }; + let srow = Widget::box_sizer(false); + let slabel = Widget::static_text(dlg, s_hint); + slabel.set_min_size(150, -1); + srow.add( + slabel, + 0, + sf::ALIGN_CENTRE_VERTICAL | sf::BORDER_LEFT | sf::BORDER_RIGHT, + 6, + ); + let ssh_user_input = Widget::text_ctrl(dlg, false); + ssh_user_input.set_min_size(150, -1); + ssh_user_input.set_value(if ssh_user.is_empty() { + "root" + } else { + &ssh_user + }); + srow.add( + ssh_user_input, + 0, + sf::ALIGN_CENTRE_VERTICAL | sf::BORDER_LEFT | sf::BORDER_RIGHT, + 6, + ); + let ssh_pass_input = Widget::password_ctrl(dlg); + ssh_pass_input.set_min_size(150, -1); + srow.add( + ssh_pass_input, + 1, + sf::ALIGN_CENTRE_VERTICAL | sf::BORDER_LEFT | sf::BORDER_RIGHT, + 6, + ); + root.add_sizer( + srow, + 0, + sf::EXPAND | sf::BORDER_LEFT | sf::BORDER_RIGHT | sf::BORDER_TOP, + 6, + ); + self.ssh_user_input = ssh_user_input; + self.ssh_pass_input = ssh_pass_input; // Column headers. let head = Widget::box_sizer(false); let h_fw = Widget::static_text(dlg, "Firmware"); @@ -3223,6 +3274,21 @@ impl App { wx_rs::set_status_text(&format!("failed to save global login: {e}")); return; } + // SSH login: a blank password keeps the saved one; with nothing saved + // and no password entered there is nothing to store. + let s_user = credentials::ssh_user_or_default(&self.ssh_user_input.get_value()); + let s_pass = self.ssh_pass_input.get_value(); + let ssh_result = if !s_pass.is_empty() { + credentials::save_ssh_credentials(&s_user, &s_pass) + } else if let Some((_, saved)) = credentials::load_ssh_credentials() { + credentials::save_ssh_credentials(&s_user, &saved) + } else { + Ok(()) + }; + if let Err(e) = ssh_result { + wx_rs::set_status_text(&format!("failed to save SSH login: {e}")); + return; + } // Per-firmware overrides. let mut map: std::collections::HashMap = std::collections::HashMap::new(); @@ -3259,6 +3325,8 @@ impl App { fn apply_firmware_creds_reset(&mut self) { self.creds_user_input.set_value(""); self.creds_pass_input.set_value(""); + self.ssh_user_input.set_value("root"); + self.ssh_pass_input.set_value(""); for (name, user_ctrl, pass_ctrl) in &self.fwcreds_rows { let (user, pass) = credentials::firmware_default_for(name); user_ctrl.set_value(&user); @@ -3266,7 +3334,8 @@ impl App { } let per_fw = credentials::clear_firmware_credentials(); let global = credentials::clear_credentials(); - match per_fw.and(global) { + let ssh = credentials::clear_ssh_credentials(); + match per_fw.and(global).and(ssh) { Ok(()) => wx_rs::set_status_text("credentials reset to defaults"), Err(e) => wx_rs::set_status_text(&format!("failed to reset credentials: {e}")), } @@ -3878,7 +3947,7 @@ impl App { let edit = Widget::text_ctrl(dlg, true); edit.set_value(&scan::load_ranges().join("\n")); edit.set_tool_tip( - "One range per line:\n CIDR 10.255.1.0/24\n range 10.253.1.3-10.253.1.234\n single 10.253.1.5", + "One range per line:\n CIDR 192.168.1.0/24\n range 192.168.1.3-192.168.1.234\n single 192.168.1.5", ); root.add(edit, 1, sf::EXPAND | sf::BORDER_ALL, 6); // Auto-rescan interval (seconds; 0 = off) and per-miner scan timeout. diff --git a/crates/alkane-gui/windows/alkane-toolkit.rc b/crates/alkane-gui/windows/alkane-toolkit.rc index 177d75c6..d676e585 100644 --- a/crates/alkane-gui/windows/alkane-toolkit.rc +++ b/crates/alkane-gui/windows/alkane-toolkit.rc @@ -25,11 +25,11 @@ BEGIN BEGIN BLOCK "040904B0" BEGIN - VALUE "CompanyName", "Blueflare" + VALUE "CompanyName", "BlueFlare Energy Solutions Inc." VALUE "FileDescription", "Alkane Toolkit" VALUE "FileVersion", ALKANE_VER_STR VALUE "InternalName", "alkane-toolkit" - VALUE "LegalCopyright", "Copyright (c) 2026 Blueflare (MIT License)" + VALUE "LegalCopyright", "Copyright (c) 2026 BlueFlare Energy Solutions Inc. (MIT License)" VALUE "OriginalFilename", "alkane-toolkit.exe" VALUE "ProductName", "Alkane Toolkit" VALUE "ProductVersion", ALKANE_VER_STR diff --git a/docs/manual/01-getting-started.md b/docs/manual/01-getting-started.md index 69c51cfb..56ecbff7 100644 --- a/docs/manual/01-getting-started.md +++ b/docs/manual/01-getting-started.md @@ -33,8 +33,8 @@ tar xzf alkane-toolkit-vX.Y.Z-linux-x86_64.tar.gz ## First run The toolkit starts a scan as soon as it opens. Set your own ranges first with -**Scan ranges** (see [Scanning](02-scanning.md)); until you do, it scans a -built-in default range. +**Scan ranges** (see [Scanning](02-scanning.md)); until you do, it scans +192.168.1.0/24, the usual router subnet. To look around without touching any miner, start it in demo mode. It shows a built-in sample fleet and simulates every action: diff --git a/docs/manual/06-settings.md b/docs/manual/06-settings.md index fcd492c3..57922990 100644 --- a/docs/manual/06-settings.md +++ b/docs/manual/06-settings.md @@ -5,11 +5,13 @@ ## Credentials Miners need a login for anything beyond basic discovery: for some details, and -for every action. The Credentials dialog has two parts: +for every action. The Credentials dialog has three parts: - **All firmwares** at the top: one username and password tried on every miner. The saved password is never shown; leave the field blank to keep it. Blank username and password clear it. +- **SSH (restore)**: the control-board SSH login used to restore Braiins OS to + stock (see [SSH login](#ssh-login)). - **One row per firmware**, pre-filled with that firmware's factory default. Change a row to override the login for that firmware only. @@ -31,7 +33,8 @@ then the firmware's built-in default. | SealMiner Stock | seal / seal | | Auradine Stock | admin / admin | -**Reset to defaults** clears every override and the global login at once. +**Reset to defaults** clears every override, the global login and the SSH +login at once. Logins are stored as plain text in the settings folder, readable only by your user account (Linux file mode 0600; on Windows, your profile folder's @@ -40,9 +43,9 @@ permissions). ### SSH login Restoring Braiins to stock runs a command over SSH, using the system `ssh` -client (built into Windows 10/11). There is no dialog for this login yet: -create `ssh-credentials.txt` in the settings folder with the username on the -first line and the password on the second. +client (built into Windows 10/11). Set its login in the **SSH (restore)** row +of the Credentials dialog. The username defaults to `root`. As with the global +login, the saved password is never shown and a blank password keeps it. ## Language @@ -63,7 +66,7 @@ the current session (the last 2000 lines). Times are shown in UTC. | `auto-rescan-secs.txt`, `scan-timeout-secs.txt`, `scan-concurrency.txt` | the three scan numbers | | `scan-credentials.txt` | global login | | `firmware-credentials.txt` | per-firmware logins | -| `ssh-credentials.txt` | SSH login (created by hand) | +| `ssh-credentials.txt` | SSH login | | `presets.json` | saved views | | `language.txt` | UI language | | `pool-addresses.txt`, `pool-accounts.txt`, `pool-workers.txt`, `pool-passwords.txt` | saved pool values | diff --git a/docs/manual/07-restore.md b/docs/manual/07-restore.md index 30e72aa1..d3b640e0 100644 --- a/docs/manual/07-restore.md +++ b/docs/manual/07-restore.md @@ -11,7 +11,7 @@ confirmation with the list of miners first. |---|---|---| | VNish (and builds based on it) | web API: unlock, then remove firmware; reboots in seconds | the VNish row in Credentials, else `admin` | | LuxOS | miner API: log on, then uninstall | none | -| Braiins OS | SSH: runs the firmware's own `uninstall.sh` | `ssh-credentials.txt` (see [Settings](06-settings.md)) | +| Braiins OS | SSH: runs the firmware's own `uninstall.sh` | the SSH row in Credentials (see [Settings](06-settings.md#ssh-login)) | Miners are restored one at a time. A dropped connection after the command is sent counts as success, because that is the reboot. A refused login counts as diff --git a/docs/windows.md b/docs/windows.md index ddc88d67..e4c15bf6 100644 --- a/docs/windows.md +++ b/docs/windows.md @@ -63,7 +63,7 @@ credential; the script pins the new digest everywhere. Release and `-rc` executables are Authenticode-signed with Azure Artifact Signing (formerly Trusted Signing), so Windows and SmartScreen show -"Blueflare" as the verified publisher instead of "Unknown publisher". +"BlueFlare Energy Solutions Inc." as the verified publisher instead of "Unknown publisher". | Piece | Where | |-------|-------|