Red Hat Training

A Red Hat training course is available for RHEL 8

14.2. 安装 USBGuard

使用这个步骤安装并启动 USBGuard 框架。

流程

  1. 安装 usbguard 软件包:

    # yum install usbguard
  2. 创建初始规则集:

    # usbguard generate-policy > /etc/usbguard/rules.conf
  3. 启动 usbguard 守护进程并确保它会在引导时自动启动:

    # systemctl enable --now usbguard

验证

  1. 验证 usbguard 服务是否正在运行:

    # systemctl status usbguard
    ● usbguard.service - USBGuard daemon
       Loaded: loaded (/usr/lib/systemd/system/usbguard.service; enabled; vendor preset: disabled)
       Active: active (running) since Thu 2019-11-07 09:44:07 CET; 3min 16s ago
         Docs: man:usbguard-daemon(8)
     Main PID: 6122 (usbguard-daemon)
        Tasks: 3 (limit: 11493)
       Memory: 1.2M
       CGroup: /system.slice/usbguard.service
               └─6122 /usr/sbin/usbguard-daemon -f -s -c /etc/usbguard/usbguard-daemon.conf
    
    Nov 07 09:44:06 localhost.localdomain systemd[1]: Starting USBGuard daemon...
    Nov 07 09:44:07 localhost.localdomain systemd[1]: Started USBGuard daemon.
  2. 列出 USBGuard 识别的 USB 设备

    # usbguard list-devices
    4: allow id 1d6b:0002 serial "0000:02:00.0" name "xHCI Host Controller" hash...

其它资源

  • usbguard(1) and usbguard-daemon.conf(5) man pages.