Bug 1813096 - SELinux is preventing nm-ssh-service from 'read' accesses on the sock_file ssh.
Summary: SELinux is preventing nm-ssh-service from 'read' accesses on the sock_file ssh.
Keywords:
Status: CLOSED DUPLICATE of bug 1761071
Alias: None
Product: Fedora
Classification: Fedora
Component: selinux-policy
Version: 31
Hardware: x86_64
OS: Unspecified
medium
medium
Target Milestone: ---
Assignee: Patrik Koncity
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard: abrt_hash:3189dd06a8d87a748a799cd5852...
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2020-03-12 23:18 UTC by Jeff MacDonald
Modified: 2020-06-26 15:42 UTC (History)
6 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2020-06-26 15:42:41 UTC
Type: ---


Attachments (Terms of Use)

Description Jeff MacDonald 2020-03-12 23:18:47 UTC
Description of problem:
SELinux is preventing nm-ssh-service from 'read' accesses on the sock_file ssh.

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

If you believe that nm-ssh-service should be allowed read access on the ssh sock_file 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 'nm-ssh-service' --raw | audit2allow -M my-nmsshservice
# semodule -X 300 -i my-nmsshservice.pp

Additional Information:
Source Context                system_u:system_r:NetworkManager_ssh_t:s0
Target Context                unconfined_u:object_r:user_tmp_t:s0
Target Objects                ssh [ sock_file ]
Source                        nm-ssh-service
Source Path                   nm-ssh-service
Port                          <Unknown>
Host                          (removed)
Source RPM Packages           
Target RPM Packages           
Policy RPM                    selinux-policy-3.14.4-49.fc31.noarch
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Enforcing
Host Name                     (removed)
Platform                      Linux (removed) 5.5.7-200.fc31.x86_64 #1 SMP Fri
                              Feb 28 17:18:37 UTC 2020 x86_64 x86_64
Alert Count                   3
First Seen                    2020-03-12 19:16:25 EDT
Last Seen                     2020-03-12 19:16:25 EDT
Local ID                      0bff8d04-9157-4419-800a-4da36fb6a9f9

Raw Audit Messages
type=AVC msg=audit(1584054985.161:1882): avc:  denied  { read } for  pid=237199 comm="nm-ssh-service" name="ssh" dev="tmpfs" ino=40969 scontext=system_u:system_r:NetworkManager_ssh_t:s0 tcontext=unconfined_u:object_r:user_tmp_t:s0 tclass=sock_file permissive=0


Hash: nm-ssh-service,NetworkManager_ssh_t,user_tmp_t,sock_file,read

Version-Release number of selected component:
selinux-policy-3.14.4-49.fc31.noarch

Additional info:
component:      selinux-policy
reporter:       libreport-2.12.0
hashmarkername: setroubleshoot
kernel:         5.5.7-200.fc31.x86_64
type:           libreport

Comment 1 Patrik Koncity 2020-05-10 17:38:11 UTC
Hi Jeff,

We still work on this pull request and it's not completely finished, but we made some progress on this issue, so you can try, what we investigated.

Please create file mynetworkmanager.te 

where you copy this:

$cat mynetworkmanager.te

policy_module(mynetworkmanager, 1.0)

require {
	type NetworkManager_ssh_t;
 
	
}

#=============NetworkManager_ssh_t==============

userdom_rw_user_tmp_sock_files(NetworkManager_ssh_t)



you have to install selinux-policy-devel if don't have it installed on your system
then you compile this file, please use in dir where you have mynetworkmanager.te
$make -f /usr/share/selinux/devel/Makefile mynetworkmanager.pp

and finally load module to kernel, please use
#semodule -i mynetworkmanager.pp


it should work now for you. Or you have still AVC's related with NetworkManager_ssh_t?

Thanks,
Patrik

Comment 2 Jeff MacDonald 2020-05-10 19:51:07 UTC
SELinux is preventing sh from read access on the file /usr/sbin/ifconfig.

Plugin: catchall 
 SELinux denied access requested by sh. It is not expected that this access is
required by sh and this access may signal an intrusion attempt. It is also
possible that the specific version or configuration of the application is
causing it to require additional access.

If you believe that sh should be allowed read access on the ifconfig file by default.
You should report this as a bug.
You can generate a local policy module to allow this access.
Allow this access for now by executing:
# ausearch -c 'sh' --raw | audit2allow -M my-sh
# semodule -X 300 -i my-sh.pp

when I apply the above, I still get a connection failed, but no additional AVCs.

Comment 3 Jeff MacDonald 2020-05-10 19:54:31 UTC
SELinux is preventing sh from 'read, open' accesses on the file /usr/sbin/ifconfig.

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

If you believe that sh should be allowed read open access on the ifconfig file 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 'sh' --raw | audit2allow -M my-sh
# semodule -X 300 -i my-sh.pp

Additional Information:
Source Context                system_u:system_r:NetworkManager_ssh_t:s0
Target Context                system_u:object_r:ifconfig_exec_t:s0
Target Objects                /usr/sbin/ifconfig [ file ]
Source                        sh
Source Path                   sh
Port                          <Unknown>
Host                          cyclops.zoidtechnologies.com
Source RPM Packages           
Target RPM Packages           net-tools-2.0-0.55.20160912git.fc31.x86_64
SELinux Policy RPM            selinux-policy-targeted-3.14.4-50.fc31.noarch
Local Policy RPM              
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Enforcing
Host Name                     cyclops.zoidtechnologies.com
Platform                      Linux cyclops.zoidtechnologies.com
                              5.6.7-200.fc31.x86_64 #1 SMP Thu Apr 23 14:22:57
                              UTC 2020 x86_64 x86_64
Alert Count                   3
First Seen                    2020-04-20 22:40:41 EDT
Last Seen                     2020-05-10 15:40:27 EDT
Local ID                      0cd7dc16-1c2e-45d3-9175-d20054bf3f9d

Raw Audit Messages
type=AVC msg=audit(1589139627.93:5071): avc:  denied  { read open } for  pid=1736187 comm="sh" path="/usr/sbin/ifconfig" dev="dm-0" ino=3417430 scontext=system_u:system_r:NetworkManager_ssh_t:s0 tcontext=system_u:object_r:ifconfig_exec_t:s0 tclass=file permissive=0


Hash: sh,NetworkManager_ssh_t,ifconfig_exec_t,file,read,open



SELinux is preventing sh from read access on the file /usr/sbin/ifconfig.

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

If you believe that sh should be allowed read access on the ifconfig file 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 'sh' --raw | audit2allow -M my-sh
# semodule -X 300 -i my-sh.pp

Additional Information:
Source Context                system_u:system_r:NetworkManager_ssh_t:s0
Target Context                system_u:object_r:ifconfig_exec_t:s0
Target Objects                /usr/sbin/ifconfig [ file ]
Source                        sh
Source Path                   sh
Port                          <Unknown>
Host                          (removed)
Source RPM Packages           
Target RPM Packages           net-tools-2.0-0.55.20160912git.fc31.x86_64
SELinux Policy RPM            selinux-policy-targeted-3.14.4-50.fc31.noarch
Local Policy RPM              
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Enforcing
Host Name                     (removed)
Platform                      Linux cyclops.zoidtechnologies.com
                              5.6.7-200.fc31.x86_64 #1 SMP Thu Apr 23 14:22:57
                              UTC 2020 x86_64 x86_64
Alert Count                   3
First Seen                    2020-05-10 15:40:27 EDT
Last Seen                     2020-05-10 15:40:27 EDT
Local ID                      1eccc576-16c4-45db-9ef0-957b98a10fda

Raw Audit Messages
type=AVC msg=audit(1589139627.93:5074): avc:  denied  { read } for  pid=1736187 comm="sh" name="ifconfig" dev="dm-0" ino=3417430 scontext=system_u:system_r:NetworkManager_ssh_t:s0 tcontext=system_u:object_r:ifconfig_exec_t:s0 tclass=file permissive=0


Hash: sh,NetworkManager_ssh_t,ifconfig_exec_t,file,read

Comment 4 Patrik Koncity 2020-06-26 15:42:41 UTC
Hi Jeff, try to update selinux policy via:

#dnf update selinux-policy

Problem it can be solved in new version of policy.

Regards,
Patrik

*** This bug has been marked as a duplicate of bug 1761071 ***


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