Open jk-10 opened 1 year ago
Hi @jk-10,
I confirm that single trailing spaces in rules.conf
. Here is how to reproduce it easily and the precise error output I get:
# sudo /etc/init.d/usbguard stop # or a systemd equivalent
# cd "$(mktemp -d)"
# sudo usbguard generate-policy > rules.conf
# echo "RuleFile=${PWD}/rules.conf" > usbguard-daemon.conf
# sed 's,$, ,' -i rules.conf # inserts trailing whitespace
# sudo usbguard-daemon -d -k -P -c ./usbguard-daemon.conf -l ./usbguard-daemon.log
[..]
[1669913599.512] (E) Rules: SourceLOCAL::/tmp/tmp.B7cpfOgomY/rules.conf: :1:225: parse error matching sor<usbguard::RuleParser::comment, usbguard::RuleParser::rule>
This is with USBGuard version 1.1.2. I'm assuming you are running 1.1.1+ds-3 because of your mention of Ubuntu 22.04 (codenamed "jammy").
It seems that usbguard fails to start if rule line in rules.conf ends with space character. (Problem may also occur with other lines, i did not check that.)
I added a new rule and tried to stop and start usbguard again:
Then I removed the space at the end of the newly added rule line and tried again:
Please add support for having spaces or make usbguard to remove them automatically when reading the conf file.
I don't know the usbguard version, but it is the default version coming with the Ubuntu 22.04 which is my OS.