-
Notifications
You must be signed in to change notification settings - Fork 99
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
Running exporter as non-root? sudo for calls to smartctl? #146
Comments
You can easily switch various security features of the systemd service to see what works and what not. I don't see an advantage in adding another layer with |
Adding As suggested by @lahwaacz, if you figure out how to configure systemd to improve the security, PRs are welcome! |
@frittentheke FYI prometheus-smartctl-exporter.service in AUR |
I see my provocation of creativity by just mentioning sudo worked :-). Thanks for taking the quest to reduce the privileges seriously and let's see if there is something that could work for most installs. |
The AUR service unit looks very promising! Unfortunately I am not able to test/pull at this time. The full documentation of these options can he found here: https://www.freedesktop.org/software/systemd/man/systemd.exec.html Note that not all distros ship the latest Systemd, so newer options may result in warnings in the journal. However, in my experience it is backward-compatible without issue (you may not get all of the security features but still as many as possible). |
I'm looking for a secure way to run the exporter too. These privileges are required for smartctl:
So you can add these lines to the systemd unit:
But this set of privileges may lead to privilege escalation since root filesystem is accessible for writing. So |
I was wondering if it was really necessary to run the whole smartctl_exporter as root. This is even promoted via the provided systemd unit https://github.com/prometheus-community/smartctl_exporter/blob/master/systemd/smartctl_exporter.service
I know smartctl does seem to require this (smartmontools/smartmontools#205).
But maybe there is a way to not require for the exporter to run as root but to just call a privileged smartctl?
Is the good old sudo the right approach? Just by setting
smartctl.path
tosudo smartctl.path
maybe?The text was updated successfully, but these errors were encountered: