Bug 1307183 - gridengine MPI jobs fail with SELinux denials
Summary: gridengine MPI jobs fail with SELinux denials
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: selinux-policy
Version: 7.2
Hardware: All
OS: Linux
medium
medium
Target Milestone: rc
: ---
Assignee: Lukas Vrabec
QA Contact: Milos Malik
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-02-12 23:25 UTC by Orion Poplawski
Modified: 2018-10-30 10:00 UTC (History)
9 users (show)

Fixed In Version: selinux-policy-3.13.1-203.el7
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2018-10-30 09:59:15 UTC
Target Upstream Version:


Attachments (Terms of Use)


Links
System ID Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2018:3111 None None None 2018-10-30 10:00:02 UTC

Description Orion Poplawski 2016-02-12 23:25:49 UTC
Description of problem:

Cross-host mpi jobs run through gridengine/sge fail due to many SELinux denials.

Version-Release number of selected component (if applicable):
selinux-policy-3.13.1-60.el7.noarch

Initial host machine:
type=AVC msg=audit(1455319362.723:154): avc:  denied  { open } for  pid=5957 comm="ssh" path="/home/orion/.ssh/config" dev="0:46" ino=10490044 scontext=system_u:system_r:sge_job_ssh_t:s0 tcontext=system_u:object_r:nfs_t:s0 tclass=file
type=AVC msg=audit(1455319362.726:155): avc:  denied  { name_connect } for  pid=5957 comm="ssh" dest=39374 scontext=system_u:system_r:sge_job_ssh_t:s0 tcontext=system_u:object_r:ephemeral_port_t:s0 tclass=tcp_socket
type=AVC msg=audit(1455319362.825:156): avc:  denied  { open } for  pid=5958 comm="ssh-keysign" path="/etc/ssh/ssh_host_dsa_key" dev="sda3" ino=53102399 scontext=system_u:system_r:ssh_keysign_t:s0 tcontext=system_u:object_r:sshd_key_t:s0 tclass=file
type=AVC msg=audit(1455319362.826:157): avc:  denied  { read } for  pid=5958 comm="ssh-keysign" name="passwd" dev="sda3" ino=36264502 scontext=system_u:system_r:ssh_keysign_t:s0 tcontext=system_u:object_r:passwd_file_t:s0 tclass=file
type=AVC msg=audit(1455319362.826:157): avc:  denied  { open } for  pid=5958 comm="ssh-keysign" path="/etc/passwd" dev="sda3" ino=36264502 scontext=system_u:system_r:ssh_keysign_t:s0 tcontext=system_u:object_r:passwd_file_t:s0 tclass=file
type=AVC msg=audit(1455319362.826:158): avc:  denied  { getattr } for  pid=5958 comm="ssh-keysign" path="/etc/passwd" dev="sda3" ino=36264502 scontext=system_u:system_r:ssh_keysign_t:s0 tcontext=system_u:object_r:passwd_file_t:s0 tclass=file
type=AVC msg=audit(1455319362.826:159): avc:  denied  { read } for  pid=5958 comm="ssh-keysign" name="passwd" dev="sda3" ino=18101704 scontext=system_u:system_r:ssh_keysign_t:s0 tcontext=system_u:object_r:sssd_public_t:s0 tclass=file
type=AVC msg=audit(1455319362.826:159): avc:  denied  { open } for  pid=5958 comm="ssh-keysign" path="/var/lib/sss/mc/passwd" dev="sda3" ino=18101704 scontext=system_u:system_r:ssh_keysign_t:s0 tcontext=system_u:object_r:sssd_public_t:s0 tclass=file
type=AVC msg=audit(1455319362.826:160): avc:  denied  { getattr } for  pid=5958 comm="ssh-keysign" path="/var/lib/sss/mc/passwd" dev="sda3" ino=18101704 scontext=system_u:system_r:ssh_keysign_t:s0 tcontext=system_u:object_r:sssd_public_t:s0 tclass=file
type=AVC msg=audit(1455319362.828:161): avc:  denied  { getattr } for  pid=5958 comm="ssh-keysign" laddr=10.10.10.201 lport=38145 faddr=10.10.10.202 fport=39374 scontext=system_u:system_r:ssh_keysign_t:s0 tcontext=system_u:system_r:sge_job_ssh_t:s0 tclass=tcp_socket
type=AVC msg=audit(1455319362.828:162): avc:  denied  { read } for  pid=5958 comm="ssh-keysign" name="resolv.conf" dev="sda3" ino=33595525 scontext=system_u:system_r:ssh_keysign_t:s0 tcontext=system_u:object_r:net_conf_t:s0 tclass=file
type=AVC msg=audit(1455319362.828:162): avc:  denied  { open } for  pid=5958 comm="ssh-keysign" path="/etc/resolv.conf" dev="sda3" ino=33595525 scontext=system_u:system_r:ssh_keysign_t:s0 tcontext=system_u:object_r:net_conf_t:s0 tclass=file
type=AVC msg=audit(1455319362.829:163): avc:  denied  { getattr } for  pid=5958 comm="ssh-keysign" path="/etc/resolv.conf" dev="sda3" ino=33595525 scontext=system_u:system_r:ssh_keysign_t:s0 tcontext=system_u:object_r:net_conf_t:s0 tclass=file
type=AVC msg=audit(1455319362.829:164): avc:  denied  { create } for  pid=5958 comm="ssh-keysign" scontext=system_u:system_r:ssh_keysign_t:s0 tcontext=system_u:system_r:ssh_keysign_t:s0 tclass=udp_socket
type=AVC msg=audit(1455319362.829:165): avc:  denied  { connect } for  pid=5958 comm="ssh-keysign" scontext=system_u:system_r:ssh_keysign_t:s0 tcontext=system_u:system_r:ssh_keysign_t:s0 tclass=udp_socket
type=AVC msg=audit(1455319362.829:166): avc:  denied  { getattr } for  pid=5958 comm="ssh-keysign" path="socket:[38466]" dev="sockfs" ino=38466 scontext=system_u:system_r:ssh_keysign_t:s0 tcontext=system_u:system_r:ssh_keysign_t:s0 tclass=udp_socket

Remote host:
type=AVC msg=audit(1455319362.740:166): avc:  denied  { getattr } for  pid=5526 comm="sshd" laddr=10.10.10.202 lport=39374 faddr=10.10.10.201 fport=38145 scontext=system_u:system_r:sshd_t:s0 tcontext=system_u:system_r:sge_shepherd_t:s0 tclass=tcp_socket
type=AVC msg=audit(1455319362.740:167): avc:  denied  { setopt } for  pid=5526 comm="sshd" laddr=10.10.10.202 lport=39374 faddr=10.10.10.201 fport=38145 scontext=system_u:system_r:sshd_t:s0 tcontext=system_u:system_r:sge_shepherd_t:s0 tclass=tcp_socket
type=AVC msg=audit(1455319362.741:168): avc:  denied  { getopt } for  pid=5526 comm="sshd" laddr=10.10.10.202 lport=39374 faddr=10.10.10.201 fport=38145 scontext=system_u:system_r:sshd_t:s0 tcontext=system_u:system_r:sge_shepherd_t:s0 tclass=tcp_socket
type=AVC msg=audit(1455319363.108:179): avc:  denied  { getattr } for  pid=5526 comm="sshd" laddr=10.10.10.202 lport=39374 faddr=10.10.10.201 fport=38145 scontext=system_u:system_r:sshd_t:s0 tcontext=system_u:system_r:sge_shepherd_t:s0 tclass=tcp_socket
type=AVC msg=audit(1455319363.251:186): avc:  denied  { getattr } for  pid=5526 comm="sshd" laddr=10.10.10.202 lport=39374 faddr=10.10.10.201 fport=38145 scontext=system_u:system_r:sshd_t:s0 tcontext=system_u:system_r:sge_shepherd_t:s0 tclass=tcp_socket

# getsebool -a | grep sge
sge_domain_can_network_connect --> on
sge_use_nfs --> off

Comment 1 Orion Poplawski 2016-02-12 23:27:59 UTC
Sorry, the nfs_t denial is fixed with:

setsebool sge_use_nfs=on

Comment 3 Lukas Vrabec 2016-06-29 16:11:32 UTC
Hi, 
Could you use following command:
# semanage boolean -m ssh_keysign --on

And then try to reproduce your issue? 

Thank you.

Comment 4 Orion Poplawski 2016-06-29 22:52:55 UTC
Still get on master:

type=AVC msg=audit(1467240065.520:85): avc:  denied  { name_connect } for  pid=5532 comm="ssh" dest=35585 scontext=system_u:system_r:sge_job_ssh_t:s0 tcontext=system_u:object_r:ephemeral_port_t:s0 tclass=tcp_socket
type=AVC msg=audit(1467240065.655:86): avc:  denied  { open } for  pid=5533 comm="ssh-keysign" path="/etc/ssh/ssh_host_dsa_key" dev="sda3" ino=52875372 scontext=system_u:system_r:ssh_keysign_t:s0 tcontext=system_u:object_r:sshd_key_t:s0 tclass=file
type=AVC msg=audit(1467240065.656:87): avc:  denied  { read } for  pid=5533 comm="ssh-keysign" name="passwd" dev="sda3" ino=33795233 scontext=system_u:system_r:ssh_keysign_t:s0 tcontext=system_u:object_r:passwd_file_t:s0 tclass=file
type=AVC msg=audit(1467240065.656:87): avc:  denied  { open } for  pid=5533 comm="ssh-keysign" path="/etc/passwd" dev="sda3" ino=33795233 scontext=system_u:system_r:ssh_keysign_t:s0 tcontext=system_u:object_r:passwd_file_t:s0 tclass=file
type=AVC msg=audit(1467240065.656:88): avc:  denied  { getattr } for  pid=5533 comm="ssh-keysign" path="/etc/passwd" dev="sda3" ino=33795233 scontext=system_u:system_r:ssh_keysign_t:s0 tcontext=system_u:object_r:passwd_file_t:s0 tclass=file
type=AVC msg=audit(1467240065.656:89): avc:  denied  { read } for  pid=5533 comm="ssh-keysign" name="passwd" dev="sda3" ino=17671904 scontext=system_u:system_r:ssh_keysign_t:s0 tcontext=system_u:object_r:sssd_public_t:s0 tclass=file
type=AVC msg=audit(1467240065.656:89): avc:  denied  { open } for  pid=5533 comm="ssh-keysign" path="/var/lib/sss/mc/passwd" dev="sda3" ino=17671904 scontext=system_u:system_r:ssh_keysign_t:s0 tcontext=system_u:object_r:sssd_public_t:s0 tclass=file
type=AVC msg=audit(1467240065.656:90): avc:  denied  { getattr } for  pid=5533 comm="ssh-keysign" path="/var/lib/sss/mc/passwd" dev="sda3" ino=17671904 scontext=system_u:system_r:ssh_keysign_t:s0 tcontext=system_u:object_r:sssd_public_t:s0 tclass=file
type=AVC msg=audit(1467240065.658:91): avc:  denied  { getattr } for  pid=5533 comm="ssh-keysign" laddr=10.10.10.202 lport=36702 faddr=10.10.10.203 fport=35585 scontext=system_u:system_r:ssh_keysign_t:s0 tcontext=system_u:system_r:sge_job_ssh_t:s0 tclass=tcp_socket
type=AVC msg=audit(1467240065.658:92): avc:  denied  { read } for  pid=5533 comm="ssh-keysign" name="resolv.conf" dev="sda3" ino=33595525 scontext=system_u:system_r:ssh_keysign_t:s0 tcontext=system_u:object_r:net_conf_t:s0 tclass=file
type=AVC msg=audit(1467240065.658:92): avc:  denied  { open } for  pid=5533 comm="ssh-keysign" path="/etc/resolv.conf" dev="sda3" ino=33595525 scontext=system_u:system_r:ssh_keysign_t:s0 tcontext=system_u:object_r:net_conf_t:s0 tclass=file
type=AVC msg=audit(1467240065.659:93): avc:  denied  { getattr } for  pid=5533 comm="ssh-keysign" path="/etc/resolv.conf" dev="sda3" ino=33595525 scontext=system_u:system_r:ssh_keysign_t:s0 tcontext=system_u:object_r:net_conf_t:s0 tclass=file
type=AVC msg=audit(1467240065.659:94): avc:  denied  { create } for  pid=5533 comm="ssh-keysign" scontext=system_u:system_r:ssh_keysign_t:s0 tcontext=system_u:system_r:ssh_keysign_t:s0 tclass=udp_socket
type=AVC msg=audit(1467240065.659:95): avc:  denied  { connect } for  pid=5533 comm="ssh-keysign" scontext=system_u:system_r:ssh_keysign_t:s0 tcontext=system_u:system_r:ssh_keysign_t:s0 tclass=udp_socket
type=AVC msg=audit(1467240065.659:96): avc:  denied  { getattr } for  pid=5533 comm="ssh-keysign" path="socket:[38189]" dev="sockfs" ino=38189 scontext=system_u:system_r:ssh_keysign_t:s0 tcontext=system_u:system_r:ssh_keysign_t:s0 tclass=udp_socket

On second:
type=AVC msg=audit(1467239926.328:49): avc:  denied  { execute_no_trans } for  pid=2561 comm="ldd" path="/usr/lib/ld-2.17.so" dev="sda3" ino=1665671 scontext=system_u:system_r:sge_execd_t:s0 tcontext=system_u:object_r:ld_so_t:s0 tclass=file
type=AVC msg=audit(1467240065.365:84): avc:  denied  { relabelfrom } for  pid=5449 comm="chcon" name="krb5cc_sge_A6EC8x" dev="tmpfs" ino=38316 scontext=system_u:system_r:sge_execd_t:s0 tcontext=system_u:object_r:sge_tmp_t:s0 tclass=file
type=AVC msg=audit(1467240065.365:84): avc:  denied  { relabelto } for  pid=5449 comm="chcon" name="krb5cc_sge_A6EC8x" dev="tmpfs" ino=38316 scontext=system_u:system_r:sge_execd_t:s0 tcontext=system_u:object_r:user_tmp_t:s0 tclass=file
type=AVC msg=audit(1467240065.533:85): avc:  denied  { getattr } for  pid=5457 comm="sshd" laddr=10.10.10.203 lport=35585 faddr=10.10.10.202 fport=36702 scontext=system_u:system_r:sshd_t:s0 tcontext=system_u:system_r:sge_shepherd_t:s0 tclass=tcp_socket
type=AVC msg=audit(1467240065.533:86): avc:  denied  { setopt } for  pid=5457 comm="sshd" laddr=10.10.10.203 lport=35585 faddr=10.10.10.202 fport=36702 scontext=system_u:system_r:sshd_t:s0 tcontext=system_u:system_r:sge_shepherd_t:s0 tclass=tcp_socket
type=AVC msg=audit(1467240065.533:87): avc:  denied  { getopt } for  pid=5457 comm="sshd" laddr=10.10.10.203 lport=35585 faddr=10.10.10.202 fport=36702 scontext=system_u:system_r:sshd_t:s0 tcontext=system_u:system_r:sge_shepherd_t:s0 tclass=tcp_socket
type=AVC msg=audit(1467240066.307:104): avc:  denied  { getattr } for  pid=5457 comm="sshd" laddr=10.10.10.203 lport=35585 faddr=10.10.10.202 fport=36702 scontext=system_u:system_r:sshd_t:s0 tcontext=system_u:system_r:sge_shepherd_t:s0 tclass=tcp_socket
type=AVC msg=audit(1467240074.586:119): avc:  denied  { getattr } for  pid=5457 comm="sshd" laddr=10.10.10.203 lport=35585 faddr=10.10.10.202 fport=36702 scontext=system_u:system_r:sshd_t:s0 tcontext=system_u:system_r:sge_shepherd_t:s0 tclass=tcp_socket

sge_domain_can_network_connect --> on
sge_use_nfs --> on
ssh_chroot_rw_homedirs --> off
ssh_keysign --> on

selinux-policy-targeted-3.13.1-60.el7_2.7.noarch

Comment 7 Jakub Jelen 2017-11-03 11:12:33 UTC
The AVCs in comment #4 are more than a year old (from RHEL7.2) and I believe there were many selinux-policy updates that could change it. I would give it a try with a new version, ideally with RHEL7.5 if you still see the same issues and if we can reproduce it.

The hostbased authentication in OpenSSH is tested in automated jobs and it is working without any problems on its own.

It looks like a problem with interaction with the sge (port forwarding reserved ports, running the ssh itself with the sge context. Otherwise rules for the ssh-keysign should be in place and for example I do not see a reason why the following is disabled. Is it again because the source context is system_*? I believe there must be rules for this in the policy, otherwise we would see failures all over the place.

type=AVC msg=audit(1467240065.655:86): avc:  denied  { open } for  pid=5533 comm="ssh-keysign" path="/etc/ssh/ssh_host_dsa_key" dev="sda3" ino=52875372 scontext=system_u:system_r:ssh_keysign_t:s0 tcontext=system_u:object_r:sshd_key_t:s0 tclass=file

Comment 8 Lukas Vrabec 2017-11-06 14:19:34 UTC
Thanks Jakub, 

Moving this to MODIFIED. To test this in RHEL-7.5.

Comment 11 Milos Malik 2018-02-13 19:12:52 UTC
Based on the audit2allow output, following rules are still missing:

#============= ssh_keysign_t ==============
allow ssh_keysign_t net_conf_t:file { getattr open read };
allow ssh_keysign_t passwd_file_t:file { getattr open read };
allow ssh_keysign_t self:udp_socket { connect create getattr };
allow ssh_keysign_t sge_job_ssh_t:tcp_socket getattr;
allow ssh_keysign_t sshd_key_t:file open;
allow ssh_keysign_t sssd_public_t:file { getattr open read };

#============= sshd_t ==============
allow sshd_t sge_shepherd_t:tcp_socket { getattr getopt setopt };

#============= sge_execd_t ==============
allow sge_execd_t ld_so_t:file execute_no_trans;
allow sge_execd_t sge_tmp_t:file relabelfrom;
allow sge_execd_t user_tmp_t:file relabelto;

# rpm -qa selinux-policy\* | sort
selinux-policy-3.13.1-189.el7.noarch
selinux-policy-devel-3.13.1-189.el7.noarch
selinux-policy-targeted-3.13.1-189.el7.noarch
#

Comment 15 errata-xmlrpc 2018-10-30 09:59:15 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2018:3111


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