AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / server / 问题 / 15626
Accepted
Philip Fourie
Philip Fourie
Asked: 2009-05-31 07:28:41 +0800 CST2009-05-31 07:28:41 +0800 CST 2009-05-31 07:28:41 +0800 CST

针对 AD 对 Linux 服务器进行身份验证有多实用?

  • 772

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

此设置的一个摩擦点是我们没有单点登录解决方案。作为微软商店而不是 Linux 商店,我们希望针对 AD 进行身份验证。

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

我们目前在需要身份验证的 Linux 上使用以下服务:
- git 服务器(通过 SSH)
- Sendmail
- 当前使用 .htaccess 文件的 Apache Web 服务器。
- SAMBA 文件共享

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

windows linux authentication single-sign-on
  • 5 5 个回答
  • 27372 Views

5 个回答

  • Voted
  1. Best Answer
    Jason Tan
    2009-05-31T07:39:21+08:002009-05-31T07:39:21+08:00

    它并不难,而且非常实用。

    我们有数百台使用 AD auth 的双启动台式机以及许多使用 AD auth 的服务器,以使 Windows 客户端无需用户明确的身份验证即可使用其 samba 共享。

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

    基本上你需要配置 kerberos、winbind、nss 和 pam。

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

    如果需要,您可以将 pam 配置为使用多种身份验证方法,因此如果其中一个不起作用,它将退回到下一个。

    我们通常使用文件、winbindd 和 ldap 来为 Windows 服务器提供文件共享服务。

    如果可能的话,我会使用 LDAP 作为帐户信息,而 windbind 严格用于身份验证,但我相信你可以在我认为 /etc/ldap.conf 中映射属性,如果你需要的话。如果您最终使用 winbindd 获取帐户信息,则可以使用 RID(散列方法)生成 uids/gids,但也可以使用其他方法。我们在一个大型文件服务器上使用了 RID,这真的很痛苦,所以如果可能的话,我会尝试探索其他选项之一。在我们的例子中,所有 AD 用户和组都由上游 IDM 系统反映在 LDAP 中,因此我们使用 LDAP 获取较新服务器上的帐户信息,并仅使用 winbind 进行身份验证。

    • 12
  2. Matt Simmons
    2009-05-31T07:39:10+08:002009-05-31T07:39:10+08:00

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

    多亏了同样的开放,我的整个 Linux 基础架构几乎都具有集中式身份验证和用户管理。它的安装和实施非常简单。我不可能说得足够好。

    需要注意的是,UID 和 GID 是根据哈希函数分配的,因此它们在整个基础架构中是相同的,因此 NFS 挂载可以完美运行。

    • 7
  3. Scott
    2009-05-31T15:20:09+08:002009-05-31T15:20:09+08:00

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

    /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
    

    希望这可以帮助。

    • 4
  4. Tom Newton
    2009-05-31T15:26:21+08:002009-05-31T15:26:21+08:00

    让 Windows 用户针对 AD 进行身份验证,但我们的大多数服务器(公共驱动器等)都是 linux,并且它们是域的一部分。从 Windows PoV 没有人注意到。从我的角度来看,我的 Windows 用户名感觉有点果味 ssh'ing,但这就是它的大小。

    只需使用普通的旧桑巴舞。

    • 2
  5. TheFiddlerWins
    2013-08-16T06:03:43+08:002013-08-16T06:03:43+08:00

    您不需要使用 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, 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
    

    您不需要编辑 /etc/krb5.conf 假设您的 Linux 机器正在使用了解 AD 的 DNS 服务器(具有适当 SRV 记录的 _msdcs 区域是可解析的)

    /etc/nsswitch.conf 应该有用户、组、影子的“文件 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
    
    • 2

相关问题

  • Vanilla Powershell 是否足以成为 Windows 和 DB 服务器管理员的语言?

  • 为什么添加新驱动器后我的磁盘驱动器访问速度如此之慢?

  • (软)Ubuntu 7.10 上的 RAID 6,我应该迁移到 8.10 吗?

  • 在 Windows Server 2003 下使用 wscipt 从 .asp 文件运行 .exe

  • 最佳混合环境(OS X + Windows)备份?[关闭]

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    SFTP 使用什么端口?

    • 6 个回答
  • Marko Smith

    从 IP 地址解析主机名

    • 8 个回答
  • Marko Smith

    如何按大小对 du -h 输出进行排序

    • 30 个回答
  • Marko Smith

    命令行列出 Windows Active Directory 组中的用户?

    • 9 个回答
  • Marko Smith

    Windows 中执行反向 DNS 查找的命令行实用程序是什么?

    • 14 个回答
  • Marko Smith

    如何检查 Windows 机器上的端口是否被阻塞?

    • 4 个回答
  • Marko Smith

    我应该打开哪个端口以允许远程桌面?

    • 9 个回答
  • Marko Smith

    什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同?

    • 3 个回答
  • Marko Smith

    如何确定bash变量是否为空?

    • 15 个回答
  • Martin Hope
    MikeN 在 Nginx 中,如何在维护子域的同时将所有 http 请求重写为 https? 2009-09-22 06:04:43 +0800 CST
  • Martin Hope
    Tom Feiner 如何按大小对 du -h 输出进行排序 2009-02-26 05:42:42 +0800 CST
  • Martin Hope
    0x89 bash中的双方括号和单方括号有什么区别? 2009-08-10 13:11:51 +0800 CST
  • Martin Hope
    kch 如何更改我的私钥密码? 2009-08-06 21:37:57 +0800 CST
  • Martin Hope
    Kyle Brandt IPv4 子网如何工作? 2009-08-05 06:05:31 +0800 CST
  • Martin Hope
    Noah Goodrich 什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同? 2009-05-19 18:24:42 +0800 CST
  • Martin Hope
    Brent 如何确定bash变量是否为空? 2009-05-13 09:54:48 +0800 CST
  • Martin Hope
    cletus 您如何找到在 Windows 中打开文件的进程? 2009-05-01 16:47:16 +0800 CST

热门标签

linux nginx windows networking ubuntu domain-name-system amazon-web-services active-directory apache-2.4 ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve