Skip to content
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

Missing permissions to swapfile_t for systemd_login_t and systemd_sleep_t #2108

Open
mtalexan opened this issue May 3, 2024 · 2 comments
Open

Comments

@mtalexan
Copy link

mtalexan commented May 3, 2024

Per a write up on the Fedora Forum, when setting up a swapfile the file usually needs to be in a dedicated directory so it can be managed separately by the file system (e.g. a separate BTRFS subvolume). That directory seems to need to be labeled with the standard swapfile_t label, which of course is a unique-per-system configuration.

However, once labeled, sleeping is blocked by an AVC denial because the systemd_login_t process needs to be able to do a search on the swap_file_t domain to find the swapfile itself in the dedicated and labeled swapfile folder.

Even after this permission is granted, hibernation/suspend-to-disk runs into the same problem from systemd_sleep_t.

Unless I'm mistaken, it seems like the following should be part of this base policy:

#============= systemd_logind_t ==============
allow systemd_logind_t swapfile_t:dir search;

#============= systemd_sleep_t ==============
allow systemd_sleep_t swapfile_t:dir search;

The only other thing I can think of is if the directory containing the swapfile is expected to be labeled some other way, while the swapfile itself is the only thing labled as swapfile_t? But if so, what's the expected label on the dedicated directory?

@mtalexan
Copy link
Author

mtalexan commented May 3, 2024

Link to the mention of the second missing permission: https://discussion.fedoraproject.org/t/setup-hibernation-on-silverblue-kionite/78834/20

@zpytela
Copy link
Contributor

zpytela commented Aug 7, 2024

@mtalexan The policy does not define any path with swapfile_t as the default type and all rules just take into account files with this type, so it looks like a design. Both sleep and logind can search a few dozens of directory types, so if no one fits the system's policy, I'd leave it to admins who can create a local SELinux policy module unless any recommendation or best practice documentation exists.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants