Installing and Configuring USBGuard

Hands-On Lab

 

Photo of Bob Salmans

Bob Salmans

Security Training Architect I in Content

Length

00:30:00

Difficulty

Intermediate

In this lab, we'll be setting up USBGuard to to control which USB devices are allowd to communicate with our hosts once they are plugged in. USB devices are an easy way for attackers to gain a foothold in our environments via USB Dropper attacks. USBGuard is a great security control that can help us avoid being infected by a malicious USB device.

What are Hands-On Labs?

Hands-On Labs are scenario-based learning environments where learners can practice without consequences. Don't compromise a system or waste money on expensive downloads. Practice real-world skills without the real-world risk, no assembly required.

Installing and Configuring USBGuard

Introduction

We have been assigned the task of setting up a host to test the effectiveness of USBGuard. We are to install USBGuard, get it to a functional state, and ensure it will start at boot.

The security team will take over after that and test the creation of rules and their effectiveness. To help the the security team out we'll need to create a group named USBGuard-Users, then add the cloud_user account as a member of the USBGuard-Users group, so it can be used to make changes to USBGuard.

Setting Up the Environment

  1. Open your terminal application, and log in to the environment using the credentials provided on the lab instructions page. (Remember to replace <PUBLIC_IP_ADDRESS> with the actual public IP address.)

    ssh cloud_user@<PUBLIC_IP_ADDRESS>
  2. Type yes at the prompt.

  3. Enter your password at the prompt.

  4. Become root (by executing su -).

Install and Configure USBGuard with Basic Settings

  1. Install USBGuard

    [root@host]# yum install -y usbguard
  2. Start the USBGuard service, and make sure it's running

    [root@host]# systemctl start usbguard.service
    [root@host]# systemctl status usbguard.service
  3. Generate a base policy for USBGuard

    [root@host]# usbguard generate-policy > /etc/usbguard/rules.conf
  4. Restart the USBGuard service after creating the base policy

    [root@host]# systemctl restart usbguard.service
  5. Enable the USBGuard service to start at boot

    [root@host]# systemctl enable usbguard.service

Configure USBGuard Permissions

  1. Create a group named USBGuard-Users

    [root@host]# groupadd USBGuard-Users
  2. Add cloud_user to the USBGuard-Users group

    [root@host]# usermod -a -G USBGuard-Users cloud_user
    • Verify group membership:

      [root@host]# cat /etc/group | grep USBGuard-Users
  3. Update USBGuard to permit the USBGuard-Users group to make changes to USBGuard

    [root@host]# nano /etc/usbguard/usbguard-daemon.conf

    We're using the Nano editor here. Press Ctrl+w and search for IPCAllowedGroups. Add USBGuard-Users so that the line reads:

    IPCAllowedGroups=USBGuard-Users

    Press Ctrl+x to quit, and answer Y at the prompt to save.

  4. Restart the USBGuard service and check the status

    [root@host]# systemctl restart usbguard.service
    [root@host]# systemctl status usbguard.service

Conclusion

Congratulations, you've successfully completed this hands-on lab!