-
Notifications
You must be signed in to change notification settings - Fork 41
Update mctpd and example configs to minimise necessary permissions #163
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -16,6 +16,8 @@ add_project_arguments('-Wno-unused-parameter', language : 'c') | |
|
|
||
| libsystemd = dependency('libsystemd', version: '>=247', required: false) | ||
|
|
||
| libcap = dependency('libcap', required: false) | ||
|
|
||
| conf = configuration_data() | ||
| conf.set10('HAVE_LINUX_MCTP_H', | ||
| cc.has_header('linux/mctp.h'), | ||
|
|
@@ -37,6 +39,10 @@ conf.set10('MCTPD_WRITABLE_CONNECTIVITY', | |
| get_option('unsafe-writable-connectivity'), | ||
| description: 'Allow writes to the Connectivity member of the au.com.codeconstruct.MCTP.Endpoint1 interface on endpoint objects') | ||
|
|
||
| conf.set10('MCTPD_MANAGE_CAPABILITIES', | ||
| libcap.found(), | ||
| description: 'Require mctpd to minimise its capabilities') | ||
|
|
||
| conf.set_quoted('MCTPD_CONF_FILE_DEFAULT', | ||
| join_paths(get_option('prefix'), get_option('sysconfdir'), 'mctpd.conf'), | ||
| description: 'Default configuration file path', | ||
|
|
@@ -89,7 +95,7 @@ if libsystemd.found() | |
| sources: [ | ||
| 'src/mctpd.c', | ||
| ] + netlink_sources + util_sources + ops_sources, | ||
| dependencies: [libsystemd, toml_dep], | ||
| dependencies: [libsystemd, toml_dep, libcap], | ||
| install: true, | ||
| install_dir: get_option('sbindir'), | ||
| c_args: ['-DOPS_SD_EVENT=1'], | ||
|
|
@@ -100,7 +106,7 @@ if libsystemd.found() | |
| 'src/mctpd.c', | ||
| ] + test_ops_sources + netlink_sources + util_sources, | ||
| include_directories: include_directories('src'), | ||
| dependencies: [libsystemd, toml_dep], | ||
| dependencies: [libsystemd, toml_dep, libcap], | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. it might be nice to prevent the test-mctpd process from attempting to alter capabilities - its Any ideas to handle that? [I am assuming that the absence of
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think there should be any trouble from trying to set the capabilities to their current value. If you really wanted to prevent it from trying to change capabilities during testing, there should be ways to have Is there anything specific you're worried about? |
||
| c_args: ['-DOPS_SD_EVENT=1'], | ||
| ) | ||
| endif | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Slight preference to name this according to the dependency it is representing (ie.,
HAVE_LIBCAP), rather than as a user-provided option - as these last twoMCTPD_conf parameters are doing.Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was thinking of what the macro meant for the code's behaviour, rather than what conditions allowed it.
Figured some users might not want to include the functionality even if libcap was available.
I probably should have added it as a configurable option.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need to make it a config option; if libcap is available we should use it.
Although it's possible to provide an option for things like this, it's not always desirable. In this case, there's a fairly obvious ideal choice, so we take that. If someone has a use-case for something else, we can incorporate that into a future change. Since we don't have details of that use case now though, no need to cater for it.