RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1413509 - Failed to login the remote host on cockpit login page.
Summary: Failed to login the remote host on cockpit login page.
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: selinux-policy
Version: 7.4
Hardware: All
OS: Linux
unspecified
high
Target Milestone: alpha
: 7.4
Assignee: Lukas Vrabec
QA Contact: Milos Malik
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2017-01-16 09:03 UTC by Wei Wang
Modified: 2017-08-01 15:20 UTC (History)
17 users (show)

Fixed In Version: selinux-policy-3.13.1-142.el7
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2017-08-01 15:20:12 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
log files (329.07 KB, application/x-gzip)
2017-01-16 09:03 UTC, Wei Wang
no flags Details
picture for login page (27.10 KB, image/png)
2017-01-16 09:04 UTC, Wei Wang
no flags Details
picture for dashboard (11.73 KB, image/png)
2017-01-16 09:04 UTC, Wei Wang
no flags Details
log files (243.79 KB, application/x-gzip)
2017-03-06 07:18 UTC, Wei Wang
no flags Details
picture (47.43 KB, image/png)
2017-03-06 07:19 UTC, Wei Wang
no flags Details


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2017:1861 0 normal SHIPPED_LIVE selinux-policy bug fix update 2017-08-01 17:50:24 UTC

Description Wei Wang 2017-01-16 09:03:19 UTC
Created attachment 1241153 [details]
log files

Description of problem:
Login to the remote host is failed via cockpit login page.

Version-Release number of selected component (if applicable):
redhat-virtualization-host-4.1-0.20170112.0
cockpit-ovirt-dashboard-0.10.7-0.0.3.el7ev.noarch
cockpit-ws-126-1.el7.x86_64
imgbased-0.9.4-0.1.el7ev.noarch


How reproducible:
100%

Steps to Reproduce:
1. Two machines(A and B) are installed with RHVH 4.1
2. Create cockpit.conf on host A: vi /etc/cockpit/cockpit.conf
    [SSH-Login]
    host = <B IP>
    allowUnknown = true
3. Start cockpit-ws
4. Input username or password and "other options" with host B's IP in host A cockpit UI
5. Click "Log In" and check



Actual results:
Login to the remote host is failed, "Internal error in login process" is displayed.

Expected results:
Login to the remote host is successful.


Additional info:
Add the remote host to dashboard also failed after login cockpit.

Comment 1 Wei Wang 2017-01-16 09:04:13 UTC
Created attachment 1241154 [details]
picture for login page

Comment 2 Wei Wang 2017-01-16 09:04:52 UTC
Created attachment 1241155 [details]
picture for dashboard

Comment 3 Wei Wang 2017-01-16 09:35:32 UTC
This bug doesn't occur with redhat-virtualization-host-4.1-20170104.0, it is a regression bug.

Comment 4 Peter 2017-01-16 15:05:45 UTC
Looks like a selinux issue:

type=AVC msg=audit(1484554225.187:549): avc:  denied  { execute } for  pid=22870 comm="cockpit-ws" name="cockpit-ssh" dev="dm-3" ino=13376792 scontext=system_u:system_r:cockpit_ws_t:s0 tcontext=system_u:object_r:bin_t:s0 tclass=file
type=AVC msg=audit(1484554292.663:552): avc:  denied  { execute } for  pid=22881 comm="cockpit-ws" name="cockpit-ssh" dev="dm-3" ino=13376792 scontext=system_u:system_r:cockpit_ws_t:s0 tcontext=system_u:object_r:bin_t:s0 tclass=file
type=AVC msg=audit(1484554814.523:564): avc:  denied  { execute } for  pid=22915 comm="cockpit-ws" name="cockpit-ssh" dev="dm-3" ino=13376792 scontext=system_u:system_r:cockpit_ws_t:s0 tcontext=system_u:object_r:bin_t:s0 tclass=file
type=AVC msg=audit(1484555170.282:569): avc:  denied  { execute } for  pid=22941 comm="cockpit-ws" name="cockpit-ssh" dev="dm-3" ino=13376792 scontext=system_u:system_r:cockpit_ws_t:s0 tcontext=system_u:object_r:bin_t:s0 tclass=file
type=AVC msg=audit(1484555322.157:572): avc:  denied  { execute } for  pid=22960 comm="cockpit-ws" name="cockpit-ssh" dev="dm-3" ino=13376792 scontext=system_u:system_r:cockpit_ws_t:s0 tcontext=system_u:object_r:bin_t:s0 tclass=file

Comment 5 Milos Malik 2017-01-17 06:57:18 UTC
Please provide version and release of selinux-policy* packages:

# rpm -qa selinux-policy\*

Comment 6 Wei Wang 2017-01-17 07:15:34 UTC
(In reply to Milos Malik from comment #5)
> Please provide version and release of selinux-policy* packages:
> 
> # rpm -qa selinux-policy\*

# rpm -qa selinux-policy\*
selinux-policy-3.13.1-102.el7_3.7.noarch
selinux-policy-targeted-3.13.1-102.el7_3.7.noarch

Comment 9 Lukas Vrabec 2017-03-03 14:31:26 UTC
Peter, 
Where is "cockpit-ssh" stored? 

Thanks.

Comment 10 Peter 2017-03-03 14:34:21 UTC
/usr/libexec

Comment 11 Lukas Vrabec 2017-03-03 20:35:44 UTC
Hi, 
Could you label cockpit-ssh as cockpit_session_exec_t:

# semanage fcontext -a -t cockpit_session_exec_t  /usr/libexec/cockpit-ssh
# restorecon -v /usr/libexec/cockpit-ssh

And then try to reproduce your issue. 

THanks.

Comment 12 Wei Wang 2017-03-06 07:17:24 UTC
Test Version:
redhat-virtualization-host-4.1-0.20170112.0
cockpit-ovirt-dashboard-0.10.7-0.0.3.el7ev.noarch
cockpit-ws-126-1.el7.x86_64
imgbased-0.9.4-0.1.el7ev.noarch


Steps to Reproduce:
1. Two machines(A and B) are installed with RHVH 4.1
2. Create cockpit.conf on host A: vi /etc/cockpit/cockpit.conf
    [SSH-Login]
    host = <B IP>
    allowUnknown = true
3. Label cockpit-ssh as cockpit_session_exec_t
   # semanage fcontext -a -t cockpit_session_exec_t  /usr/libexec/cockpit-ssh
   # restorecon -v /usr/libexec/cockpit-ssh
4. Start cockpit service
5. Input username or password and "other options" with host B's IP in host A cockpit UI
6. Click "Log In" and check

Another error displays as "Unable to connect to that address".

Comment 13 Wei Wang 2017-03-06 07:18:07 UTC
Created attachment 1260287 [details]
log files

Comment 14 Wei Wang 2017-03-06 07:19:08 UTC
Created attachment 1260288 [details]
picture

Comment 16 Milos Malik 2017-04-11 07:31:28 UTC
The /var/log/audit/audit.log file, which is part of the log files attachment, contains following SELinux denial:

type=AVC msg=audit(1488784111.418:186): avc:  denied  { name_connect } for  pid=20965 comm="cockpit-ssh" dest=22 scontext=system_u:system_r:cockpit_session_t:s0 tcontext=system_u:object_r:ssh_port_t:s0 tclass=tcp_socket
type=SYSCALL msg=audit(1488784111.418:186): arch=c000003e syscall=42 success=no exit=-13 a0=6 a1=7f619597ff90 a2=10 a3=5 items=0 ppid=20962 pid=20965 auid=4294967295 uid=995 gid=992 euid=995 suid=995 fsuid=995 egid=992 sgid=992 fsgid=992 tty=(none) ses=4294967295 comm="cockpit-ssh" exe="/usr/libexec/cockpit-ssh" subj=system_u:system_r:cockpit_session_t:s0 key=(null)
type=AVC msg=audit(1488784119.233:187): avc:  denied  { name_connect } for  pid=20966 comm="cockpit-ssh" dest=22 scontext=system_u:system_r:cockpit_session_t:s0 tcontext=system_u:object_r:ssh_port_t:s0 tclass=tcp_socket

but appropriate allow rule is dependent on the nis_enabled boolean:

# rpm -qa selinux-policy\*
selinux-policy-minimum-3.13.1-141.el7.noarch
selinux-policy-devel-3.13.1-140.el7.noarch
selinux-policy-mls-3.13.1-141.el7.noarch
selinux-policy-targeted-3.13.1-141.el7.noarch
selinux-policy-3.13.1-141.el7.noarch
# sesearch -s cockpit_session_t -t ssh_port_t -c tcp_socket -p name_connect -A -C
Found 2 semantic av rules:
DT allow cockpit_session_t reserved_port_type : tcp_socket name_connect ; [ nis_enabled ]
DT allow nsswitch_domain reserved_port_type : tcp_socket name_connect ; [ nis_enabled ]

#

This scenario has nothing to do with NIS/YP, therefore we need an unconditional allow rule.

Comment 22 errata-xmlrpc 2017-08-01 15:20:12 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-2017:1861


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