我如何让 centos 7 使用活动目录中的 uids 和 gids?

mrw*_*ers 6 active-directory sssd centos7

我正在准备从 CentOS 6 最终升级到 CentOS 7。现在,在版本 6 中,我们只使用映射到 AD 的 LDAP 进行身份验证。然后使用 Unix 的 Active Directory 扩展中的 UID 和 GID。

在我对 CentOS 7 的实验中,我浏览了解释如何加入域的文档(我认为它来自 Red Hat)。这个过程大多是直截了当的,而且大多效果很好。但是,它不仅仅使用 AD Unix 属性中的 UID 和 GID。它将这些 ID 映射到完全不同的 ID。在 AD 中,用户在 10000 范围内。CentOS7 为每个用户提供 625000000 范围内的 UID。

到目前为止,在我的小规模测试(3 个盒子)中,UID 似乎在它们之间保持一致,这很好。但是,当我开始在生产中推出 7 时,它将是一个逐渐升级的过程。我不会同时升级每个盒子。我担心用户在不同盒子上拥有不同 UID 的问题。有没有办法让 CentOS 7 只使用 AD Unix 属性中的 UID 和 GID?

这是我的 smb.conf:

[global]
    workgroup = COMPANY
    client signing = yes
    client use spnego = yes
    kerberos method = secrets and keytab
    log file = /var/log/samba/%m.log
    password server = ad_domaincontroller.company.net
    realm = COMPANY.NET
    security = ads
    server string = Samba Server Version %v
    max log size = 50
Run Code Online (Sandbox Code Playgroud)

这是我的 sssd.conf

[sssd]
config_file_version = 2
domains = company.net
services = nss, pam, pac

[nss]
filter_groups = root
filter_users = root

[domain/company.net]
id_provider = ad
ad_server = ad_domiancontroller.company.net
ad_hostname = centos7-22.company.net
auth_provider = ad
chpass_provider = ad
access_provider = ad
ldap_schema = ad
use_fully_qualified_names = False
cache_credentials = true
ldap_access_order = expire
ldap_account_expire_policy = ad
ldap_force_upper_case_realm = true
Run Code Online (Sandbox Code Playgroud)

编辑:我尝试将 ldap_id_mapping = False 添加到 sssd.conf,但包含该行后,sssd.service 将无法启动。这是输出:

Sep 29 12:59:55 centos7-22 sssd[32827]: Starting up
Sep 29 12:59:55 centos7-22 sssd[32828]: Starting up
Sep 29 12:59:55 centos7-22 sssd[32831]: Starting up
Sep 29 12:59:55 centos7-22 sssd[32830]: Starting up
Sep 29 12:59:55 centos7-22 sssd[32829]: Starting up
Sep 29 12:59:55 centos7-22 sssd[32832]: Starting up
Sep 29 12:59:56 centos7-22 sssd[be[32833]: Starting up
Sep 29 12:59:56 centos7-22 systemd[1]: sssd.service: control process exited, code=exited status=1
Sep 29 12:59:56 centos7-22 systemd[1]: Failed to start System Security Services Daemon.
-- Subject: Unit sssd.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit sssd.service has failed.
--
-- The result is failed.
Sep 29 12:59:56 centos7-22 systemd[1]: Unit sssd.service entered failed state.
Run Code Online (Sandbox Code Playgroud)

And*_*ndy 6

从 sssd-ad 的手册页:

默认情况下,AD 提供程序将从 Active Directory 中的 objectSID 参数映射 UID 和 GID 值。有关这方面的详细信息,请参阅下面的“ID 映射”部分。如果要禁用 ID 映射,而是依赖 Active Directory 中定义的 POSIX 属性,则应设置 ldap_id_mapping = False

  • 最终这是正确的答案。我已经尝试过了,但是 ldap_id_mapping = False 导致 sssd 失败。我在这里找到了一个解决方案:https://bugzilla.redhat.com/show_bug.cgi?id=1116758。解决方案是从 /var/lib/sss/db/* 中删除所有内容,然后重新启动 sssd。这样做不仅允许 sssd 启动,而且它开始使用我期望的 UID/GID。 (4认同)