Require approval for new USB devices by default

Co-authored-by: Outfoxxed <outfoxxed@outfoxxed.me>
This commit is contained in:
acrogenesisandOutfoxxed committed 2026-09-14 22:13:36 -06:00
1 parent 86a2e5830e
commit 44f68f4329
19 files changed
+1382 -2

No files matched your search

+23
View File
@@ -0,0 +1,23 @@
#!/bin/bash
# omarchy:hidden=true
# omarchy:summary=Watch USBGuard for devices awaiting user approval
set -euo pipefail
event_handler="$OMARCHY_PATH/bin/omarchy-usb-authorization-event"
# A device inserted while the graphical session was stopped is already safely
# blocked by USBGuard. Surface it now so the user can approve it after login.
while IFS= read -r line; do
if [[ $line =~ ^([0-9]+):[[:space:]](block.*)$ ]]; then
USBGUARD_IPC_SIGNAL=Device.PresenceChanged \
USBGUARD_DEVICE_ID="${BASH_REMATCH[1]}" \
USBGUARD_DEVICE_EVENT=Insert \
USBGUARD_DEVICE_TARGET=block \
USBGUARD_DEVICE_RULE="${BASH_REMATCH[2]}" \
"$event_handler"
fi
done < <(usbguard list-devices --blocked)
exec usbguard watch --wait --exec "$event_handler"