config: add examples to show how to enable/disable the Stats interface
authorAlban Crequy <alban.crequy@collabora.co.uk>
Fri, 26 Sep 2014 10:26:32 +0000 (11:26 +0100)
committerSimon McVittie <simon.mcvittie@collabora.co.uk>
Wed, 1 Oct 2014 15:38:40 +0000 (16:38 +0100)
[install examples to ${docdir}/examples -smcv]

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=80759
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
bus/Makefile.am
bus/example-session-disable-stats.conf.in [new file with mode: 0644]
bus/example-system-enable-stats.conf.in [new file with mode: 0644]
configure.ac

index 25029b4..c0bc154 100644 (file)
@@ -31,7 +31,10 @@ EFENCE=
 CONFIG_IN_FILES=                               \
        session.conf.in                         \
        system.conf.in                          \
-       org.freedesktop.dbus-session.plist.in
+       org.freedesktop.dbus-session.plist.in   \
+       example-system-enable-stats.conf.in     \
+       example-session-disable-stats.conf.in   \
+       $(NULL)
 
 config_DATA = session.conf
 
@@ -39,6 +42,12 @@ if DBUS_UNIX
 config_DATA += system.conf
 endif
 
+examplesdir = ${docdir}/examples
+examples_DATA = \
+       example-system-enable-stats.conf        \
+       example-session-disable-stats.conf      \
+       $(NULL)
+
 if DBUS_ENABLE_LAUNCHD
 agentdir=$(LAUNCHD_AGENT_DIR)
 agent_DATA=org.freedesktop.dbus-session.plist
diff --git a/bus/example-session-disable-stats.conf.in b/bus/example-session-disable-stats.conf.in
new file mode 100644 (file)
index 0000000..2863ef0
--- /dev/null
@@ -0,0 +1,15 @@
+<!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN"
+ "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
+<busconfig>
+
+  <!-- If the Stats interface was enabled at compile-time, users can use it on
+       the session bus by default. Systems providing isolation of processes
+       with LSMs might want to restrict this. This can be achieved by copying
+       this file in @EXPANDED_SYSCONFDIR@/dbus-1/session.d/ -->
+
+  <policy context="default">
+    <deny send_destination="org.freedesktop.DBus"
+          send_interface="org.freedesktop.DBus.Debug.Stats"/>
+  </policy>
+
+</busconfig>
diff --git a/bus/example-system-enable-stats.conf.in b/bus/example-system-enable-stats.conf.in
new file mode 100644 (file)
index 0000000..a85aa83
--- /dev/null
@@ -0,0 +1,15 @@
+<!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN"
+ "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
+<busconfig>
+
+  <!-- If the Stats interface was enabled at compile-time, only root may use it.
+       Replace USERNAME and copy this file in @EXPANDED_SYSCONFDIR@/dbus-1/system.d/
+       if you want to enable other privileged users to view statistics and
+       debug info -->
+
+  <policy user="USERNAME">
+    <allow send_destination="org.freedesktop.DBus"
+           send_interface="org.freedesktop.DBus.Debug.Stats"/>
+  </policy>
+
+</busconfig>
index 142b59c..cb0bda4 100644 (file)
@@ -1750,6 +1750,8 @@ dbus/versioninfo.rc
 dbus/dbus-arch-deps.h
 bus/system.conf
 bus/session.conf
+bus/example-system-enable-stats.conf
+bus/example-session-disable-stats.conf
 bus/messagebus
 bus/messagebus-config
 bus/org.freedesktop.dbus-session.plist