Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1195fbb8 authored by Marcel Holtmann's avatar Marcel Holtmann Committed by Johan Hedberg
Browse files

Bluetooth: Open management interface for untrusted users



Until now the management interface was restricted to CAP_NET_ADMIN. With
this change every user can open the management socket. However the list
of commands is heavily restricted to getting basic information about the
attached controllers. No access for configuration or other operation is
provided. The events are also limited. This is done so that no keys can
leak or untrusted users can mess with the Bluetooth configuration.

Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
Signed-off-by: default avatarJohan Hedberg <johan.hedberg@intel.com>
parent c927a104
Loading
Loading
Loading
Loading
+6 −9
Original line number Diff line number Diff line
@@ -795,15 +795,12 @@ static int hci_sock_bind(struct socket *sock, struct sockaddr *addr,
			goto done;
		}

		if (!capable(CAP_NET_ADMIN)) {
			err = -EPERM;
			goto done;
		}

		/* Since the access to control channels is currently
		 * restricted to CAP_NET_ADMIN capabilities, every
		 * socket is implicitly trusted.
		/* Users with CAP_NET_ADMIN capabilities are allowed
		 * access to all management commands and events. For
		 * untrusted users the interface is restricted and
		 * also only untrusted events are sent.
		 */
		if (capable(CAP_NET_ADMIN))
			hci_sock_set_flag(sk, HCI_SOCK_TRUSTED);

		/* At the moment the index and unconfigured index events