From Fedora Project Wiki

Description

This test case tests usbguard GUI application.

Setup

  1. This is a GUI application test, therefore you have to execute this test in a graphical session.
  2. Ensure the usbguard and usbguard-applet-qt packages are installed.
  3. Backup your policy because the testing procedure will modify it.
  4. To start from a clean state, ensure that the usbguard service is stopped and that the usbguard-applet-qt application is not running either.
  5. Prepare a USB device which is not connected to the system and for which there's no rule in your USBGuard policy.
  6. Make sure that the user under whom you'll be testing the GUI application is a member of the wheel group. Otherwise the application won't have permissions to talk to the usbguard-daemon component.
How to get to a clean state
As root, run systemctl stop usbguard and killall usbguard-applet-qt and restore your policy from a backup.
Where is my policy stored?
The USBGuard policy is stored in the file /etc/usbguard/rules.conf. Just copy the file somewhere else to make a backup. Copy it back and restart the usbguard service to restore the policy from the backup.

How to test

  1. Start the usbguard service:
    # systemctl start usbguard
  2. Start the usbguard-applet-qt application.
  3. Insert the USB device.
  4. Click on the block button to block the device. Check that the device remained blocked and is not usable.
    usbguard-applet-qt dialog
  5. Re-insert the USB device.
  6. Click on the allow button to allow the device. Check that the device is working as expected, e.g. if it's a USB mouse, then you can move the cursor with it.
    usbguard-applet-qt dialog
  7. Re-insert the USB device.
  8. Check the "[ ] Make the decision permanent" option and click on the allow button.
    usbguard-applet-qt dialog
  9. Re-insert the USB device.
  10. The device should be automatically allowed. Check whether it's working as expected.

Expected Results

  1. The application connects to the usbguard-daemon component on start.
  2. A device dialog appears when the USB device is connected to the system.
  3. The allow and block buttons work as expected.
  4. If the "[ ] Make the decision permanent" option is checked, then the action is remembered and no device dialog appears for the device again.