r/homeassistant: Protect ~/.ssh

When the Home Assistant container restarts, Podman relabels the entire
`/var/lib/homeassistant` directory as `container_file_t`.  Since the
*homeassistant* user's home directory is `/var/lib/homeassistant`, its
`~/.ssh` directory is thus also relabeled, preventing the SSH daemon
from accessing it.  Since Home Assistant itself does not need access to
this path, we can tell systemd to mount an empty tmpfs filesystem there
in the service unit's mount namespace.  This way, when Podman relabels
the directory, it will change the label of the tmpfs mount point instead
of the actual directory.
step-ssh
Dustin 2023-06-08 10:00:16 -05:00
parent bf4d57b5cb
commit 679ea47bf7
1 changed files with 1 additions and 0 deletions

View File

@ -21,6 +21,7 @@ ExecStart=/usr/bin/podman run \
--gidmap 1:4000000:65536 \ --gidmap 1:4000000:65536 \
ghcr.io/home-assistant/{{ homeassistant_image_name }}:stable ghcr.io/home-assistant/{{ homeassistant_image_name }}:stable
ProtectSystem=full ProtectSystem=full
TemporaryFileSystem=/var/lib/homeassistant/.ssh
UMask=0077 UMask=0077
TimeoutStartSec=5min TimeoutStartSec=5min