From Fedora Project Wiki

Description

This test case tests usbguard CLI device management.

Setup

  1. Ensure the usbguard package is installed
  2. To start from a clean state, ensure that the usbguard service is stopped and that there's no existing policy.
  3. Ensure that there's at least one USB device connected to your system which can be disconnected and connected again. For example a USB keyboard or mouse.
  4. Prepare a USB device which is not connected to the system. For example a USB flash drive.
How to get to a clean state
As root, run systemctl stop usbguard and rm -f /etc/usbguard/rules.conf. This will remove your policy, so make a backup if you don't want to lose it.

How to test

  1. Start the usbguard service:
    # systemctl start usbguard
  2. Check that your connected USB devices are still working.
  3. List devices using the usbguard tool and check that all connected USB devices are listed:
    # usbguard list-devices
  4. Connect the new device to the system. The device should be blocked -- not working.
  5. List blocked device using the usbguard tool:
    # usbguard list-devices -b
  6. Allow the new device using the usbguard tool:
    # usbguard allow-device <id>
  7. Check that the new device is working.
  8. List blocked device and check that the list is empty:
    # usbguard list-devices -b

Expected Results

  1. USB devices work after the usbguard service start.
  2. Newly connected USB devices do not work.
  3. Blocked devices work after allowing them using the usbguard tool.