将 Active Directory 与 IBM Spectrum LSF 集成
本教程为系统管理员提供了有关如何将 IBM Spectrum LSF 与 Active Directory 服务器集成为用户认证的主目录服务的详细步骤。 IBM Spectrum LSF 与 Active Directory 的集成支持高效的用户管理和访问控制。
在本教程中,您将学习如何:
- 使用 PowerShell 在 Windows Server 2019 上安装和配置 Active Directory 和 DNS 服务器
- 使用 Samba Winbind 将基于 RHEL 8.4 操作系统的 LSF 集群节点直接连接到 Active Directory,确保加密兼容性,并将集群节点连接到 Active Directory 域
准备工作
开始之前,请确保查看以下先决条件:
常规先决条件
-
要安装和配置 Active Directory 和 DNS 服务器,您需要:
- 具有管理特权的 Windows Server 2019 机器
- 基本熟悉 PowerShell 命令和 Windows Server 管理
-
要使用 Samba Winbind 将 RHEL 系统直接连接到 Active Directory,您需要:
- 能够运行 Samba Winbind 的 RHEL 系统
- 熟悉 RHEL 命令行界面和系统配置
- 对 Active Directory 域的访问权以及加入该域的相应许可权
网络先决条件
-
网络连接: 您需要 Windows Server 2019 机器 (安装了 Active Directory 和 DNS) 与连接到域的 RHEL 系统之间稳定可靠的网络连接。 验证是否没有网络通信问题或防火墙阻止基本端口。
-
防火墙规则: 复审并更新防火墙规则,以允许 Windows Server 2019 机器,RHEL 系统和域控制器之间进行必要的通信。 用于 Active Directory 通信的密钥端口包括 TCP/UDP 53 (DNS),TCP/UDP 88 (Kerberos),TCP 135 (RPC),TCP/UDP 389 (LDAP),TCP/UDP 445 (SMB) 和 TCP/UDP 636 (LDAPS)。
-
域控制器可访问性: 确认 RHEL 系统可以访问 Active Directory 域控制器,而不会发生任何连接问题。 使用
ping
或nslookup
之类的工具来验证是否能够从 RHEL 系统解析域控制器的主机名和 IP 地址。 -
时间同步: 确保参与 Active Directory 域的所有系统 (包括 Windows Server 2019 机器和 RHEL 系统) 的时钟与可靠的时间源同步。 时间同步对于正确认证和 Kerberos 凭单验证至关重要。
-
域 DNS 配置: Active Directory 域必须具有正确配置的 DNS 设置。 将域控制器的 IP 地址设置为属于 Active Directory 域的所有系统 (包括 Windows Server 2019 机器和 RHEL 系统) 上的主 DNS 服务器。
-
DNS 解析: 验证正向和反向 DNS 解析是否都正常工作。 域控制器的主机名必须可从 Windows Server 2019 机器和 RHEL 系统解析,而 Windows Server 2019 机器的主机名必须可从 RHEL 系统解析。
-
DNS 域名: 确保 Active Directory 的 DNS 域名与配置过程中使用的域名匹配。 在这种情况下,用于 Active Directory 的域名 "POCDOMAIN.LOCAL" 在整个配置中必须一致。
-
Active Directory 具有管理特权的用户帐户: 确保具有管理特权的 Active Directory 用户帐户在配置过程中可用。 此帐户用于将 Windows Server 2019 机器提升为域控制器,并将 RHEL 系统连接到 Active Directory 域。
安装和配置 Active Directory 和 DNS 服务器
完成以下步骤以在 Windows Server 2019 上安装和配置 Active Directory 服务和 DNS 服务器:
-
按键盘上的 Windows + X 键以访问 Power 用户 菜单。
-
从列表中,选择 Windows PowerShell (管理) 以使用管理特权启动提升的 PowerShell 会话。
-
要在 Windows Server 上安装 Active Directory 和 DNS 服务器的必需角色,请运行以下 PowerShell 命令:
# Install the Active Directory Domain Services role and DNS server role Install-WindowsFeature -Name AD-Domain-Services, DNS -IncludeManagementTools
-
要将服务器提升到具有集成 DNS 的域控制器,请运行以下 PowerShell 命令:
# Set the required parameters $DomainName = "POCDOMAIN.LOCAL" $SafeModePassword = ConvertTo-SecureString -AsPlainText "MySecureDSRMpwd2023!" -Force # Configure and promote the server as a domain controller with integrated DNS Install-ADDSForest -DomainName $DomainName -SafeModeAdministratorPassword $SafeModePassword -DomainMode Winthreshold -ForestMode Winthreshold -InstallDNS
- 示例域名:
POCDOMAIN.LOCAL
- 示例 DSRM 密码:
MySecureDSRMpwd2023!
- 示例域名:
-
运行 PowerShell 命令后,将在服务器上安装并配置 Active Directory 域服务和 DNS 服务器角色。 服务器将自动重新启动以完成域控制器提升过程。
验证配置
在服务器重新启动后,您可以使用在提升过程中创建的域管理员帐户登录。
要验证 Active Directory 和 DNS 的正确配置,请完成以下检查:
- 要验证 Active Directory 管理,请打开 服务器管理器,并在“仪表板”中确认是否存在 工具 部分中列出的“Active Directory 用户和计算机”和 "DNS"。 这指示已成功安装 Active Directory 和 DNS 管理工具。
- 要验证用户和组管理,请启动 Active Directory 用户和计算机 以管理域中的用户帐户,组和组织单元 (OU)。
- 要验证 DNS 管理,请访问 DNS Manager 以管理域的 DNS 区域和记录。
- 要验证客户机集成,请在同一网络中的客户机上配置 DNS 设置以指向新提升的域控制器的 IP 地址。 然后将客户机连接到
POCDOMAIN.LOCAL
域。 成功连接将确认正确的 DNS 解析和功能正常的 Active Directory 域服务。
现在,您已使用 PowerShell在 Windows Server 2019 上成功安装和配置了 Active Directory 和 DNS 服务器。 现在,具有集成 DNS 的新域控制器已准备好管理 POCDOMAIN.LOCAL
域中的用户帐户,计算机和其他网络资源。
在 Active Directory 中创建用户组和用户
要在 Active Directory 域 POCDOMAIN.LOCAL
中创建用户组 "LSF-group" 和用户 "lsfuser01",请在 Windows 服务器上使用 Active Directory 用户和计算机 (ADUC) 管理工具完成以下步骤:
在 POCDOMAIN.LOCAL
Active Directory 域中创建用户组和用户需要该域中的管理特权。 确保您具有创建组和用户所需的许可权。 在 Active Directory 中创建用户帐户和组以维护安全网络环境时,请始终设置强密码并遵循安全最佳实践。
- 打开 Active Directory 用户和计算机:
- 使用您的管理特权登录到 Windows 服务器。
- 单击 "启动并搜索"Active Directory 用户和计算机 "。
- 启动“Active Directory 用户和计算机”管理控制台。
- 创建名为 "LSF-group" 的用户组:
- 在 ADUC 控制台中,浏览到要在其中创建用户组的
POCDOMAIN.LOCAL
域中的组织单元 (OU)。 - 单击组织单元,然后选择“新建”,然后选择“组”。
- 在“新建对象-组”对话框中,输入 "LSF-group" 作为组名。
- 选择组作用域 (例如,全局) 和组类型 (例如,安全性)。
- 单击“确定”以创建 "LSF-group" 用户组。
- 在 ADUC 控制台中,浏览到要在其中创建用户组的
- 创建名为 "lsfuser01" 的用户:
- 在 ADUC 控制台中,浏览至要在其中创建用户 "lsfuser01" 的 "pocdomain.local" 域中的相同或不同的组织单元 (OU)。
- 单击 OU,然后选择“新建”,然后选择“用户”。
- 在“新建对象-用户”对话框中,输入新用户 "lsfuser01" 的必需信息。
- 单击“下一步”以继续执行任何额外步骤。
- 查看输入的信息,然后单击“完成”以创建新用户 "lsfuser01"。
- 将 "lsfuser01" 添加到 "LSF-group" 用户组:
- 在 ADUC 控制台中,找到先前创建的 "LSF-group" 用户组。
- 单击 "LSF-group" 用户组,然后选择“属性”。
- 在“属性”对话框中,转至“成员”选项卡。
- 单击“添加”,然后在“输入要选择的对象名”字段中输入 "lsfuser01"。
- 单击“检查名称”以验证用户名。
- 单击“确定”以将 "lsfuser01" 添加到 "LSF-group" 用户组。
- 单击“应用”,然后单击“确定”以保存更改。
使用 Samba Winbind 将 LSF 集群集成到 Active Directory
要将基于 RHEL 8.4-based 系统连接到 Active Directory,需要两个组件: Samba Winbind 和 realmd
。 Samba Winbind 与 Active Directory 身份和认证源交互,而 realmd
会检测可用域并配置底层 RHEL 系统服务。
用于直接集成的受支持 Windows 平台
与 Active Directory 森林的直接集成与以下森林和域功能级别兼容:
- 森林功能级别范围 :Windows Server 2008-Windows Server 2016
- 域功能级别范围 :Windows Server 2008-Windows Server 2016
用于直接集成的受支持操作系统:
- Windows Server 2022 (RHEL 8.7 和更高版本)
- Windows Server 2019
- Windows Server 2016
- Windows Server 2012 R2
Windows Server 2019 和 Windows Server 2022 不引入新的功能级别,使用 Windows Server 2016 的最高功能级别。
确保支持 Active Directory 和 RHEL 中的通用加密类型
缺省情况下,Samba Winbind 支持 RC4,AES-128和 AES-256 Kerberos 加密类型。 但是,由于安全考虑,不推荐使用 RC4 加密,缺省情况下将其禁用。 Active Directory 用户凭证和信任可能仍依赖于 RC4 加密,从而导致认证问题。
为了确保兼容性,您有两个选项:
- 在 Active Directory 中启用 AES 加密支持
- 在 RHEL 中启用 RC4 支持
要在 RHEL 中启用 RC4 支持,步骤因 RHEL 版本而异。 请参阅官方文档以获取详细指示信息 (RHEL 文档站点链接)。
将 LSF 集群节点连接到 Active Directory 域
要使用 Samba Winbind 和 realmd
将 RHEL 8.4 上托管的 LSF 集群节点连接到 Active Directory 域,请完成以下步骤:
Samba Winbind 是 System Security Services Daemon (SSSD) 的替代方法,用于将 RHEL 系统与 Active Directory连接。 本部分描述了如何通过使用 realmd
来配置 Samba Winbind,将 RHEL 系统连接到 Active Directory 域。
-
安装以下软件包:
# yum install realmd oddjob-mkhomedir oddjob samba-winbind-clients samba-winbind samba-common-tools samba-winbind-krb5-locator openldap-clients krb5-workstation samba adcli bind-utils
-
更新软件包:
# yum update
-
通过添加 Active Directory 域 IP 和名称来更新
/etc/hosts
:示例:
[root@amit-rhel84 ~]# cat /etc/hosts 127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 ::1 localhost localhost.localdomain localhost6 localhost6.localdomain6 10.243.0.39 addc1.POCDomain.local Note:- addc1.POCDomain.local is the AD server FQDN name
-
通过运行以下命令更新
/etc/resolv.conf
文件中的 DNS 条目:sudo nmcli connection modify "System eth0" ipv4.dns "10.243.0.39" ipv4.ignore-auto-dns yes
此命令不仅更新
/etc/resolv.conf
文件中的 DNS 条目,还确保 DNS 条目不会自动更新到基于云的 DNS 服务器。 -
确认 DNS 文件中的更改:
[root@amit-rhel84 ~]# cat /etc/resolv.conf # Generated by NetworkManager nameserver 10.240.0.39 [root@amit-rhel84 ~]#
然后使用 Active Directory 域对域控制器执行 ping 操作,例如:
[root@amit-rhel84 ~]# In addition to the confirmation, ping the Domain Controller with Name : - Ping POCDOMAIN.LOCAL [root@amit-rhel84 ~]# ping POCDOMAIN.LOCAL PING POCDOMAIN.LOCAL (10.240.0.39) 56(84) bytes of data. 64 bytes from addc1.POCDomain.local (10.240.0.39): icmp_seq=1 ttl=128 time=0.365 ms 64 bytes from addc1.POCDomain.local (10.240.0.39): icmp_seq=2 ttl=128 time=0.722 ms 64 bytes from addc1.POCDomain.local (10.240.0.39): icmp_seq=3 ttl=128 time=0.581 ms 64 bytes from addc1.POCDomain.local (10.240.0.39): icmp_seq=4 ttl=128 time=0.525 ms
-
运行
nslookup
以确保 Active Directory 域可解析,例如:[root@amit-rhel84 ~]# nslookup pocdomain.local Server: 10.240.0.39 Address: 10.240.0.39#53 Name: pocdomain.local Address: 10.240.0.39
-
如果 Active Directory 需要不推荐的 RC4 加密类型用于 Kerberos 认证,请在 RHEL 中启用对这些密码的支持:
# update-crypto-policies --set DEFAULT:AD-SUPPORT
运行该命令后,它将更新加密策略并要求重新启动机器。
-
现在需要备份现有
/etc/samba/smb.conf
Samba 配置文件:# mv /etc/samba/smb.conf /etc/samba/smb.conf.bak
-
将 RHEL 8.x 主机连接到 Active Directory 域。 以下示例连接名为
POCDOMAIN.LOCAL
的域:# realm join --membership-software=samba --client-software=winbind POCDOMAIN.LOCAL
运行此命令时,
realm
实用程序会自动执行以下操作:- 为
POCDOMAIN.LOCAL
域中的成员资格创建/etc/samba/smb.conf
文件 - 将用于用户和组查找的 Winbind 模块添加到
/etc/nsswitch.conf
文件 - 更新
/etc/pam.d/
目录中的可插拔认证模块 (PAM) 配置文件 - 启动 Winbind 服务,并使服务在系统引导时启动
- 为
-
(可选) 在
/etc/samba/smb.conf
文件中设置备用标识映射后端或定制标识映射设置。 有关更多信息,请参阅 了解和配置 Samba 标识映射。 -
编辑
/etc/krb5.conf
文件并添加以下部分:
[plugins]
localauth = {
module = winbind:/usr/lib64/samba/krb5/winbind_krb5_localauth.so
enable_only = winbind
}
- 验证 Winbind 服务是否正在运行:
# systemctl status winbind
示例请求和响应:
[root@amit-rhel84 ~]# systemctl status winbind
winbind.service - Samba Winbind Daemon
Loaded: loaded (/usr/lib/systemd/system/winbind.service; enabled; vendor preset: disabled)
Active: active (running) since Wed 2023-08-09 08:16:16 EDT; 1h 42min ago
Docs: man:winbindd(8)
man:samba(7)
man:smb.conf(5)
Main PID: 4889 (winbindd)
Status: "winbindd: ready to serve connections..."
Tasks: 5 (limit: 49264)
Memory: 10.9M
CGroup: /system.slice/winbind.service
├─4889 /usr/sbin/winbindd --foreground --no-process-group
├─4893 /usr/sbin/winbindd --foreground --no-process-group
├─4894 /usr/sbin/winbindd --foreground --no-process-group
├─4924 /usr/sbin/winbindd --foreground --no-process-group
└─5997 /usr/sbin/winbindd --foreground --no-process-group Important
要启用 Samba 以查询域用户和组信息,在启动 smb
之前,Winbind 服务必须正在运行。
- 如果安装了 Samba 软件包以共享目录和打印机,请启用并启动
smb
服务:
# systemctl enable --now smb ----tobe noted
- 确保在 `/etc/ssh/sshd_config`` 文件中将密码认证设置为 "yes",如以下示例中所示:
[root@amit-adclnt ~]# cat /etc/ssh/sshd_config | grep "PasswordAuth"
#PasswordAuthentication yes
PasswordAuthentication yes
# PasswordAuthentication. Depending on your PAM configuration,
# PAM authentication, then enable this but set PasswordAuthentication
验证集成
-
验证 Active Directory 用户的详细信息,例如 Active Directory 域中的 Active Directory 管理员帐户:
# getent passwd "POCDOMAIN\administrator"
示例输出:
POCDOMAIN\administrator:*:2000500:2000513::/home/administrator@POCDOMAIN:/bin/bash
-
验证 Active Directory 域中的域用户组中的成员:
# getent group "POCDOMAIN\Domain Users"
示例输出:
POCDOMAIN\domain users:x:10000:lsfuser01,user2
-
(可选) 验证在设置对文件和目录的许可权时是否可以使用域用户和组。 例如,要将
/srv/samba/example.txt
文件的所有者设置为AD\administrator
,并将组设置为AD\Domain Users
:# sudo chown "POCDOMAIN\administrator":"POCDOMAIN\Domain Users" example.txt
-
验证 Kerberos 认证是否按预期工作。 在 Active Directory 域成员上,获取
administrator@POCDOMAIN.LOCAL
主体的凭单:# kinit administrator@POCDOMAIN.LOCAL
显示高速缓存的 Kerberos 凭单:
# klist
示例输出:
Ticket cache: KCM:0 Default principal: Administrator@POCDOMAIN.LOCAL Valid starting Expires Service principal 07/10/2023 16:28:51 07/11/2023 02:28:51 krbtgt/POCDOMAIN.LOCAL@POCDOMAIN.LOCAL renew until 07/17/2023 16:28:46
-
显示可用域:
[root@rhelad01 ~]# realm list pocdomain.local type: kerberos realm-name: POCDOMAIN.LOCAL domain-name: pocdomain.local configured: kerberos-member server-software: active-directory client-software: winbind required-package: oddjob-mkhomedir required-package: oddjob required-package: samba-winbind-clients required-package: samba-winbind required-package: samba-common-tools login-formats: POCDOMAIN\%U login-policy: allow-any-login [root@rhelad01 ~]# wbinfo --all-domains BUILTIN RHELAD01 POCDOMAIN
如果您不想使用不推荐使用的 RC4 密码,那么可以在 Active Directory中启用 AES 加密类型。
在所有集群节点上重复上述步骤,以确保将所有这些节点都添加到 Active Directory 域。
向 Active Directory 用户提供 root 用户许可权
要向 Linux® 机器上 POCDOMAIN.LOCAL
域的 Active Directory 用户提供 root 用户许可权,请完成以下步骤:
-
打开终端或连接到 Linux® 机器。
-
使用
visudo
命令编辑sudoers
文件:sudo visudo
-
在
sudoers
文件中找到用于配置用户特权的部分:# Allow root to run any commands anywhere root ALL=(ALL) ALL
-
在 root 用户条目后添加以下行,以允许
POCDOMAIN\Domain Admins
组中的 Active Directory 用户使用 root 用户特权运行命令:%POCDOMAIN\\Domain\ Admins ALL=(ALL) ALL
此行向组
POCDOMAIN\Domain Admins
中的所有 Active Directory 用户授予 root 用户特权。 双反斜杠 ("") 用于对特殊字符进行转义。 -
保存对
sudoers
文件的更改并退出编辑器。 -
作为
POCDOMAIN\Domain Admins
组的成员的 Active Directory 用户现在可以使用sudo command
以 root 用户特权运行命令。 例如:sudo command_to_execute_as_root
出现提示时,Active Directory 用户必须输入自己的密码以进行认证,并使用提升的特权运行该命令。
向 Active Directory 用户授予 root 用户许可权时,请务必谨慎。 请务必仅将这些特权授予需要其执行特定任务的可信个人。 在此用例中,会将 root 用户特权授予在 Active Directory 环境中拥有最高特权的 Active Directory 域管理员。 定期查看用户特权并遵循安全最佳实践,有助于维护安全的系统环境。
配置 LSF 集群
配置 Active Directory 客户机认证后,需要配置 LSF 集群以添加 Active Directory的用户组:
-
以 LSF 管理员身份登录到集群中的任何主机。
-
打开
lsb.users
(/etc/opt/ibm/lsf/conf/lsbatch/HPCCLUSTER/comfigdir
)。 -
编辑 "UserGroup" 部分。 以下示例显示了
lsb.users
的 "UserGroup" 部分; 但是,如果您看到另一个 "UserGroup" 部分,那么可以使用此示例中的值 (从 LSF 集群服务器中获取) 创建新的部分:[root@ icgen2host-10-240-0-32 configdir]# cat lsb.users # $Revision$Date$ # After editing this file, run "badmin reconfig" to apply your changes. # User groups can be referenced by the lsb.hosts and lsb.queues files. # All the example definitions here are commented out # User group for lsf cluster administration Begin UserGroup GROUP_NAME PRIORITY GROUPMEMBER GROUP_ADMIN LSF-group 100 (lsfuser01 lsfuser05) (lsfuser01) #groupA 200 (user1 user2 user3 user4) (user5) #groupB 100 (groupA user5) (groupA) #groupC 50 (!) () End UserGroup # User group for all LSF administrators Begin UserGroup GROUP_NAME GROUP_MEMBER #USER_SHARES # Key words lsfadmins (lsfadmin ) Administrators (lsfuser03) #ldapusers (ldapuser01 ldapuser02) End UserGroup Note2: Define STRICT_UG_CONTROL=Y in lsb.params
-
要启用用户组管理员,请在
GROUP_ADMIN
列中指定用户或用户组,使用空格分隔用户和用户组,并将每个GROUP_ADMIN
条目括在方括号中。 -
保存更改。
-
运行
badmin ckconfig
以检查新的用户组定义。 如果报告了任何错误,请修正问题并再次检查配置。 -
运行
badmin reconfig
以重新配置集群。
管理 LSF 集群
-
使用 Active Directory 用户
POCDOMAIN\lsfuser01
登录,然后完成以下示例中提到的 LSF 集群任务:[POCDOMAIN\lsfuser01@icgen2host-10-240-0-32 ~]$ lshosts HOST_NAME type model cpuf ncpus maxmem maxswp server RESOURCES icgen2host- X86_64 Intel_E5 12.5 4 15.4G - Yes (mg) icgen2host- X86_64 Intel_E5 12.5 4 15.4G - Yes (mg) icgen2host- X86_64 Intel_E5 12.5 4 15.4G - Dyn () [POCDOMAIN\lsfuser01@icgen2host-10-240-0-32 ~]$ lsload HOST_NAME status r15s r1m r15m ut pg ls it tmp swp mem icgen2host-10-2 ok 0.0 0.0 0.0 1% 0.0 1 1 63G 0M 14.8G icgen2host-10-2 ok 0.0 0.0 0.0 0% 0.0 0 12818 76G 0M 14.8G icgen2host-10-2 ok 0.1 0.1 0.0 1% 0.0 0 12820 76G 0M 14.6G [POCDOMAIN\lsfuser01@icgen2host-10-240-0-32 root]$ lshosts HOST_NAME type model cpuf ncpus maxmem maxswp server RESOURCES icgen2host- X86_64 Intel_E5 12.5 4 15.4G - Yes (mg) icgen2host- X86_64 Intel_E5 12.5 4 15.4G - Yes (mg) icgen2host- X86_64 Intel_E5 12.5 4 15.4G - Dyn () icgen2host- X86_64 Intel_E5 12.5 - - - Dyn (icgen2host) icgen2host- X86_64 Intel_E5 12.5 - - - Dyn (icgen2host) icgen2host- X86_64 Intel_E5 12.5 - - - Dyn (icgen2host) icgen2host- X86_64 Intel_E5 12.5 - - - Dyn (icgen2host) [POCDOMAIN\lsfuser01@icgen2host-10-240-0-32 root]$ bjobs No unfinished job found [POCDOMAIN\lsfuser01@icgen2host-10-240-0-32 root]$ lsid IBM Spectrum LSF Standard 10.1.0.13, Jan 04 2023 Copyright International Business Machines Corp. 1992, 2016. US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp. My cluster name is HPCCluster My master name is icgen2host-10-240-0-35