'\" t .\" Title: usbguard-daemon.conf .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] .\" Generator: DocBook XSL Stylesheets vsnapshot .\" Date: 03/17/2024 .\" Manual: \ \& .\" Source: \ \& .\" Language: English .\" .TH "USBGUARD\-DAEMON\&.C" "5" "03/17/2024" "\ \&" "\ \&" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .\" http://bugs.debian.org/507673 .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- .\" disable hyphenation .nh .\" disable justification (adjust text to left margin only) .ad l .\" ----------------------------------------------------------------- .\" * MAIN CONTENT STARTS HERE * .\" ----------------------------------------------------------------- .SH "NAME" usbguard-daemon.conf \- USBGuard daemon configuration file .SH "DESCRIPTION" .sp The \fBusbguard\-daemon\&.conf\fR file is loaded by the USBGuard daemon after it parses its command\-line options\&. It is used to configure runtime parameters of the daemon\&. The default search path is \fI/etc/usbguard/usbguard\-daemon\&.conf\fR\&. It may be overridden using the \fB\-c\fR command\-line option, see \fBusbguard\-daemon\fR(8) for further details\&. .SH "OPTIONS" .PP \fBRuleFile\fR=\fIpath\fR .RS 4 The USBGuard daemon will use this file to load the policy rule set from it and to write new rules received via the IPC interface\&. Default: %sysconfdir%/usbguard/rules\&.conf .RE .PP \fBRuleFolder\fR=\fIpath\fR .RS 4 The USBGuard daemon will use this folder to load the policy rule set from it and to write new rules received via the IPC interface\&. Usually, we set the option to /etc/usbguard/rules\&.d/\&. The USBGuard daemon is supposed to behave like any other standard Linux daemon therefore it loads rule files in alpha\-numeric order\&. File names inside RuleFolder directory should start with a two\-digit number prefix indicating the position, in which the rules are scanned by the daemon\&. .RE .PP \fBImplicitPolicyTarget\fR=\fItarget\fR .RS 4 How to treat USB devices that don\(cqt match any rule in the policy\&. Target should be one of allow, block or reject (logically remove the device node from the system)\&. Default: block .RE .PP \fBPresentDevicePolicy\fR=\fIpolicy\fR .RS 4 How to treat USB devices that are already connected when the daemon starts\&. Policy should be one of allow, block, reject, keep (keep whatever state the device is currently in) or apply\-policy (evaluate the rule set for every present device)\&. Default: apply\-policy .RE .PP \fBPresentControllerPolicy\fR=\fIpolicy\fR .RS 4 How to treat USB \fBcontroller\fR devices that are already connected when the daemon starts\&. One of allow, block, reject, keep or apply\-policy\&. Default: keep .RE .PP \fBInsertedDevicePolicy\fR=\fIpolicy\fR .RS 4 How to treat USB devices that are already connected \fIafter\fR the daemon starts\&. One of block, reject, apply\-policy\&. Default: apply\-policy .RE .PP \fBAuthorizedDefault\fR=\fIauthorizedDefault\fR .RS 4 The USBGuard daemon modifies some of the default authorization state attributes of controller devices\&. This setting, enables you to define what value the default authorization is set to\&. Authorized default should be one of keep (do not change authorization state), none (every new device starts out deauthorized), all (every new device starts out authorized) or internal (internal devices start out authorized, external do not)\&. Default: none .RE .PP \fBRestoreControllerDeviceState\fR=\fIboolean\fR .RS 4 The USBGuard daemon modifies some attributes of controller devices like the default authorization state of new child device instances\&. Using this setting, you can control whether the daemon will try to restore the attribute values to the state before modification on shutdown\&. Default: false .RE .PP \fBDeviceManagerBackend\fR=\fIbackend\fR .RS 4 Which device manager backend implementation to use\&. Backend should be one of uevent (default) or umockdev (useful for testing)\&. UEvent backend is a netlink based implementation which uses sysfs to scan for present devices and an uevent socket for receiving USB device related events\&. UMockDev based device manager is capable of simulating devices based on umockdev\-record files\&. Default: uevent .RE .PP \fBIPCAllowedUsers\fR=\fIusername\fR\ \&[\fIusername\fR\ \&\&...] .RS 4 A space delimited list of usernames that the daemon will accept IPC connections from\&. Default: root .RE .PP \fBIPCAllowedGroups\fR=\fIgroupname\fR\ \&[\fIgroupname\fR\ \&\&...] .RS 4 A space delimited list of groupnames that the daemon will accept IPC connections from\&. .RE .PP \fBIPCAccessControlFiles\fR=\fIpath\fR .RS 4 The files at this location will be interpreted by the daemon as IPC access control definition files\&. See the IPC ACCESS CONTROL section for more details\&. .RE .PP \fBDeviceRulesWithPort\fR=\fIboolean\fR .RS 4 Generate device specific rules including the "via\-port" attribute\&. Default: false .RE .PP \fBAuditBackend\fR=\fIbackend\fR .RS 4 USBGuard audit events log backend\&. The \fIbackend\fR value should be one of FileAudit or LinuxAudit\&. Default: FileAudit .RE .PP \fBAuditFilePath\fR=\fIfilepath\fR .RS 4 USBGuard audit events log file path\&. Required if AuditBackend is set to FileAudit\&. Default: %localstatedir%/log/usbguard/usbguard\-audit\&.log .RE .PP \fBHidePII\fR=\fIboolean\fR .RS 4 Hides personally identifiable information such as device serial numbers and hashes of descriptors (which include the serial number) from audit entries\&. Default: false .RE .SH "SECURITY CONSIDERATIONS" .SS "IPC" .sp The daemon provides the USBGuard public IPC interface\&. Depending on your distribution defaults, access to this interface is limited to a certain group or a specific user only\&. Please set either the \fBIPCAllowedUsers\fR, \fBIPCAllowedGroups\fR or \fBIPCAccessControlFiles\fR options to limit access to the IPC interface\&. \fBDo not leave the ACL unconfigured as that will expose the IPC interface to all local users and will allow them to manipulate the authorization state of USB devices and modify the USBGuard policy\fR\&. .SS "RestoreControllerDeviceState configuration option" .sp If set to true, the USB authorization policy could be bypassed by performing some sort of attack on the daemon (via a local exploit or via a USB device) to make it shutdown and restore to the operating\-system default state (known to be permissive)\&. .SH "IPC ACCESS CONTROL" .sp Access to the USBGuard IPC interface can be limited per user or group\&. Furthermore, by using the IPC Access Control files, it is possible to limit the access down to the level of Sections and Privileges as explained below\&. .SS "Recommended: IPCAccessControlFiles" .sp When you set \fBIPCAccessControlFiles\fR option, the daemon will look for IPC access control files in the directory specified by the set value\&. Each file in the directory is processed as follows: .sp .RS 4 .ie n \{\ \h'-04' 1.\h'+01'\c .\} .el \{\ .sp -1 .IP " 1." 4.2 .\} The basename of the file is interpreted as a username, UID, groupname or GID\&. If the name starts with : (colon), it is assumed that the rest of the name represents a group identifier (groupname or GID in case of a numeric\-only string)\&. Otherwise, it is interpreted as a user identifier (username or UID in case of numeric\-only string)\&. .RE .sp .RS 4 .ie n \{\ \h'-04' 2.\h'+01'\c .\} .el \{\ .sp -1 .IP " 2." 4.2 .\} The contents of the file are parsed as Section=[privilege1][,privilege2] \&.\&.\&. formatted lines which specify the section privileges\&. If a section is omitted, it is assumed that no privileges are given for that section\&. .RE .sp Available sections and privileges: .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \fBDevices\fR .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} modify: Change authorization state of devices including permanent changes (i\&.e\&. modification of device specific rules in the policy)\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} list: Ability to get a list of recognized devices and their attributes\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} listen: Listen to device presence and device policy changes\&. .RE .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \fBPolicy\fR .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} modify: Append rules to or remove any rules from the policy\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} list: Ability to view the currently enforced policy\&. .RE .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \fBExceptions\fR .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} listen: Receive exception messages\&. .RE .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \fBParameters\fR .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} modify: Set values of run\-time parameters\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} list: Get values of run\-time parameters\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} listen: Listen to property parameter changes\&. .RE .RE .sp The following is a generally usable and reasonably safe example of an access control file\&. It allows one to modify USB device authorization state (Devices=modify), list USB devices (Devices=list), listen to USB device related events (Devices=listen), list USB authorization policy rules (Policy=list) and listen to exception events (Exceptions=listen): .sp .if n \{\ .RS 4 .\} .nf Devices=modify,list,listen Policy=list Exceptions=listen .fi .if n \{\ .RE .\} .sp You can create or remove the IPC access control files using usbguard add\-user and usbguard remove\-user CLI commands\&. See usbguard(1) for more details\&. If you want to create the IPC access control files manually, you need to set the files permissions to 0600\&. .SS "Legacy: IPCAllowedUsers and IPCAllowedGroups" .sp Example configuration allowing full IPC access to users \fIroot\fR, \fIjoe\fR and members of the group \fIwheel\fR: .sp .if n \{\ .RS 4 .\} .nf IPCAllowedUsers=root joe IPCAllowedGroups=wheel .fi .if n \{\ .RE .\} .SH "SEE ALSO" .sp usbguard\-daemon(8), usbguard\-rules\&.conf(5)