12c26aca1f
When no devices are given the exporter tries to autodiscover available
disks. The previous DevicePolicy was however preventing the exporter
from accessing any device at all, since only explicitly mentioned ones
were allowed.
This commit adds an allow rule for several device classes that I could
find on my machines, that gets set when no devices are explicitly
configured.
There is an existing problem with nvme devices, that expose a character
device at `/dev/nvme0`, and a (namespaced) block device at
`/dev/nvme0n1`. The character device does not come with permissions that
we could give to the exporter without further impacting the hardening.
crw------- 1 root root 247, 0 27. Jan 03:10 /dev/nvme0
brw-rw---- 1 root disk 259, 0 27. Jan 03:10 /dev/nvme0n1
The autodiscovery only finds the character device, which the exporter
unfortunately does not have access to.
However a simple udev rule can be used to resolve this:
services.udev.extraRules = ''
SUBSYSTEM=="nvme", KERNEL=="nvme[0-9]*", GROUP="disk"
'';
Unfortunately I'm not fully aware of the security implications this
change carries and we should question upstream (systemd) why they did
not include such a rule.
The disk group has no members on any of my machines.
❯ getent group disk
disk❌6:
|
||
---|---|---|
.. | ||
dd-agent | ||
prometheus | ||
alerta.nix | ||
apcupsd.nix | ||
arbtt.nix | ||
bosun.nix | ||
cadvisor.nix | ||
collectd.nix | ||
das_watchdog.nix | ||
datadog-agent.nix | ||
do-agent.nix | ||
fusion-inventory.nix | ||
grafana-image-renderer.nix | ||
grafana-reporter.nix | ||
grafana.nix | ||
graphite.nix | ||
hdaps.nix | ||
heapster.nix | ||
incron.nix | ||
kapacitor.nix | ||
loki.nix | ||
longview.nix | ||
mackerel-agent.nix | ||
metricbeat.nix | ||
monit.nix | ||
munin.nix | ||
nagios.nix | ||
netdata.nix | ||
parsedmarc.md | ||
parsedmarc.nix | ||
parsedmarc.xml | ||
riemann-dash.nix | ||
riemann-tools.nix | ||
riemann.nix | ||
scollector.nix | ||
smartd.nix | ||
statsd.nix | ||
sysstat.nix | ||
teamviewer.nix | ||
telegraf.nix | ||
thanos.nix | ||
tuptime.nix | ||
unifi-poller.nix | ||
ups.nix | ||
uptime.nix | ||
vnstat.nix | ||
zabbix-agent.nix | ||
zabbix-proxy.nix | ||
zabbix-server.nix |