NetworkManager/src/libnm-base/nm-sudo-utils.h
Thomas Haller de5dddccbe
core: get file descriptor to ovsdb unix socket from nm-sudo
To talk to ovsdb, we use the unix socket at
/var/run/openvswitch/db.sock. But that socket is owned by another user
and NetworkManager would need dac_override capability to open it.

We want to drop dac_override, but we still need to talk to ovsdb. Add a
GetFD() method to nm-sudo.

We still first try to open the socket directly. Maybe it just works.

Note that SELinux may block passing file descriptors from nm-sudo. If it
doesn't work for you, test with SELinux permissive mode and wait for an
SELinux update.
2021-07-26 15:31:46 +02:00

23 lines
729 B
C

/* SPDX-License-Identifier: LGPL-2.1-or-later */
#ifndef __NM_SUDO_UTILS_H__
#define __NM_SUDO_UTILS_H__
/*****************************************************************************/
#define NM_SUDO_DBUS_BUS_NAME "org.freedesktop.nm.sudo"
#define NM_SUDO_DBUS_OBJECT_PATH "/org/freedesktop/nm/sudo"
#define NM_SUDO_DBUS_IFACE_NAME "org.freedesktop.nm.sudo"
/*****************************************************************************/
#define NM_OVSDB_SOCKET RUNSTATEDIR "/openvswitch/db.sock"
typedef enum {
NM_SUDO_GET_FD_TYPE_NONE = 0,
NM_SUDO_GET_FD_TYPE_OVSDB_SOCKET = 1,
} NMSudoGetFDType;
int nm_sudo_utils_open_fd(NMSudoGetFDType fd_type, GError **error);
#endif /* __NM_SUDO_UTILS_H__ */