Bug 1964766 - selinux is blocking gpsd without giving warning message
Summary: selinux is blocking gpsd without giving warning message
Keywords:
Status: CLOSED EOL
Alias: None
Product: Fedora
Classification: Fedora
Component: selinux-policy
Version: 34
Hardware: x86_64
OS: Linux
unspecified
medium
Target Milestone: ---
Assignee: Zdenek Pytela
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2021-05-26 03:44 UTC by laolux
Modified: 2023-08-06 14:28 UTC (History)
7 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2022-06-08 06:20:54 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description laolux 2021-05-26 03:44:41 UTC
Description of problem:
SELinux is blocking gpsd from doing anything and does not even give an error message. sealert and `ausearch -m AVC,USER_AVC -ts recent` do not return anything, but setenforce=0 solves the problem. That's why I think this is selinux silently failing.

Version-Release number of selected component (if applicable):


How reproducible:
Reproducible every time. Follow the steps below.

Steps to Reproduce:
1. Install gpsd (`dnf install gpsd`)
2. As any user, run `gpsd --version`

Actual results:
Nothing but a newline character is returned. Exit code as 0, indicating that no error has happened.


Expected results:
`gpsd: 3.22 (revision 3.22)` should get returned.

Additional info:
Problem is "fixed" by copying the gpsd executable to /usr/bin and then executing `/usr/bin/gpsd --version`.
Another "fix" is to `setenforce=0`. This strongly indicates that it is a selinux problem, not a gpsd problem.
However, neither sealert nor `ausearch -m AVC,USER_AVC -ts recent` return anything. They pretend that no error or attempted policy violation has happened. That's why it hasn't occurred to me right away that the issue might be selinux related. Instead I went looking for issues with gpsd, installing old version, building from source and wasting lots of time.

Comment 1 laolux 2021-05-26 11:18:32 UTC
Ok, some more info. When I copy gpsd to a different directory, then its selinux context gets changed. That's why it works. However, if I clone the original context with chcon, then it fails, regardless of the directory that gpsd is in.
The context is 'system_u:object_r:gpsd_exec_t:s0', so I suppose that 'gpsd_exec_t' has some issues.

Comment 2 Milos Malik 2021-05-27 10:02:09 UTC
Can you enable the daemons_use_tty boolean and re-run the gpsd program?

# setsebool daemons_use_tty on

Comment 3 laolux 2021-05-27 12:46:43 UTC
That should work. However, I have fixed it.
Trick was to

# semodule -DB

then sealert would report two errors and create a policy to fix that.

Policy as follows:

module my-gpsd 1.0;

require {
        type user_devpts_t;
        type gpsd_t;
        class chr_file { append read write };
}

#============= gpsd_t ==============

#!!!! This avc can be allowed using the boolean 'daemons_use_tty'
allow gpsd_t user_devpts_t:chr_file { append read write };

I really wish selinux would be more verbose when it is blocking something. I can fully understand that people recommend setenforce 0, just in case selinux blocks something and does not report it.

Comment 4 Ben Cotton 2022-05-12 16:49:56 UTC
This message is a reminder that Fedora Linux 34 is nearing its end of life.
Fedora will stop maintaining and issuing updates for Fedora Linux 34 on 2022-06-07.
It is Fedora's policy to close all bug reports from releases that are no longer
maintained. At that time this bug will be closed as EOL if it remains open with a
'version' of '34'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, change the 'version' 
to a later Fedora Linux version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora Linux 34 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora Linux, you are encouraged to change the 'version' to a later version
prior to this bug being closed.

Comment 5 Ben Cotton 2022-06-08 06:20:54 UTC
Fedora Linux 34 entered end-of-life (EOL) status on 2022-06-07.

Fedora Linux 34 is no longer maintained, which means that it
will not receive any further security or bug fix updates. As a result we
are closing this bug.

If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release.

Thank you for reporting this bug and we are sorry it could not be fixed.


Note You need to log in before you can comment on or make changes to this bug.