Skip to content

Commit

Permalink
auth-online: Add --sshauth option to allow caller to use ssh-auth.
Browse files Browse the repository at this point in the history
  • Loading branch information
flihp committed Jan 6, 2025
1 parent 4e2948c commit efc0811
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions cmd/debugmailbox/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,9 @@ enum DebugMailboxCmd {
/// Authentication beacon (UM11126 §51.7)
#[clap(long, default_value_t = 0, parse(try_from_str = parse_int::parse))]
beacon: u16,
/// Use ssh-agent to authenticate to permslip
#[clap(long)]
sshauth: bool,
},
}

Expand Down Expand Up @@ -357,7 +360,7 @@ fn debugmailboxcmd(context: &mut ExecutionContext) -> Result<()> {

let _ = write_req(&mut iface, &dm_port, DMCommand::ExitDM, &[])?;
}
DebugMailboxCmd::AuthOnline { key_name, beacon } => {
DebugMailboxCmd::AuthOnline { key_name, beacon, sshauth } => {
// Get the challenge from the chip.
alive(&mut iface, &dm_port, true)?;
let dac = write_req(
Expand All @@ -368,11 +371,18 @@ fn debugmailboxcmd(context: &mut ExecutionContext) -> Result<()> {
)?;

// Ask permission-slip to sign it.
let mut permslip = Process::new("permslip")
let mut permslip = Process::new("permslip");
permslip
.arg("sign")
.arg(key_name)
.arg("--kind=debug-authn-challenge")
.arg(format!("--debug-authn-beacon={beacon}"))
.arg(format!("--debug-authn-beacon={beacon}"));

if sshauth {
permslip.arg("--sshauth");
}

let mut permslip = permslip
.stdin(Stdio::piped())
.stdout(Stdio::piped())
.spawn()
Expand Down

0 comments on commit efc0811

Please sign in to comment.