From 1913838f8ed4b30c756c3c20ea5fdf1680ea97ca Mon Sep 17 00:00:00 2001 From: Jack Grigg Date: Sat, 31 Dec 2022 13:22:56 +0000 Subject: [PATCH] Hunt for yubikey-agent --- CHANGELOG.md | 3 +++ src/key.rs | 14 ++++++++++++++ 2 files changed, 17 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index dc35f00..ec1d535 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,9 @@ and this project adheres to Rust's notion of to 0.3.0 are beta releases. ## [Unreleased] +### Changed +- The "sharing violation" logic now also sends SIGHUP to any `yubikey-agent` + that is running, to have them release any YubiKey locks they are holding. ## [0.3.1] - 2022-12-30 ### Changed diff --git a/src/key.rs b/src/key.rs index 614a276..b5b371f 100644 --- a/src/key.rs +++ b/src/key.rs @@ -106,6 +106,20 @@ fn hunt_agents() -> bool { interrupted = true; } } + "yubikey-agent" | "yubikey-agent.exe" => { + // yubikey-agent releases all YubiKey locks when it receives a SIGHUP. + match process.kill_with(Signal::Hangup) { + Some(true) => { + debug!("Sent SIGHUP to yubikey-agent (PID {})", process.pid()); + interrupted = true; + } + Some(false) => (), + None => debug!( + "Found yubikey-agent (PID {}) but platform doesn't support SIGHUP", + process.pid(), + ), + } + } _ => (), } }