]> git.ipfire.org Git - thirdparty/libvirt.git/commit
util: add access check for hooks to fix running as non-root
authorDaniel P. Berrangé <berrange@redhat.com>
Wed, 1 Jul 2020 16:36:51 +0000 (17:36 +0100)
committerDaniel P. Berrangé <berrange@redhat.com>
Wed, 1 Jul 2020 17:54:21 +0000 (18:54 +0100)
commit7fa7f7eeb6e969e002845928e155914da2fc8cd0
tree04228b9a6b65ec7d2fb4c9cc8c88f897fd25b890
parentc3fa17cd9a158f38416a80af3e0f712bf96ebf38
util: add access check for hooks to fix running as non-root

Since feb83c1e710b9ea8044a89346f4868d03b31b0f1 libvirtd will abort on
startup if run as non-root

  2020-07-01 16:30:30.738+0000: 1647444: error : virDirOpenInternal:2869 : cannot open directory '/etc/libvirt/hooks/daemon.d': Permission denied

The root cause flaw is that non-root libvirtd is using /etc/libvirt for
its hooks. Traditionally that has been harmless though since we checked
whether we could access the hook file and degraded gracefully. We need
the same access check for iterating over the hook directory.

Long term we should make it possible to have an unprivileged hook dir
under $HOME.

Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
src/util/virhook.c