You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It would be beneficial to have a built-in option to automatically shut down the system when an unauthorized USB device is detected. This feature would:
Make LUKS encryption more secure, as the data remains decrypted in memory as long as the system is on and has been unlocked at least once, even if the screen is locked.
Protect against USB wigglers, which can keep your device unlocked without your realization.
In extreme cases, if your device is stolen while unlocked, shutting down the system when a USB device is attached will safeguard your data.
While this can be achieved through scripts, having it as a native feature would improve ease of use and performance. For someone not deeply familiar with Linux systems, there must be many optimizations to improve this workaround.
Guide for my current workaround
#!/bin/bash
LOG_FILE="/var/log/usbguard_events.log"# Ensure the script has permission to write to the log file
touch "$LOG_FILE"
chmod 644 "$LOG_FILE"
shutdown_flag=false
# Log the PolicyApplied USB-related event detailsif [ "$USBGUARD_IPC_SIGNAL"=="Device.PolicyApplied" ];then
{
echo"--- New Device Policy Applied: $(date '+%Y-%m-%d %H:%M:%S') ---"echo"Device ID: $USBGUARD_DEVICE_ID"echo"Device Rule: $USBGUARD_DEVICE_RULE"echo"Device Target: $USBGUARD_DEVICE_TARGET_NEW"if [ "$USBGUARD_DEVICE_TARGET_NEW"=="block" ];then
shutdown_flag=true
fiecho"----------------------------------------"
} >>"$LOG_FILE"if$shutdown_flag;thenecho"Initiating shutdown due to blocked USB device..."
sudo shutdown -h now
fifi
Save it to a file, for example /usr/local/bin/usbguard_logger.sh
Make it executable: sudo chmod +x /usr/local/bin/usbguard_logger.sh
Create service pipe - /etc/systemd/system/usbguard-logger.service
Create a systemd service file:
sudo nano /etc/systemd/system/usbguard-logger.service
It would be beneficial to have a built-in option to automatically shut down the system when an unauthorized USB device is detected. This feature would:
While this can be achieved through scripts, having it as a native feature would improve ease of use and performance. For someone not deeply familiar with Linux systems, there must be many optimizations to improve this workaround.
Guide for my current workaround
sudo chmod +x /usr/local/bin/usbguard_logger.sh
Create service pipe - /etc/systemd/system/usbguard-logger.service
sudo nano /etc/systemd/system/usbguard-logger.service
sudo systemctl daemon-reload
sudo systemctl enable usbguard-logger.service
sudo systemctl start usbguard-logger.service
sudo systemctl status usbguard-logger.service
Summary
The text was updated successfully, but these errors were encountered: