Skip to content

Update mctpd and example configs to minimise necessary permissions#163

Open
SafetyInObscurity wants to merge 2 commits into
CodeConstruct:mainfrom
SafetyInObscurity:noroot
Open

Update mctpd and example configs to minimise necessary permissions#163
SafetyInObscurity wants to merge 2 commits into
CodeConstruct:mainfrom
SafetyInObscurity:noroot

Conversation

@SafetyInObscurity

@SafetyInObscurity SafetyInObscurity commented Jul 6, 2026

Copy link
Copy Markdown

Updated mctpd to manage its capabilities, dropping CAP_NET_BIND_SERVICE when no longer needed. The example configs have been updated to run mctpd as an unprivileged user with only necessary capabilities added while also allowing it to continue to be run as root if desired.

The ability to interact with mctpd via the system D-bus has also been restricted to root and a special mctp-admin role, though properties can still be viewed by unprivileged users.

@SafetyInObscurity SafetyInObscurity force-pushed the noroot branch 3 times, most recently from 5ff82b7 to 43bfb81 Compare July 6, 2026 06:19
@SafetyInObscurity SafetyInObscurity marked this pull request as draft July 6, 2026 06:20
@SafetyInObscurity SafetyInObscurity force-pushed the noroot branch 4 times, most recently from aac0693 to 8e0724f Compare July 6, 2026 07:42
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>
@SafetyInObscurity SafetyInObscurity force-pushed the noroot branch 8 times, most recently from 9f33051 to df9fb86 Compare July 7, 2026 09:08
@SafetyInObscurity SafetyInObscurity marked this pull request as ready for review July 7, 2026 09:10
Added the set_cap() function to mctpd, allowing the process to drop
CAP_NET_BIND_SERVICE when it is no longer needed. This requires libcap
on the target device. If libcap is missing drop_bind_cap() will be a
stub, and mctpd will emit a warning when it starts.

Because mctpd requires additional capabilities and may recieve hostile
inputs, dropping the capability when it is no longer needed is useful to
increase safety.

libcap has been added as a possible dependency to the meson build and
mcpd now uses the MCTPD_MANAGING_CAPABILITIES macro to determine if
libcap is available.

mctpd.md has been updated to reflect the new capability management.

Signed-off-by: James Lee <james@codeconstruct.com.au>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant