nixpkgs/nixos/modules
Martin Weinelt 12c26aca1f
prometheus.exporters.smartctl: Fix autodiscovery
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
  disk6:
2022-01-27 17:33:27 +01:00
..
config Merge pull request #148344 from pasqui23/portals 2022-01-26 19:22:49 +01:00
hardware Merge pull request #154550 from veehaitch/sgx-compat-udev 2022-01-13 14:55:08 +00:00
i18n/input-method nixos/documentation: split options doc build 2022-01-02 19:46:13 +01:00
installer Merge pull request #153409 from tpwrules/fix-nonx86-iso-reproducibility 2022-01-23 21:15:26 -05:00
misc nixos/locate Add support for plocate (#156185) 2022-01-24 00:36:51 +01:00
profiles all-hardware: Add virtio_mmio module 2022-01-06 17:23:10 -08:00
programs nixos/programs/tmux: specify wanted plugins 2022-01-25 17:12:44 -05:00
security Merge master into staging-next 2022-01-12 12:01:06 +00:00
services prometheus.exporters.smartctl: Fix autodiscovery 2022-01-27 17:33:27 +01:00
system Merge remote-tracking branch 'origin/master' into staging-next 2022-01-25 15:53:19 +01:00
tasks nixos/networkd: fix networking.networkd.static test 2022-01-21 19:35:17 +01:00
testing nixos/lib/qemu-flags: rename to qemu-common 2021-09-18 16:58:16 +02:00
virtualisation nixos/openvswitch: remove ipsec 2022-01-26 01:12:40 +01:00
module-list.nix nixos/racoon: drop 2022-01-26 01:12:39 +01:00
rename.nix nixos/racoon: drop 2022-01-26 01:12:39 +01:00