如何使用Active Directory验证Linux用户


10

使用Active Directory在Linux(Debian)机器上对用户进行身份验证的最佳实践是什么?

我希望它的工作方式是将AD用户添加到组中-例如linux管理员linux webserver,并根据其组成员身份将/将不会授予他们对特定服务器的访问权限。理想情况下,根帐户将是唯一以标准方式维护的帐户。

我的目标如下:

  • 允许在一处更改密码
  • 自动授予某些人使用其AD凭证访问Linux服务器的权限
  • 将我们所有的用户信息整合到一个数据库中

我要避免的事情是:

  • Active Directory管理员需要管理的任何困难/违反直觉的事情
  • 如果由于某种原因无法访问AD服务器,则将用户锁定(例如,它需要以某种方式缓存凭据)
  • 任何太复杂或不标准的东西都会在下次升级服务器时中断。

Answers:



4

您正在寻找的软件称为“同等打开”。

从他们的页面:

  • 从命令行或GUI一步将非Windows系统连接到Active Directory域
  • 在Windows和非Windows上使用单一用户名和密码对用户进行身份验证
  • 对非Windows用户和Windows用户强制实施相同的密码策略
  • 通过单向和双向跨林信任来支持多个林
  • 缓存凭据,以防您的域控制器出现故障
  • 提供SSH和Putty的单点登录
  • 支持Kerberos,NTLM和SPNEGO的下一代身份验证引擎
  • 无需更改Active Directory的架构

我们在这里的某些机器上使用过它,它似乎运行良好。

http://www.likewise.com/products/likewise_open/


同样开放有没有Debian仓库?这对于我们管理安全补丁很重要。
布伦特

1
它具有Ubuntu软件包:软件包:likely-open状态:未安装版本:4.1.9822-0ubuntu1优先级:可选章节:net维护者:Ubuntu核心开发人员<ubuntu-devel-discuss@lists.ubuntu.com>
jay_dubya

据我所知,这是一个专有的解决方案,您可以使用LDAP + Kerberos来完成上面列出的所有操作(sans gui),如果您在Windows域中,则大多数应该自动配置。
TheFiddlerWins

4

您没有理由在大多数发行版上使用任何外部软件。

对于Debian / Ubuntu,您可以使用libnss-ldap和libpam-krb5来完成。有一些技巧可以使其达到100%。这假设您为Linux用户填充了“ unixHomeDirectory”,您的Linux机器使用的是Windows系统通用的NTP(由Kerberos要求),并且可以使用纯文本NSS查找(不是密码,而是组成员信息等)-您也可以使用TLS,但设置起来更复杂)。除非您设置为使用TLS,否则不应在pam中使用pam_ldap作为密码或身份验证源。

/etc/ldap.conf

# LDAP Configuration for libnss-ldap and libpam-ldap.
# Permit host to continue boot process with out contacting LDAP server
bind_policy soft
# Define LDAP servers to use for queries, these must be Global Catalog servers
uri ldap://ldap.site.company.local
# Define root search location for queries
base dc=company,dc=local
#debug 1
# LDAP version, almost always going to be v3, it is quite mature
ldap_version 3
# Username used to proxy authentication. You can have this in a separate file owned by root for security OR use TLS/SSL (see man page)
# Do NOT use LDAP for authentication if you are using plain text binds, use Kerberos instead (and LDAP for authorization only). See libpam-krb5.
binddn cn=ldap-auth-svc,ou=ldap,ou=services,dc=site,dc=company,dc=local
# Password for proxy acct
bindpw SooperSekeretPazzwerd
#  TCP port to perform queries on, 3268 is a Global Catalog port which will reply for all users in *.company.local
port 3268
# Search range scope (sub = all)
scope sub
# Tell the client to close TCP connctions after 30 seconds, Windows will do this on the server side anyways, this will prevent errors from showing up in the logs.
 idle_timelimit 30
# Expect queries for group membership to return DN for group members instead of usernames (lets you use MSAD group membership seamlessly)
nss_schema rfc2307bis
# Filters - User accounts must have a UID >= 2000 to be recognized in this configuration and must have a unixHomeDirectory defined.
nss_base_group dc=company,dc=local?sub?&(objectClass=group)(gidNumber=*)
nss_base_user dc=company,dc=local?sub?&(objectClass=user)(!(objectClass=localputer))(uidNumber>=2000)(unixHomeDirectory=*)
nss_base_shadow dc=company,dc=local?sub?&(objectClass=user)(!(objectClass=localputer))(uidNumber>=2000)(unixHomeDirectory=*)
# Object Class mappings.  You may want to have the posixAccount to map to "mail" and have users login with their email addresses, i.e.  "nss_map_objectclass posixAccount mail".
nss_map_objectclass posixAccount user
nss_map_objectclass shadowAccount user
nss_map_objectclass posixGroup group
# Attribute mappings.
nss_map_attribute uniqueMember member
nss_map_attribute uid sAMAccountName
nss_map_attribute homeDirectory unixHomeDirectory
nss_map_attribute shadowLastChange pwdLastSet
# Attribute in LDAP to query to match the username used by PAM for authentication
pam_login_attribute sAMAccountName
# Filter for objects which are allowed to login via PAM
pam_filter objectclass=User

假设您的Linux机器使用的是知道AD的DNS服务器(可以解析具有适当SRV记录的_msdcs区域),则无需编辑/etc/krb5.conf。

/etc/nsswitch.conf应该为用户,组,影子提供“文件ldap”。

对于使用SSSD的Red Hat:

/etc/sssd/sssd.conf

[domain/AD]
id_provider = ldap
auth_provider = krb5
chpass_provider = krb5
access_provider = ldap

ldap_uri = ldap://ldap.company.local:3268/
ldap_search_base = dc=company,dc=com
ldap_default_bind_dn = cn=ldap-auth-svc,ou=ldap,ou=services,dc=site,dc=company,dc=local
ldap_default_authtok = SooperSekeretPazzwerd
ldap_schema = rfc2307bis
ldap_user_object_class = user
ldap_group_object_class = group
ldap_user_name = sAMAccountName
ldap_user_home_directory = unixHomeDirectory
enumerate = true
ldap_tls_reqcert = never
ldap_tls_cacertdir = /etc/openldap/cacerts

ldap_id_use_start_tls = False
cache_credentials = True
krb5_realm = SITE.COMPANY.COM
case_sensitive = false
[sssd]
services = nss, pam
config_file_version = 2

domains = AD
[nss]
filter_users = root,named,avahi,nscd


By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.