Samba winbind:如何从受信任的 AD 域进行身份验证(单向信任)?

Samba winbind:如何从受信任的 AD 域进行身份验证(单向信任)?

你好,Linux 新手。

我想要实现的目标:能够使用来自受信任域的 Active Directory 凭据登录 Linux 计算机。

我有以下设置:

                       +----------------+               +---------------+
+-----------+          |  Forest B      |               |   Forest A    |
|  User in  |          |                | one-way trust |               |
|  domain B +----------+  Domain B      +<--------------+    Domain A   |
|           |          |    b.net       |               |     a.net     |
+-----------+          |                |               |               |
                       |                |               |               |
                       +----------------+               +-------+-------+
                                                                |
                                                                |
                                                                |
                                                                |
                                                                |
                                                        +-------+-------+
                                                        |               |
                                                        |  Ubuntu 16.04 |
                                                        |  samba 4.7.12 |
                                                        |               |
                                                        |               |
                                                        |               |
                                                        +---------------+

我已使用 samba winbind 成功将我的 Ubuntu 16.04 添加到 Active Directory 域 A,但我无法使用域 B 中存在的用户帐户登录计算机。域 A 和域 B 是 Active Directory 域,并且它们具有单向信任这样域 A 信任域 B,但域 B 不信任域 A。

这是我的 smb.conf、krb5.conf 和 nsswitch.conf

/etc/samba/smb.conf

[global]
   workgroup = A
   security = ADS
   realm = A.NET
   encrypt passwords = yes
   idmap config *:range = 16777216-33554431
   allow trusted domains = yes

   winbind trusted domains only = no
   kerberos method = secrets and keytab
   winbind refresh tickets = yes

   template shell = /bin/bash
   server string = %h server (Samba, Ubuntu)
   dns proxy = no
   log file = /var/log/samba/log.%m
   max log size = 1000
   syslog = 0
   panic action = /usr/share/samba/panic-action %d
   server role = standalone server
   passdb backend = tdbsam
   obey pam restrictions = yes
   unix password sync = yes
   passwd program = /usr/bin/passwd %u
   passwd chat = *Enter\snew\s*\spassword:* %n\n *Retype\snew\s*\spassword:* %n\n *password\supdated\ssuccessfully* .
   pam password change = yes
   map to guest = bad user
   usershare allow guests = yes

[printers]
   comment = All Printers
   browseable = no
   path = /var/spool/samba
   printable = yes
   guest ok = no
   read only = yes
   create mask = 0700

[print$]
   comment = Printer Drivers
   path = /var/lib/samba/printers
   browseable = yes
   read only = yes
   guest ok = no

/etc/krb5.conf

[libdefaults]
        default_realm = A.NET
        dns_lookup_kdc = false
        krb4_config = /etc/krb.conf
        krb4_realms = /etc/krb.realms
        kdc_timesync = 1
        ccache_type = 4
        forwardable = true
        proxiable = true
        v4_instance_resolve = false
        v4_name_convert = {
                host = {
                        rcmd = host
                        ftp = ftp
                }
                plain = {
                        something = something-else
                }
        }
        fcc-mit-ticketflags = true

[realms]
        ATHENA.MIT.EDU = {
                kdc = kerberos.mit.edu:88
                kdc = kerberos-1.mit.edu:88
                kdc = kerberos-2.mit.edu:88
                admin_server = kerberos.mit.edu
                default_domain = mit.edu
        }
        MEDIA-LAB.MIT.EDU = {
                kdc = kerberos.media.mit.edu
                admin_server = kerberos.media.mit.edu
        }
        ZONE.MIT.EDU = {
                kdc = casio.mit.edu
                kdc = seiko.mit.edu
                admin_server = casio.mit.edu
        }
        MOOF.MIT.EDU = {
                kdc = three-headed-dogcow.mit.edu:88
                kdc = three-headed-dogcow-1.mit.edu:88
                admin_server = three-headed-dogcow.mit.edu
        }
        CSAIL.MIT.EDU = {
                kdc = kerberos-1.csail.mit.edu
                kdc = kerberos-2.csail.mit.edu
                admin_server = kerberos.csail.mit.edu
                default_domain = csail.mit.edu
                krb524_server = krb524.csail.mit.edu
        }
        IHTFP.ORG = {
                kdc = kerberos.ihtfp.org
                admin_server = kerberos.ihtfp.org
        }
        GNU.ORG = {
                kdc = kerberos.gnu.org
                kdc = kerberos-2.gnu.org
                kdc = kerberos-3.gnu.org
                admin_server = kerberos.gnu.org
        }
        1TS.ORG = {
                kdc = kerberos.1ts.org
                admin_server = kerberos.1ts.org
        }
        GRATUITOUS.ORG = {
                kdc = kerberos.gratuitous.org
                admin_server = kerberos.gratuitous.org
        }
        DOOMCOM.ORG = {
                kdc = kerberos.doomcom.org
                admin_server = kerberos.doomcom.org
        }
        ANDREW.CMU.EDU = {
                kdc = kerberos.andrew.cmu.edu
                kdc = kerberos2.andrew.cmu.edu
                kdc = kerberos3.andrew.cmu.edu
                admin_server = kerberos.andrew.cmu.edu
                default_domain = andrew.cmu.edu
        }
        CS.CMU.EDU = {
                kdc = kerberos.cs.cmu.edu
                kdc = kerberos-2.srv.cs.cmu.edu
                admin_server = kerberos.cs.cmu.edu
        }
        DEMENTIA.ORG = {
                kdc = kerberos.dementix.org
                kdc = kerberos2.dementix.org
                admin_server = kerberos.dementix.org
        }
        stanford.edu = {
                kdc = krb5auth1.stanford.edu
                kdc = krb5auth2.stanford.edu
                kdc = krb5auth3.stanford.edu
                master_kdc = krb5auth1.stanford.edu
                admin_server = krb5-admin.stanford.edu
                default_domain = stanford.edu
        }
        UTORONTO.CA = {
                kdc = kerberos1.utoronto.ca
                kdc = kerberos2.utoronto.ca
                kdc = kerberos3.utoronto.ca
                admin_server = kerberos1.utoronto.ca
                default_domain = utoronto.ca
        }
        A.NET = {
                admin_server = dc.a.net
                kdc = dc.a.net
        }
        B.NET = {
                admin_server = dc.b.net
                kdc = dc.b.net
        }

[domain_realm]
        .mit.edu = ATHENA.MIT.EDU
        mit.edu = ATHENA.MIT.EDU
        .media.mit.edu = MEDIA-LAB.MIT.EDU
        media.mit.edu = MEDIA-LAB.MIT.EDU
        .csail.mit.edu = CSAIL.MIT.EDU
        csail.mit.edu = CSAIL.MIT.EDU
        .whoi.edu = ATHENA.MIT.EDU
        whoi.edu = ATHENA.MIT.EDU
        .stanford.edu = stanford.edu
        .slac.stanford.edu = SLAC.STANFORD.EDU
        .toronto.edu = UTORONTO.CA
        .utoronto.ca = UTORONTO.CA
        a.net = A.NET
        .a.net = A.NET
        b.net = B.NET
        .b.net = .B.NET

[login]
        krb4_convert = true
        krb4_get_tickets = false

/etc/nsswitch.conf

passwd:         compat winbind
group:          compat winbind
shadow:         compat
gshadow:        files
hosts:          files dns
networks:       files
protocols:      db files
services:       db files
ethers:         db files
rpc:            db files
netgroup:       nis

大多数修改都是基于这些说明,尽管我将域 b 添加到了 krb5.conf 中:https://docs.citrix.com/en-us/linux-virtual-delivery-agent/7-15-ltsr/installation-overview/ubuntu.html

我尝试过以下 wbinfo 命令:

wbinfo --在线状态显示域 A 在线,但域 B 离线。

wbinfo -n B\管理员返回 SID,wbinfo -s SID 返回名称

wbinfo-m 内置 MYLINUX A B

wbinfo -KB\用户%密码返回以下错误消息:

wbcLogonUser(B\user): error code was NT_STATUS_NO_LOGON_SERVERS (0xc000005e)
error message was: No logon servers are currently available to service the logon request.
Could not authenticate user [B\user%password] with Kerberos (ccache: FILE)

如果有人能帮助我解决这个问题,我将非常感激。我该如何开始解决这个问题?

答案1

只有 Samba 4.8.x+ 支持这种信任。

我知道您唯一需要做的就是在以下部分中配置idmap受信任的域:[global]smb.conf

idmap config <trusted_domain> : backend = rid
idmap config <trusted_domain> : range = ?????- ?????

确保该范围不与您当前为(本地)域定义的范围重叠。

答案2

您忘记在 中添加 Kerberos 主体smb.conf。如果没有此参数,具有单向信任的用户将无法登录。

对于跨 DC 的 Kerberos 5 主体,请使用

[global]
winbind use krb5 enterprise principals = Yes

完整步骤在我的博客文章就此主题而言。

相关内容