Bug 1178116
| Summary: | Default selinux policy prevents ssh-ldap-helper from connecting to LDAP server | ||
|---|---|---|---|
| Product: | Red Hat Enterprise Linux 7 | Reporter: | Justin Lambert <jlambert> |
| Component: | openssh | Assignee: | Jakub Jelen <jjelen> |
| Status: | CLOSED ERRATA | QA Contact: | Stanislav Zidek <szidek> |
| Severity: | unspecified | Docs Contact: | |
| Priority: | unspecified | ||
| Version: | 7.0 | CC: | marianne, mmalik, plautrba, tmraz |
| Target Milestone: | rc | Keywords: | Documentation, Reopened |
| Target Release: | --- | ||
| Hardware: | Unspecified | ||
| OS: | Linux | ||
| Whiteboard: | |||
| Fixed In Version: | openssh-6.6.1p1-13.el7 | Doc Type: | Bug Fix |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2015-11-19 08:02:29 UTC | Type: | Bug |
| Regression: | --- | Mount Type: | --- |
| Documentation: | --- | CRM: | |
| Verified Versions: | Category: | --- | |
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
| Cloudforms Team: | --- | Target Upstream Version: | |
| Embargoed: | |||
| Bug Depends On: | |||
| Bug Blocks: | 1191021 | ||
It looks like this can also be resolved with: setsebool -P authlogin_nsswitch_use_ldap 1 This is not mentioned in the HOWTO.ldap-keys file, it should be added there. # rpm -qa selinux-policy\*
selinux-policy-mls-3.12.1-153.el7_0.13.noarch
selinux-policy-minimum-3.12.1-153.el7_0.13.noarch
selinux-policy-3.12.1-153.el7_0.13.noarch
selinux-policy-doc-3.12.1-153.el7_0.13.noarch
selinux-policy-sandbox-3.12.1-153.el7_0.13.noarch
selinux-policy-devel-3.12.1-153.el7_0.13.noarch
selinux-policy-targeted-3.12.1-153.el7_0.13.noarch
# sesearch -s sshd_t -t ldap_port_t -c tcp_socket -p name_connect -A -C
Found 3 semantic av rules:
DT allow nsswitch_domain ldap_port_t : tcp_socket { recv_msg send_msg name_connect } ; [ authlogin_nsswitch_use_ldap ]
ET allow sshd_t reserved_port_type : tcp_socket name_connect ; [ nis_enabled ]
ET allow nsswitch_domain reserved_port_type : tcp_socket name_connect ; [ nis_enabled ]
#
Usage of authlogin_nsswitch_use_ldap boolean is the right way to go.
$ audit2allow
type=AVC msg=audit(1420058593.479:6643): avc: denied { name_connect } for pid=26849 comm="ssh-ldap-helper" dest=389 scontext=system_u:system_r:sshd_t:s0-s0:c0.c1023 tcontext=system_u:object_r:ldap_port_t:s0 tclass=tcp_socket
#============= sshd_t ==============
#!!!! This avc can be allowed using one of the these booleans:
# nis_enabled, authlogin_nsswitch_use_ldap
allow sshd_t ldap_port_t:tcp_socket name_connect;
As it's suggested in comment 3, setting authlogin_nsswitch_use_ldap variable to yes should fix the issue, eg:
# setsebool -P authlogin_nsswitch_use_ldap on
or
# semanage boolean --modify --on authlogin_nsswitch_use_ldap
Closed without adding anything to the README? If I had this issue, it seems that someone else will as well. I missed that, sorry. We'll provide a note in HOWTO.ldap-keys I would be for such addition to HOWTO.ldap-keys:
===============
@@ -51,6 +51,9 @@
* There are some debug options
* Example
/usr/libexec/openssh -s -f /etc/ldap.conf -w -d >> /tmp/ldapdebuglog.txt
+7) Configure SELinux boolean which allows ldap-helper to bind ldap server
+ Run this command
+ # setsebool -P authlogin_nsswitch_use_ldap on
HOW TO MIGRATE FROM LPK
===============
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://rhn.redhat.com/errata/RHSA-2015-2088.html |
Description of problem: When using openssh-ldap the default selinux policy prevents connections to the LDAP server. Version-Release number of selected component (if applicable): openssh-6.4p1-8.el7.x86_64 openssh-ldap-6.4p1-8.el7.x86_64 How reproducible: Install and configure openssh-ldap, attempt to SSH to the host. Steps to Reproduce: 1. 2. 3. Actual results: Error in the audit log: type=AVC msg=audit(1420058593.479:6643): avc: denied { name_connect } for pid=26849 comm="ssh-ldap-helper" dest=389 scontext=system_u:system_r:sshd_t:s0-s0:c0.c1023 tcontext=system_u:object_r:ldap_port_t:s0 tclass=tcp_socket and LDAP not queried for the public key. Expected results: LDAP queried for the public key and result returned Additional info: From the setroubleshoot script: If you believe that ssh-ldap-helper should be allowed name_connect access on the tcp_socket 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: # grep ssh-ldap-helper /var/log/audit/audit.log | audit2allow -M mypol # semodule -i mypol.pp