validationLinux服务器对抗AD有多实用?

我们在软件开发公司使用Windows和Linux服务器。

与此设置的摩擦点之一是,我们没有一个单一的login解决scheme。 我们希望通过AD进行身份validation,而不仅仅是一个Linux商店。

我在网上阅读了几篇文章,我明白这是可能的。

我们目前正在Linux上使用需要authentication的以下服务:
– git服务器(通过SSH)
– 发送邮件
– 目前使用.htaccess文件的Apachenetworking服务器。
– SAMBA文件共享

我想知道的是这种设置有多实用? 它真的有效吗?还是容易出错?

它不难,这是完全实用的。

我们有几百台使用ADauthentication的双启动桌面机器,以及一些使用ADauthentication的服务器,使得用户无需显式authentication就可以使用他们的samba共享。

SF上还有一篇关于你需要做什么的文章。

基本上你需要configurationkerberos,winbind,nss和pam。

然后你做一个kinit和一个net ads join和你的。

您可以configurationpam以使用多种身份validation方法(如果需要的话),因此如果某个方法无效,则会回退到下一个方法。

我们通常使用文件,winbindd和ldap为服务器提供文件共享给windows服务器。

如果可能的话,我会使用LDAP帐户信息和Windbind严格的身份validation,但我相信你可以映射属性在我认为/etc/ldap.conf如果你需要的话。 如果你最终使用winbindd帐户信息,可以使用RID(哈希方法)来生成uids / gids,但是也可以使用其他方法。 我们在一台大文件服务器上使用了RID,这是一个非常痛苦的事情,所以如果可能的话,我会尝试去探索其他的select。 在我们的例子中,所有的AD用户和组都被上游的IDM系统反映在LDAP中,所以我们在新的服务器上使用LDAP来获取帐户信息,并且纯粹将winbind用于validation。

使用Likewise Open进行身份validation非常简单。 http://www.likewise.com/products/likewise_open/index.php

几乎所有的Linux基础设施都有集中的authentication和用户pipe理,这要归功于Likewise Open。 这是非常简单的安装和实施。 我不可能说得很好。

请注意,UID和GID是根据哈希函数分配的,因此它们在整个基础架构中是相同的,因此NFS安装完美无缺。

我安装了Windows Services for Unix,并在AD中添加了一个名为“Unix Authenticator”的用户,然后在Linux机器上进行了以下configuration文件更改:

/etc/ldap.conf中用:

 host ldap.<foo>.com base cn=Users,dc=<foo>,dc=com binddn cn=Unix Authenticator,cn=Users,dc=<foo>,dc=com bindpw <password> nss_base_passwd cn=Users,dc=<foo>,dc=com?sub nss_base_shadow cn=Users,dc=<foo>,dc=com?sub nss_base_group cn=Users,dc=<foo>,dc=com?sub nss_map_objectclass posixAccount User nss_map_objectclass shadowAccount User nss_map_objectclass posixGroup Group nss_map_attribute cn msSFUName nss_map_attribute uid msSFUName nss_map_attribute gid gidNumber nss_map_attribute gecos sAMAccountName nss_map_attribute homeDirectory msSFUHomeDirectory nss_map_attribute uniqueMember Member pam_login_attribute msSFUName pam_filter objectclass=user pam_password ad 

/etc/ldap.secret:

 <password> 

/etc/nsswitch.conf中:

 passwd: compat ldap shadow: compat ldap group: compat ldap 

/etc/nsswitch.ldap:

 host files dns 

将/etc/pam.d/system-auth:

 auth required /lib/security/pam_env.so auth sufficient /lib/security/pam_unix.so likeauth nullok auth sufficient /lib/security/pam_ldap.so use_first_pass auth required /lib/security/pam_deny.so account sufficient /lib/security/pam_ldap.so account required /lib/security/pam_unix.so password required /lib/security/pam_cracklib.so retry=3 password sufficient /lib/security/pam_unix.so nullok md5 shadow use_authtok password sufficient /lib/security/pam_ldap.so use_first_pass use_authtok password required /lib/security/pam_deny.so session required /lib/security/pam_limits.so session required /lib/security/pam_unix.so 

希望这可以帮助。

得到了Windows用户对AD的authentication,但是我们的大部分服务器(公共驱动器等)都是linux,而且它们是域的一部分。 从一个Windows PoV没有人注意到。 从我的身边,我的窗口用户名感觉有点果味ssh'ing,但那是关于它的大小。

只是使用普通的旧桑巴。

AD不需要使用Samba,AD直接支持Kerberos和LDAP。 您没有理由在大多数发行版上使用任何外部软件。

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

/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, ie "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服务器,则不需要编辑/etc/krb5.conf(具有适当的SRVlogging的_msdcs区域是可parsing的)

/etc/nsswitch.conf应该有用于用户,组,影子的“files ldap”。

对于使用SSSD的红帽:

/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