7b74de980222b06e94f371a753b995481330a009
[AGL/meta-agl.git] / meta-app-framework / recipes-connectivity / bluez5 / bluez5_appfw.inc
1 # Recent bluez5 releases started limiting the capabilities of
2 # bluetoothd. When running on a Smack-enabled system, that change has the
3 # effect that bluetoothd can no longer create the input device under
4 # /sys because bluez5 running with label "System" has no write
5 # access to that.
6 #
7 # It works when running as normal root with unrestricted capabilities
8 # because then CAP_MAC_OVERRIDE (a Smack-specific capability) allows
9 # the process to ignore Smack rules.
10 #
11 # We need to ensure that bluetoothd still has that capability.
12 #
13 # To fix the issue, Patick and Casey(the Smack architect) had a talk
14 # about it in Ostro dev mail list. Casey has some ideas about the issue:
15 # "Turning off privilege is a great thing to do *so long as you don't
16 # really need the privilege*. In this case you really need it.
17 # The application package isn't written to account for Smack's use of
18 # CAP_MAC_OVERRIDE as the mechanism for controlling this dangerous operation.
19 # Yes, it would be possible to change /proc to change the Smack label on
20 # that particular file, but that might open other paths for exploit.
21 # I say give the program the required capability. The program maintainer
22 # may well say change the kernel handling of /proc. You're stuck in the
23 # middle, as both work the way they're intended and hence the system
24 # doesn't work. :( There isn't a way to make this work without "loosening"
25 # something."
26 # Therefore, when we we run the program with CAP_MAC_OVERRIDE,
27 # the whole reason for having capabilities is so the we can give a
28 # process the ability to bypass one kind of check without giving it the
29 # ability to bypass other, unrelated checks. A process with
30 # CAP_MAC_OVERRIDE is still constrained by the file mode bits.
31 # We was overly worried about granting that capability.
32 # When it has no other effect than excluding a process from Smack MAC enforcement,
33 # then adding to the process seems like the right solution for now.
34 #
35 # The conclusion from Patick and Casey is that the Smack architect give the key point
36 # that this is the solution preferred.
37 #
38 # Because the solution is to some extend specific to the environment
39 # in which connmand runs, this change is not submitted upstream
40 # and it can be overridden by a distro via FIX_BLUEZ5_CAPABILITIES.
41 #
42 # The related patch has been submitted to upstream too.
43 # upstream link: http://permalink.gmane.org/gmane.linux.bluez.kernel/67993
44
45 FILESEXTRAPATHS:prepend := "${THISDIR}/files:"
46
47 SRC_URI:append:with-lsm-smack = "\
48   file://bluetooth.service.conf \
49 "
50
51 FILES:${PN}:append = " ${systemd_unitdir}"
52
53 do_install:append:with-lsm-smack() {
54   install -Dm0644 ${WORKDIR}/bluetooth.service.conf ${D}${systemd_unitdir}/system/bluetooth.service.d/smack.conf
55 }