SELinux prevents SSH access on Alma/Fedora #1500

Closed
opened 2025-11-20 05:31:46 -05:00 by saavagebueno · 2 comments
Owner

Originally created by @orchard0 on GitHub (Dec 17, 2024).

Describe the problem

It appears that SELinux is preventing login from accessing bash when trying to SSH to a peer.

To Reproduce

Using Fedora 41 Server or AlmaLinux 9.5 (I've tested on both)

Steps to reproduce the behavior sudo netbird ssh server@vm
Error: Last login: Tue Dec 17 09:42:44 from 192.168.122.1 server: no shell: Permission denied

Expected behavior

Access to bash should happen so a SSH session can begin. It appears the login happens but the process login can't access bash therefore the error server: no shell: Permission denied occurs.

SELinux report on Alma:

[server@localhost ~]$ grep "SELinux is preventing" /var/log/messages
grep: /var/log/messages: Permission denied
[server@localhost ~]$ sudo grep "SELinux is preventing" /var/log/messages
Dec 17 09:46:13 localhost setroubleshoot[5246]: SELinux is preventing /usr/bin/login from using the transition access on a process. For complete SELinux messages run: sealert -l 355784f4-40ea-4956-a1b1-187c19588812
Dec 17 09:46:13 localhost setroubleshoot[5246]: SELinux is preventing /usr/bin/login from using the transition access on a process.#012#012*****  Plugin catchall (100. confidence) suggests   **************************#012#012If you believe that login should be allowed transition access on processes labeled unconfined_t by default.#012Then you should report this as a bug.#012You can generate a local policy module to allow this access.#012Do#012allow this access for now by executing:#012# ausearch -c 'login' --raw | audit2allow -M my-login#012# semodule -X 300 -i my-login.pp#012
[server@localhost ~]$ sealert -l 355784f4-40ea-4956-a1b1-187c19588812
SELinux is preventing /usr/bin/login from using the transition access on a process.

*****  Plugin catchall (100. confidence) suggests   **************************

If you believe that login should be allowed transition access on processes labeled unconfined_t by default.
Then you should report this as a bug.
You can generate a local policy module to allow this access.
Do
allow this access for now by executing:
# ausearch -c 'login' --raw | audit2allow -M my-login
# semodule -X 300 -i my-login.pp


Additional Information:
Source Context                system_u:system_r:unconfined_service_t:s0
Target Context                unconfined_u:unconfined_r:unconfined_t:s0
Target Objects                /usr/bin/bash [ process ]
Source                        login
Source Path                   /usr/bin/login
Port                          <Unknown>
Host                          localhost.localdomain
Source RPM Packages           util-linux-2.37.4-20.el9.x86_64
Target RPM Packages           bash-5.1.8-9.el9.x86_64
SELinux Policy RPM            selinux-policy-targeted-38.1.45-3.el9_5.noarch
Local Policy RPM              selinux-policy-targeted-38.1.45-3.el9_5.noarch
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Enforcing
Host Name                     localhost.localdomain
Platform                      Linux localhost.localdomain
                              5.14.0-503.16.1.el9_5.x86_64 #1 SMP
                              PREEMPT_DYNAMIC Fri Dec 13 01:47:05 EST 2024
                              x86_64 x86_64
Alert Count                   1
First Seen                    2024-12-17 09:46:11 GMT
Last Seen                     2024-12-17 09:46:11 GMT
Local ID                      355784f4-40ea-4956-a1b1-187c19588812

Raw Audit Messages
type=AVC msg=audit(1734428771.611:299): avc:  denied  { transition } for  pid=5245 comm="login" path="/usr/bin/bash" dev="dm-0" ino=50641331 scontext=system_u:system_r:unconfined_service_t:s0 tcontext=unconfined_u:unconfined_r:unconfined_t:s0 tclass=process permissive=0


type=SYSCALL msg=audit(1734428771.611:299): arch=x86_64 syscall=execve success=no exit=EACCES a0=560cfdfd5697 a1=7ffe3afdeba8 a2=560cfdfd15b0 a3=7ffe3afde570 items=0 ppid=5243 pid=5245 auid=1000 uid=1000 gid=1000 euid=1000 suid=1000 fsuid=1000 egid=1000 sgid=1000 fsgid=1000 tty=pts1 ses=4 comm=login exe=/usr/bin/login subj=system_u:system_r:unconfined_service_t:s0 key=(null)

Hash: login,unconfined_service_t,unconfined_t,process,transition

The report on Fedora Server is similar.

Are you using NetBird Cloud?

Self-host NetBird's control plane.

NetBird version

0.34.1

The question is whether netbird should be adding a SELinux policy to prevent this from happening or if this is an SELinux issue?

This issue doesn't occur on Ubuntu with AppArmor. If I turn off SELinux using setenforce 0 the error disappears but SELinux needs to stay on.

Additional information:

NAME="AlmaLinux"
VERSION="9.5 (Teal Serval)"
ID="almalinux"
ID_LIKE="rhel centos fedora"
VERSION_ID="9.5"
PLATFORM_ID="platform:el9"
PRETTY_NAME="AlmaLinux 9.5 (Teal Serval)"
ANSI_COLOR="0;34"
LOGO="fedora-logo-icon"
CPE_NAME="cpe:/o:almalinux:almalinux:9::baseos"
HOME_URL="https://almalinux.org/"
DOCUMENTATION_URL="https://wiki.almalinux.org/"
BUG_REPORT_URL="https://bugs.almalinux.org/"

ALMALINUX_MANTISBT_PROJECT="AlmaLinux-9"
ALMALINUX_MANTISBT_PROJECT_VERSION="9.5"
REDHAT_SUPPORT_PRODUCT="AlmaLinux"
REDHAT_SUPPORT_PRODUCT_VERSION="9.5"
SUPPORT_END=2032-06-01
NAME="Fedora Linux"
VERSION="41 (Server Edition)"
RELEASE_TYPE=stable
ID=fedora
VERSION_ID=41
VERSION_CODENAME=""
PLATFORM_ID="platform:f41"
PRETTY_NAME="Fedora Linux 41 (Server Edition)"
ANSI_COLOR="0;38;2;60;110;180"
LOGO=fedora-logo-icon
CPE_NAME="cpe:/o:fedoraproject:fedora:41"
HOME_URL="https://fedoraproject.org/"
DOCUMENTATION_URL="https://docs.fedoraproject.org/en-US/fedora/f41/system-administrators-guide/"
SUPPORT_URL="https://ask.fedoraproject.org/"
BUG_REPORT_URL="https://bugzilla.redhat.com/"
REDHAT_BUGZILLA_PRODUCT="Fedora"
REDHAT_BUGZILLA_PRODUCT_VERSION=41
REDHAT_SUPPORT_PRODUCT="Fedora"
REDHAT_SUPPORT_PRODUCT_VERSION=41
SUPPORT_END=2025-12-15
VARIANT="Server Edition"
VARIANT_ID=server

Originally created by @orchard0 on GitHub (Dec 17, 2024). **Describe the problem** It appears that SELinux is preventing `login` from accessing `bash` when trying to SSH to a peer. **To Reproduce** Using Fedora 41 Server or AlmaLinux 9.5 (I've tested on both) Steps to reproduce the behavior `sudo netbird ssh server@vm` Error: `Last login: Tue Dec 17 09:42:44 from 192.168.122.1 server: no shell: Permission denied` **Expected behavior** Access to bash should happen so a SSH session can begin. It appears the login happens but the process `login` can't access `bash` therefore the error `server: no shell: Permission denied` occurs. SELinux report on Alma: ``` [server@localhost ~]$ grep "SELinux is preventing" /var/log/messages grep: /var/log/messages: Permission denied [server@localhost ~]$ sudo grep "SELinux is preventing" /var/log/messages Dec 17 09:46:13 localhost setroubleshoot[5246]: SELinux is preventing /usr/bin/login from using the transition access on a process. For complete SELinux messages run: sealert -l 355784f4-40ea-4956-a1b1-187c19588812 Dec 17 09:46:13 localhost setroubleshoot[5246]: SELinux is preventing /usr/bin/login from using the transition access on a process.#012#012***** Plugin catchall (100. confidence) suggests **************************#012#012If you believe that login should be allowed transition access on processes labeled unconfined_t by default.#012Then you should report this as a bug.#012You can generate a local policy module to allow this access.#012Do#012allow this access for now by executing:#012# ausearch -c 'login' --raw | audit2allow -M my-login#012# semodule -X 300 -i my-login.pp#012 [server@localhost ~]$ sealert -l 355784f4-40ea-4956-a1b1-187c19588812 SELinux is preventing /usr/bin/login from using the transition access on a process. ***** Plugin catchall (100. confidence) suggests ************************** If you believe that login should be allowed transition access on processes labeled unconfined_t by default. Then you should report this as a bug. You can generate a local policy module to allow this access. Do allow this access for now by executing: # ausearch -c 'login' --raw | audit2allow -M my-login # semodule -X 300 -i my-login.pp Additional Information: Source Context system_u:system_r:unconfined_service_t:s0 Target Context unconfined_u:unconfined_r:unconfined_t:s0 Target Objects /usr/bin/bash [ process ] Source login Source Path /usr/bin/login Port <Unknown> Host localhost.localdomain Source RPM Packages util-linux-2.37.4-20.el9.x86_64 Target RPM Packages bash-5.1.8-9.el9.x86_64 SELinux Policy RPM selinux-policy-targeted-38.1.45-3.el9_5.noarch Local Policy RPM selinux-policy-targeted-38.1.45-3.el9_5.noarch Selinux Enabled True Policy Type targeted Enforcing Mode Enforcing Host Name localhost.localdomain Platform Linux localhost.localdomain 5.14.0-503.16.1.el9_5.x86_64 #1 SMP PREEMPT_DYNAMIC Fri Dec 13 01:47:05 EST 2024 x86_64 x86_64 Alert Count 1 First Seen 2024-12-17 09:46:11 GMT Last Seen 2024-12-17 09:46:11 GMT Local ID 355784f4-40ea-4956-a1b1-187c19588812 Raw Audit Messages type=AVC msg=audit(1734428771.611:299): avc: denied { transition } for pid=5245 comm="login" path="/usr/bin/bash" dev="dm-0" ino=50641331 scontext=system_u:system_r:unconfined_service_t:s0 tcontext=unconfined_u:unconfined_r:unconfined_t:s0 tclass=process permissive=0 type=SYSCALL msg=audit(1734428771.611:299): arch=x86_64 syscall=execve success=no exit=EACCES a0=560cfdfd5697 a1=7ffe3afdeba8 a2=560cfdfd15b0 a3=7ffe3afde570 items=0 ppid=5243 pid=5245 auid=1000 uid=1000 gid=1000 euid=1000 suid=1000 fsuid=1000 egid=1000 sgid=1000 fsgid=1000 tty=pts1 ses=4 comm=login exe=/usr/bin/login subj=system_u:system_r:unconfined_service_t:s0 key=(null) Hash: login,unconfined_service_t,unconfined_t,process,transition ``` The report on Fedora Server is similar. **Are you using NetBird Cloud?** Self-host NetBird's control plane. **NetBird version** `0.34.1` The question is whether netbird should be adding a SELinux policy to prevent this from happening or if this is an SELinux issue? This issue doesn't occur on Ubuntu with AppArmor. If I turn off SELinux using `setenforce 0` the error disappears but SELinux needs to stay on. Additional information: ``` NAME="AlmaLinux" VERSION="9.5 (Teal Serval)" ID="almalinux" ID_LIKE="rhel centos fedora" VERSION_ID="9.5" PLATFORM_ID="platform:el9" PRETTY_NAME="AlmaLinux 9.5 (Teal Serval)" ANSI_COLOR="0;34" LOGO="fedora-logo-icon" CPE_NAME="cpe:/o:almalinux:almalinux:9::baseos" HOME_URL="https://almalinux.org/" DOCUMENTATION_URL="https://wiki.almalinux.org/" BUG_REPORT_URL="https://bugs.almalinux.org/" ALMALINUX_MANTISBT_PROJECT="AlmaLinux-9" ALMALINUX_MANTISBT_PROJECT_VERSION="9.5" REDHAT_SUPPORT_PRODUCT="AlmaLinux" REDHAT_SUPPORT_PRODUCT_VERSION="9.5" SUPPORT_END=2032-06-01 ``` ``` NAME="Fedora Linux" VERSION="41 (Server Edition)" RELEASE_TYPE=stable ID=fedora VERSION_ID=41 VERSION_CODENAME="" PLATFORM_ID="platform:f41" PRETTY_NAME="Fedora Linux 41 (Server Edition)" ANSI_COLOR="0;38;2;60;110;180" LOGO=fedora-logo-icon CPE_NAME="cpe:/o:fedoraproject:fedora:41" HOME_URL="https://fedoraproject.org/" DOCUMENTATION_URL="https://docs.fedoraproject.org/en-US/fedora/f41/system-administrators-guide/" SUPPORT_URL="https://ask.fedoraproject.org/" BUG_REPORT_URL="https://bugzilla.redhat.com/" REDHAT_BUGZILLA_PRODUCT="Fedora" REDHAT_BUGZILLA_PRODUCT_VERSION=41 REDHAT_SUPPORT_PRODUCT="Fedora" REDHAT_SUPPORT_PRODUCT_VERSION=41 SUPPORT_END=2025-12-15 VARIANT="Server Edition" VARIANT_ID=server ```
saavagebueno added the waiting-feedbacktriage-needed labels 2025-11-20 05:31:46 -05:00
Author
Owner

@nazarewk commented on GitHub (Apr 28, 2025):

Hello @orchard0,

We're currently reviewing our open issues and would like to verify if this problem still exists in the latest NetBird version.

Could you please confirm if the issue is still there?

We may close this issue temporarily if we don't hear back from you within 2 weeks, but feel free to reopen it with updated information.

Thanks for your contribution to improving the project!

@nazarewk commented on GitHub (Apr 28, 2025): Hello @orchard0, We're currently reviewing our open issues and would like to verify if this problem still exists in the [latest NetBird version](https://github.com/netbirdio/netbird/releases). Could you please confirm if the issue is still there? We may close this issue temporarily if we don't hear back from you within **2 weeks**, but feel free to reopen it with updated information. Thanks for your contribution to improving the project!
Author
Owner

@mlsmaycon commented on GitHub (Jun 1, 2025):

closing issue due to no recent feedback. Feel free to open a new one if the issue persist or reopen if this was a feature request.

@mlsmaycon commented on GitHub (Jun 1, 2025): closing issue due to no recent feedback. Feel free to open a new one if the issue persist or reopen if this was a feature request.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: SVI/netbird#1500