Skip to content

Commit

Permalink
Setup D-Bus policy for tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
Allen-Webb committed Oct 18, 2019
1 parent 14040ad commit bd4a9d3
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions src/Tests/bash-testlib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -240,3 +240,26 @@ function execute()

return $job_rc
}

function setup_test_dbus_policy() {
local config_file='/etc/dbus-1/system.d/test.org.usbguard1.conf'
if [[ -e "${config_file}" ]]; then
return
fi

sudo -n tee "${config_file}" <<EOF
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE busconfig PUBLIC
"-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN"
"http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
<busconfig>
<policy user="root">
<allow own="org.usbguard1"/>
</policy>
</busconfig>
EOF
sudo -n dbus-send --system --dest=org.freedesktop.DBus --type=method_call \
/org org.freedesktop.DBus.ReloadConfig
}

setup_test_dbus_policy

0 comments on commit bd4a9d3

Please sign in to comment.