Host-based Authorization Host based Authorization allows you to restrict who can log into a specific machine that uses LDAP for authentication.
There are a couple of methods we have seen utilized, unfortunately, we can not be assured upon which Linux-Unix Distributions they will work.
There are two methods to enforce host-based authentication, the first is to use Host Attribute, the second method is to use an LDAP pam_filter
Using the pam_check_host_attr directive to enforce host authentication has the effect that users are explicitly informed they are not permitted to access the host with an error message: Access denied for this host.
Libpam-ldap requires that you use the host attribute. The attribute value(s) are added to each user that should be able to access the host:
dn: uid=user_to_change,ou=Users,dc=example,dc=com changetype: modify add: host host: thehostname
The PAM_CONF file would require the directive:
pam_check_host_attr yes
Warning: /etc/nsswitch.conf should *not* contain "ldap" in the "shadow" entry, or host-based authentication will always succeed. See your documentation for additional information.
An example using the libpam-ldap host attribute, we can create a filter which matches thehostname or * in /etc/ldap.conf:
pam_filter |(host=thehostname)(host=\*)