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

Confined user show policy issue: mounting external devices in GUI does not work in KDE / (toolbox doesn't work either) #2019

Open
py0xc3 opened this issue Feb 1, 2024 · 3 comments

Comments

@py0xc3
Copy link

py0xc3 commented Feb 1, 2024

A few days after solving #1917 , I had to go back to sysadm_u for two reasons:

1)

Users with staff_u (I assume the same for user_u) are no longer able to make use of externally mounted devices (CD/DVDs, USB storages, and so on): KDE has a button for mounting and unmounting devices that are mounted by the user for temporary use (as any GUI environment). The mounting takes place in /run/media/<username> when the user does such a mount. This is intended by Fedora & KDE.

When I click this button, everything seems to work at first glance: the directory /run/media/<username>/<device ID> is created and the device is mounted. However, the staff_u user cannot open/access anything because the directories /run/media/<username>/ & subordinated paths have the default label and are thus not accessible by staff_u .

Major problem: the directories are created temporary (within a tmpfs). At each boot, /run/media/<username>/ is created when the first device is mounted. The subdirectories inherit the issue.

However, I assume the solution is the same as for #1917 : when /run/media/<username>/ is created at the time of the first user-mount, it needs to be created with user_home_dir_t (not user_home_t) so that its subdirectories get the appropriate label. This needs to occur automatically when the directory is created in /run/media/ - so at each boot.

I will add a ls -laZ /run/media/<username> & ls -laZ /run/media/<username>/<device> output once I have a USB device available.I have currently no possibility to make a more sophisticated report with outputs from a staff_u account. I create the ticket to have it documented. However, I guess the issue is quite clear and easy to reproduce.

2)

toolbox does not work in staff_u as well: it breaks at the time of toolbox enter. It always works at sysadm_u. It always breaks at staff_u. Again, this is only to have it documented (I wanted to write a more sophisticated report weeks ago). If someone has time and the possibility, feel free to check it out and open a new ticket about it. Otherwise I will do it at some time.

Sorry for the "quick and dirty" report.

@py0xc3
Copy link
Author

py0xc3 commented Feb 9, 2024

Sorry for the late reply, I thought I have an eligible external USB device at home... I was wrong :)

Here is the information I promised above:

# Default state after booting & logging in (before KDE GUI is used to mount the external USB device)

user@fedora:~$ ls -laZ /run/media/
total 0
drwxr-xr-x.  2 root root system_u:object_r:mnt_t:s0       40 Feb  9 13:15 .
drwxr-xr-x. 50 root root system_u:object_r:var_run_t:s0 1340 Feb  9 13:18 ..

# After the KDE GUI was used to mount the external USB device in a staff_u user

user@fedora:~$ ls -laZ /run/media/
total 0
drwxr-xr-x.  3 root root system_u:object_r:mnt_t:s0       60 Feb  9 13:18 .
drwxr-xr-x. 50 root root system_u:object_r:var_run_t:s0 1340 Feb  9 13:18 ..
drwxr-x---+  3 root root system_u:object_r:mnt_t:s0       60 Feb  9 13:18 user
user@fedora:~$ ls -laZ /run/media/user/
total 4
drwxr-x---+ 3 root root system_u:object_r:mnt_t:s0         60 Feb  9 13:18 .
drwxr-xr-x. 3 root root system_u:object_r:mnt_t:s0         60 Feb  9 13:18 ..
drwxr-xr-x. 4 root root system_u:object_r:unlabeled_t:s0 4096 Dec 16 23:07 <device UUID>
user@fedora:~$ ls -laZ /run/media/user/<device UUID>/
ls: cannot open directory '/run/media/user/<device UUID>/': Permission denied

# Root output (at the time as the user gets the above "permission denied" with the same command)

root@fedora ~]# ls -laZ /run/media/user/<device UUID>/
total 24
drwxr-xr-x. 4 root   root system_u:object_r:unlabeled_t:s0      4096 Dec 16 23:07 .
drwxr-x---+ 3 root   root system_u:object_r:mnt_t:s0              60 Feb  9 13:18 ..
drwxr-xr-x. 4 user   root unconfined_u:object_r:unlabeled_t:s0  4096 Jan 28 18:09 someFolder
drwx------. 2 root   root system_u:object_r:unlabeled_t:s0     16384 Dec 14 23:04 lost+found

@zpytela
Copy link
Contributor

zpytela commented Feb 26, 2024

@py0xc3 What is the mount device filesystem, how it was created, what is its content? It looks a filesystem with extended attributes, but no SELinux context.
Is some mount-related user setting in place for the device?

@py0xc3
Copy link
Author

py0xc3 commented Feb 28, 2024 via email

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