Commit Graph

8 Commits (1db158c1505cd67538cf76700373529b7398f0ad)

Author SHA1 Message Date
Dustin 48145c3573 nut: Enable Podman auto-update for containers
Setting `AutoUpdate=registry` will tell Podman to automatically fetch
an updated container image from its corresponding registry and restart
the container.  The `podman-auto-update.timer` systemd unit needs to be
active for this to happen on a schedule.
2024-01-19 20:10:11 -06:00
Dustin a919a9f94b nut/monitor: Fix tmpfs mount syntax
`dest` is not a valid option for the `--mount` argument to `podman`.  To
specify where the target path, only `target`, `destination`, and `dst`
are valid.
2024-01-19 16:42:56 -06:00
Dustin fb74f0e81c nut: Configure upsmon
`upsmon` is the component of NUT that tracks the status of UPSs and
reacts to their changing by sending notifications and/or shutting down
the system.  It is a networked application that can run on any system;
it can run on a different system than `upsd`, and indeed can run on
multiple systems simultaneously.

Each system that runs `upsmon` will need a username and password for
each UPS it will monitor.  Using the CUE [function pattern][0], I've
made it pretty simple to declare the necessary values under
`nut.monitor`.

[0]: https://cuetorials.com/patterns/functions/
2024-01-19 08:52:14 -06:00
Dustin 52642d37d9 nut: Configure collectd NUT plugin
infra/cfg/pipeline/head This commit looks good Details
2024-01-17 07:18:37 -06:00
Dustin 47278c01e5 nut: Set container_use_devices SELinux tunable
By default, the Fedora SELinux policy does not allow containers to
access device nodes.  This setting is independent of CGroup device
rules.
2024-01-15 12:55:10 -06:00
Dustin be1042cda7 nut: Do not run as privileged container
The only privilege NUT needs is access to the USB device nodes.  Using a
device CGroup rule to allow this is significantly better than disabling
all restrictions.  Especially since I discovered that `--privileged`
implies `--security-opt label=disable`, effectively disabling SELinux
confinement of the container.
2024-01-14 19:24:55 -06:00
Dustin 74508faf27 nut: Apply udev rules on the host
NUT needs some udev rules in order to set the proper permissions on USB
etc. devices so it can run as an otherwise unprivileged user.  Since
udev rules can only be processed on the host, these rules need to be
copied out of the container and evaluated before the NUT server starts.
To enable this, the *nut-server* container image copies the rules it
contains to `/etc/udev/rules.d` if that directory is a mount point.  By
bind mounting a directory on the host at that path, we can get a copy of
the rules files outside the container.  Then, using a systemd path unit,
we can tell the udev daemon to reload and reevaluate its rules.

SELinux prevents processes in containers from writing to
`/etc/udev/rules.d` directly, so we have to use an intermediate location
and then copy the rules files to their final destination.
2024-01-14 19:24:55 -06:00
Dustin 778c6d440d Initial commit 2024-01-14 19:24:55 -06:00