Skip to contentSkip to conversation

mesh: Add D-Bus policy for Bluetooth mesh daemon

PATCH In review Inga Stotland 3 participants 5 messages Jan 18, 2019 – Jan 19, 2019

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mesh: Add D-Bus policy for Bluetooth mesh daemon

This adds new D-Bus policy file btmesh.conf

---
 Makefile.mesh    |  6 ++++++
 mesh/btmesh.conf | 24 ++++++++++++++++++++++++
 2 files changed, 30 insertions(+)
 create mode 100644 mesh/btmesh.conf
Makefile.mesh +6 -0
index ea6c5e939..e15718116 100644
@@ -1,5 +1,9 @@
 if MESH
 
+if DATAFILES
+dbus_DATA += mesh/btmesh.conf
+endif
+
 mesh_sources = mesh/mesh.h mesh/mesh.c \
 				mesh/net_keys.h mesh/net_keys.c \
 				mesh/mesh-io.h mesh/mesh-io.c \
@@ -27,4 +31,6 @@ libexec_PROGRAMS += mesh/meshd
 mesh_meshd_SOURCES = $(mesh_sources) mesh/main.c
 mesh_meshd_LDADD = src/libshared-ell.la $(ell_ldadd) -ljson-c
 mesh_meshd_DEPENDENCIES = $(ell_dependencies) src/libshared-ell.la
+
+EXTRA_DIST += mesh/btmesh.conf
 endif
mesh/btmesh.conf new file +24 -0
new file mode 100644
index 000000000..f05545065
@@ -0,0 +1,24 @@
+<!-- This configuration file specifies the required security policies
+     for Bluetooth Mesh daemon to work. -->
+
+<!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN"
+ "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
+<busconfig>
+
+  <!-- ../system.conf have denied everything, so we just punch some holes -->
+
+  <policy user="root">
+    <allow own="org.bluez.mesh"/>
+    <allow send_destination="org.bluez.mesh"/>
+    <allow send_interface="org.bluez.mesh.Application1"/>
+    <allow send_interface="org.bluez.mesh.Element1"/>
+    <allow send_interface="org.bluez.mesh.ProvisionAgent1"/>
+    <allow send_interface="org.freedesktop.DBus.ObjectManager"/>
+    <allow send_interface="org.freedesktop.DBus.Properties"/>
+  </policy>
+
+  <policy context="default">
+    <allow send_destination="org.bluez.mesh"/>
+  </policy>
+
+</busconfig>
Signature · 1 line
2.17.2
#1 lore raw

Hi Inga,

Quoted 60 lines · Inga Stotland

This adds new D-Bus policy file btmesh.conf

---
 Makefile.mesh    |  6 ++++++
 mesh/btmesh.conf | 24 ++++++++++++++++++++++++
 2 files changed, 30 insertions(+)
 create mode 100644 mesh/btmesh.conf
Makefile.mesh +6 -0
index ea6c5e939..e15718116 100644
@@ -1,5 +1,9 @@
 if MESH
 
+if DATAFILES
+dbus_DATA += mesh/btmesh.conf
+endif
+
 mesh_sources = mesh/mesh.h mesh/mesh.c \
                                mesh/net_keys.h mesh/net_keys.c \
                                mesh/mesh-io.h mesh/mesh-io.c \
@@ -27,4 +31,6 @@ libexec_PROGRAMS += mesh/meshd
 mesh_meshd_SOURCES = $(mesh_sources) mesh/main.c
 mesh_meshd_LDADD = src/libshared-ell.la $(ell_ldadd) -ljson-c
 mesh_meshd_DEPENDENCIES = $(ell_dependencies) src/libshared-ell.la
+
+EXTRA_DIST += mesh/btmesh.conf
 endif
mesh/btmesh.conf new file +24 -1
new file mode 100644
index 000000000..f05545065
@@ -0,0 +1,24 @@
+<!-- This configuration file specifies the required security policies
+     for Bluetooth Mesh daemon to work. -->
+
+<!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN"
+ "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
+<busconfig>
+
+  <!-- ../system.conf have denied everything, so we just punch some holes -->
+
+  <policy user="root">
+    <allow own="org.bluez.mesh"/>
+    <allow send_destination="org.bluez.mesh"/>
+    <allow send_interface="org.bluez.mesh.Application1"/>
+    <allow send_interface="org.bluez.mesh.Element1"/>
+    <allow send_interface="org.bluez.mesh.ProvisionAgent1"/>
+    <allow send_interface="org.freedesktop.DBus.ObjectManager"/>
+    <allow send_interface="org.freedesktop.DBus.Properties"/>
+  </policy>
+
+  <policy context="default">
+    <allow send_destination="org.bluez.mesh"/>
+  </policy>
+
+</busconfig>
--
Quoted 1 line

2.17.2

Any plans to put together a btmesh.service file for systemd as well?

#2 lore raw

Hi Luiz,

Quoted 69 lines · Luiz

Hi Inga,

On Fri, Jan 18, 2019 at 12:47 AM Inga Stotland <
[email protected]> wrote:

This adds new D-Bus policy file btmesh.conf

---
 Makefile.mesh    |  6 ++++++
 mesh/btmesh.conf | 24 ++++++++++++++++++++++++
 2 files changed, 30 insertions(+)
 create mode 100644 mesh/btmesh.conf
Makefile.mesh +6 -0
index ea6c5e939..e15718116 100644
@@ -1,5 +1,9 @@
 if MESH
 
+if DATAFILES
+dbus_DATA += mesh/btmesh.conf
+endif
+
 mesh_sources = mesh/mesh.h mesh/mesh.c \
                                mesh/net_keys.h mesh/net_keys.c \
                                mesh/mesh-io.h mesh/mesh-io.c \
@@ -27,4 +31,6 @@ libexec_PROGRAMS += mesh/meshd
 mesh_meshd_SOURCES = $(mesh_sources) mesh/main.c
 mesh_meshd_LDADD = src/libshared-ell.la $(ell_ldadd) -ljson-c
 mesh_meshd_DEPENDENCIES = $(ell_dependencies) src/libshared-ell.la
+
+EXTRA_DIST += mesh/btmesh.conf
 endif
mesh/btmesh.conf new file +1 -0
new file mode 100644
index 000000000..f05545065
@@ -0,0 +1,24 @@
+<!-- This configuration file specifies the required security

policies

mesh/btmesh.conf new file +3 -0
+     for Bluetooth Mesh daemon to work. -->
+
+<!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-BUS Bus

Configuration 1.0//EN"
+ "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">; +<busconfig>

mesh/btmesh.conf new file +2 -0
+
+  <!-- ../system.conf have denied everything, so we just punch some

holes -->

mesh/btmesh.conf new file +16 -1
+
+  <policy user="root">
+    <allow own="org.bluez.mesh"/>
+    <allow send_destination="org.bluez.mesh"/>
+    <allow send_interface="org.bluez.mesh.Application1"/>
+    <allow send_interface="org.bluez.mesh.Element1"/>
+    <allow send_interface="org.bluez.mesh.ProvisionAgent1"/>
+    <allow send_interface="org.freedesktop.DBus.ObjectManager"/>
+    <allow send_interface="org.freedesktop.DBus.Properties"/>
+  </policy>
+
+  <policy context="default">
+    <allow send_destination="org.bluez.mesh"/>
+  </policy>
+
+</busconfig>
--

2.17.2

Quoted 3 lines

Any plans to put together a btmesh.service file for systemd as well?

Yes, but for now I would like to hold off until mesh daemon and bluetoothd can co-exist on one controller. Currently, mesh daemon requires a sole ownership of an hci device.

Regards,
Inga

maintainer
#3 lore raw
In reply to Inga Stotland

Hi Inga,

Quoted 14 lines

This adds new D-Bus policy file btmesh.conf
---
Makefile.mesh | 6 ++++++
mesh/btmesh.conf | 24 ++++++++++++++++++++++++

2 files changed, 30 insertions(+)

create mode 100644 mesh/btmesh.conf

Makefile.mesh +0 -0
index ea6c5e939..e15718116 100644
@@ -1,5 +1,9 @@

if MESH

Makefile.mesh line 6

Quoted 4 lines
Makefile.mesh +4 -0
+if DATAFILES
+dbus_DATA += mesh/btmesh.conf
+endif
+

I prefer this is named bluetooth-mesh.conf.

And for the daemon binary name this might be better as bluetoothd-mesh instead of just meshd.

Quoted 16 lines
mesh_sources = mesh/mesh.h mesh/mesh.c \
				mesh/net_keys.h mesh/net_keys.c \
				mesh/mesh-io.h mesh/mesh-io.c \
Makefile.mesh +0 -0
@@ -27,4 +31,6 @@ libexec_PROGRAMS += mesh/meshd

mesh_meshd_SOURCES = $(mesh_sources) mesh/main.c mesh_meshd_LDADD = src/libshared-ell.la $(ell_ldadd) -ljson-c mesh_meshd_DEPENDENCIES = $(ell_dependencies) src/libshared-ell.la

Makefile.mesh +2 -0
+
+EXTRA_DIST += mesh/btmesh.conf

endif

mesh/btmesh.conf new file +0 -0
new file mode 100644
index 000000000..f05545065

mesh/btmesh.conf line 2

Quoted 2 lines
mesh/btmesh.conf new file +2 -0
@@ -0,0 +1,24 @@
+<!-- This configuration file specifies the required security policies
+     for Bluetooth Mesh daemon to work. —>

Lower case “mesh” here.

Quoted 5 lines
mesh/btmesh.conf new file +5 -0
+
+<!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN"
+ "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
+<busconfig>
+

mesh/btmesh.conf

Quoted 10 lines
mesh/btmesh.conf new file +10 -0
+  <!-- ../system.conf have denied everything, so we just punch some holes -->
+
+  <policy user="root">
+    <allow own="org.bluez.mesh"/>
+    <allow send_destination="org.bluez.mesh"/>
+    <allow send_interface="org.bluez.mesh.Application1"/>
+    <allow send_interface="org.bluez.mesh.Element1"/>
+    <allow send_interface="org.bluez.mesh.ProvisionAgent1"/>
+    <allow send_interface="org.freedesktop.DBus.ObjectManager"/>
+    <allow send_interface="org.freedesktop.DBus.Properties”/>

Do you need the last two?

mesh/btmesh.conf line 24

Quoted 7 lines
mesh/btmesh.conf new file +7 -0
+  </policy>
+
+  <policy context="default">
+    <allow send_destination="org.bluez.mesh"/>
+  </policy>
+
+</busconfig>

Regards

Marcel

#4 lore raw

Hi Marcel,

Quoted 21 lines · Marcel Holtmann

Hi Inga,

This adds new D-Bus policy file btmesh.conf
---
Makefile.mesh | 6 ++++++
mesh/btmesh.conf | 24 ++++++++++++++++++++++++

2 files changed, 30 insertions(+)

create mode 100644 mesh/btmesh.conf

Makefile.mesh +0 -0
index ea6c5e939..e15718116 100644
@@ -1,5 +1,9 @@

if MESH

Makefile.mesh +4 -0
+if DATAFILES
+dbus_DATA += mesh/btmesh.conf
+endif
+
Quoted 3 lines

I prefer this is named bluetooth-mesh.conf.

And for the daemon binary name this might be better as bluetoothd-mesh instead of just meshd.

Agreed: makes it easier finding the process by name

Quoted 38 lines
mesh_sources = mesh/mesh.h mesh/mesh.c \
				mesh/net_keys.h mesh/net_keys.c \
				mesh/mesh-io.h mesh/mesh-io.c \
Makefile.mesh +0 -0
@@ -27,4 +31,6 @@ libexec_PROGRAMS += mesh/meshd

mesh_meshd_SOURCES = $(mesh_sources) mesh/main.c mesh_meshd_LDADD = src/libshared-ell.la $(ell_ldadd) -ljson-c mesh_meshd_DEPENDENCIES = $(ell_dependencies) src/libshared-ell.la

Makefile.mesh +2 -0
+
+EXTRA_DIST += mesh/btmesh.conf

endif

mesh/btmesh.conf new file +2 -0
new file mode 100644
index 000000000..f05545065
@@ -0,0 +1,24 @@
+<!-- This configuration file specifies the required security policies
+     for Bluetooth Mesh daemon to work. —>

Lower case “mesh” here.

mesh/btmesh.conf new file +15 -0
+
+<!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN"
+ "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
+<busconfig>
+
+  <!-- ../system.conf have denied everything, so we just punch some holes -->
+
+  <policy user="root">
+    <allow own="org.bluez.mesh"/>
+    <allow send_destination="org.bluez.mesh"/>
+    <allow send_interface="org.bluez.mesh.Application1"/>
+    <allow send_interface="org.bluez.mesh.Element1"/>
+    <allow send_interface="org.bluez.mesh.ProvisionAgent1"/>
+    <allow send_interface="org.freedesktop.DBus.ObjectManager"/>
+    <allow send_interface="org.freedesktop.DBus.Properties”/>
Quoted 1 line

Do you need the last two?

Not really. Will remove.

Quoted 9 lines
mesh/btmesh.conf new file +7 -0
+  </policy>
+
+  <policy context="default">
+    <allow send_destination="org.bluez.mesh"/>
+  </policy>
+
+</busconfig>
Quoted 4 lines

Regards

Marcel

Thanks,
Inga