diff --git a/vuinputd/src/main.rs b/vuinputd/src/main.rs index c9601ca..16f8763 100644 --- a/vuinputd/src/main.rs +++ b/vuinputd/src/main.rs @@ -79,7 +79,10 @@ struct Args { #[arg( long = "vt-guard", - help = "Prevent leakage of uinput to VT by, sending K_OFF to /dev/tty0" + help = "Prevent all keyboard input from reaching the VT by setting K_OFF on /dev/tty0.", + long_help = "Disable VT keyboard handling (K_OFF on /dev/tty0) to prevent uinput leakage.\n\ + This disables all keyboard input on the virtual terminals, including physical keyboards.\n\ + Loss of local access may require recovery via SSH or a rescue boot." )] pub vt_guard: bool, } @@ -144,6 +147,7 @@ fn main() -> std::io::Result<()> { if args.vt_guard { vt_tools::mute_keyboard()?; + std::process::exit(0); } check_permissions().expect("failed to read the capabilities of the vuinputd process"); diff --git a/vuinputd/src/vt_tools.rs b/vuinputd/src/vt_tools.rs index 60be9f5..ac5a558 100644 --- a/vuinputd/src/vt_tools.rs +++ b/vuinputd/src/vt_tools.rs @@ -2,10 +2,10 @@ // // Author: Johannes Leupolz +use log::{error, info, warn}; use std::fs::OpenOptions; use std::io; use std::os::unix::io::AsRawFd; -use log::{error, info, warn}; use libc::ioctl; @@ -29,10 +29,7 @@ pub fn check_vt_status() { let rc = unsafe { ioctl(fd, KDGKBMODE, &mut mode) }; if rc < 0 { - error!( - "KDGKBMODE ioctl failed: {}", - io::Error::last_os_error() - ); + error!("KDGKBMODE ioctl failed: {}", io::Error::last_os_error()); return; }