Skip to content

Commit 3cd2da6

Browse files
mcptd: Replace root in suggested configs
Allow mctpd, which should be an unprivileged user, to run the daemon with minimum capabilities. mctpd needs CAP_NET_BIND_SERVICE and CAP_NET_ADMIN, so those have been added to AmbientCapabilities in the service config. The mctpd user has been allowed to own the au.com.codeconstruct.MCTP1 object as well as root. root also retains the right to own the object, meaning the config remains valid if the daemon is run as root. Unprivileged users can only access properties and are prohibited from configuring the network. Root and users in the mctp-admin group are permitted to interact with any method the daemon provides. For some setups, it may be useful to create a group with permissions to use the RegisterTypeSupport or RegisterVDMTypeSupport methods so that programs may register support without being given permission to modify the network characteristics. Signed-off-by: James Lee <james@codeconstruct.com.au>
1 parent 79dad2d commit 3cd2da6

2 files changed

Lines changed: 27 additions & 1 deletion

File tree

conf/mctpd-dbus.conf

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,33 @@
22
<!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN"
33
"http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
44
<busconfig>
5+
<policy context="default">
6+
<deny send_destination="au.com.codeconstruct.MCTP1">
7+
8+
<allow receive_sender="au.com.codeconstruct.MCTP1"/>
9+
10+
<allow send_destination="au.com.codeconstruct.MCTP1"
11+
send_interface="org.freedesktop.DBus.Propeties"
12+
send_member="Get"/>
13+
14+
<allow send_destination="au.com.codeconstruct.MCTP1"
15+
send_interface="org.freedesktop.DBus.Propeties"
16+
send_member="GetAll"/>
17+
18+
<allow send_destination="au.com.codeconstruct.MCTP1"
19+
send_interface="org.freedesktop.DBus.Introspectable"/>
20+
21+
<allow send_destination="au.com.codeconstruct.MCTP1"
22+
send_interface="org.freedesktop.DBus.ObjectManager"/>
23+
</policy>
24+
<policy user="mctpd">
25+
<allow own="au.com.codeconstruct.MCTP1"/>
26+
</policy>
27+
<policy group="mctp-admin">
28+
<allow send_destination="au.com.codeconstruct.MCTP1"/>
29+
</policy>
530
<policy user="root">
631
<allow own="au.com.codeconstruct.MCTP1"/>
732
<allow send_destination="au.com.codeconstruct.MCTP1"/>
8-
<allow receive_sender="au.com.codeconstruct.MCTP1"/>
933
</policy>
1034
</busconfig>

conf/mctpd.service

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ After=mctp-local.target
88
Type=dbus
99
BusName=au.com.codeconstruct.MCTP1
1010
ExecStart=/usr/sbin/mctpd
11+
User=mctpd
12+
AmbientCapabilities=CAP_NET_BIND_SERVICE CAP_NET_ADMIN
1113

1214
[Install]
1315
WantedBy=mctp.target

0 commit comments

Comments
 (0)