我已经在Active 10上安装了Debian目录角色的Samba 4.9.5-Debian。安装配置为SAMBA_ is DNS后端。当我试图连接到与域连接的Windows 10笔记本电脑与ldp.exe的LDAPS时,我会看到下面的错误。解密389很好。
ld = ldap_sslinit("smb-dc01", 636, 1);
Error 0 = ldap_set_option(hLdap, LDAP_OPT_PROTOCOL_VERSION, 3);
Error 81 = ldap_connect(hLdap, NULL);
Server error:
Error <0x51>: Fail to connect to smb-dc01.Ldp.exe中的Settings:
Connect ->
Server: smb-dc01
Port: 636
SSL: checked当尝试将LDAP与域连接机器连接时,DC日志/var/ log /samba/log.samba显示:
[2020/04/02 17:41:11.671421, 3] ../lib/ldb-samba/ldb_wrap.c:332(ldb_wrap_connect)
ldb_wrap open of secrets.ldb
[2020/04/02 17:41:11.695211, 3] ../source4/smbd/service_stream.c:67(stream_terminate_connection) stream_terminate_connection: Terminating connection - 'ldapsrv_accept_tls_loop: tstream_tls_accept_recv() - 32:Broken pipe'如果我将下面的行添加到Windows 10机器的主机文件中,那么机器将连接到LDAPS。
192.168.23.54 smb-dc01我不知道配置有什么问题。非域连接的机器在相同的设置下工作。非常奇怪的是,非域连接的机器比域连接的机器工作得更好。
Samba:上的K25配置文件
/etc/samba/smb.conf
# Global parameters
[global]
dns forwarder = 192.168.23.5
netbios name = SMB-DC01
realm = DM.EXAMPLE.COM
server role = active directory domain controller
workgroup = DM
idmap_ldb:use rfc2307 = yes
tls enabled = yes
tls keyfile = tls/smb-dc01.key
tls certfile = tls/smb-dc01-server.cer
tls cafile = tls/root-ca.cer
# Debugging / logging
# https://serverfault.com/questions/389166/how-to-debug-samba-authorization-authentication-procedure
log level = 3
[netlogon]
path = /var/lib/samba/sysvol/dm.example.com/scripts
read only = No
[sysvol]
path = /var/lib/samba/sysvol
read only = No/etc/drv.conf
domain dm.example.com
search dm.example.com
nameserver 192.168.23.54/etc/krb5.conf
[libdefaults]
default_realm = DM.EXAMPLE.COM
dns_lookup_realm = false
dns_lookup_kdc = true/etc/主机
127.0.0.1 localhost
192.168.23.54 smb-dc01.dm.example.com smb-dc01
# The following lines are desirable for IPv6 capable hosts
::1 localhost ip6-localhost ip6-loopback
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters无域连接的
我用两台不同的Windows 10机器进行了测试,一台连接到另一台域,另一台没有域。当DNS设置为指向Samba时,连接到LDAPS很好。
成功连接/断开连接的Log /var/log/samba/log.samba:
# Connect
[2020/04/02 17:38:17.646796, 3] ../lib/ldb-samba/ldb_wrap.c:332(ldb_wrap_connect)
ldb_wrap open of secrets.ldb
# Disconnect
[2020/04/02 17:39:42.623855, 2] ../source4/dsdb/kcc/kcc_periodic.c:785(kccsrv_samba_kcc)
Calling samba_kcc script
[2020/04/02 17:39:42.825060, 0] ../lib/util/util_runcmd.c:327(samba_runcmd_io_handler)
/usr/sbin/samba_kcc: ldb_wrap open of secrets.ldb
[2020/04/02 17:39:43.090504, 3] ../lib/util/util_runcmd.c:291(samba_runcmd_io_handler)
samba_runcmd_io_handler: Child /usr/sbin/samba_kcc exited 0
[2020/04/02 17:39:43.090585, 3] ../source4/dsdb/kcc/kcc_periodic.c:770(samba_kcc_done)
Completed samba_kcc OK
[2020/04/02 17:39:44.216277, 3] ../source4/smbd/service_stream.c:67(stream_terminate_connection)
stream_terminate_connection: Terminating connection - 'ldapsrv_call_wait_done: call->wait_recv() - NT_STATUS_LOCAL_DISCONNECT'发布于 2020-04-02 20:41:33
写一个结构良好的问题有助于自己思考。我发现在生成证书签名请求之前,需要在OpenSSL配置中向subjectAltNames添加完整的FQDN。
在下面的配置中,添加了DNS.2 = smb-dc01.dm.example.com。
smb-dc01-openssl.conf
[req]
default_bits = 2048
prompt = no
default_md = sha256
req_extensions = req_ext
distinguished_name = dn
[ dn ]
C=AT
ST=Wien
L=Wien
O=DM
OU=IT
emailAddress=it@example.com
CN = smb-dc01.dm.example.com
[ req_ext ]
subjectAltName = @alt_names
[ alt_names ]
DNS.1 = smb-dc01
DNS.2 = smb-dc01.dm.example.com
DNS.3 = smb-dc01.dm
DNS.4 = smb-dc01.example
DNS.5 = smb-dc01.example.com我使用此命令生成密钥和验证签名请求:
openssl req -out "smb-dc01.csr" -newkey rsa:2048 -nodes -keyout "smb-dc01.key" -config "smb-dc01-openssl.conf"我正在Win 2012 R2服务器上签名/生成一个证书,该服务器上安装了Certificate Authority服务。模板Web Server用于具有服务器身份验证(1.3.6.1.5.5.7.3.1)对象标识符(也称为OID)。
Document https://support.microsoft.com/en-us/help/321051/how-to-enable-ldap-over-ssl-with-a-third-party-certification-authority声明FQDN必须位于CN或Subject Alternative名称中,但似乎使用SambaADD4.9.5还需要在Subject Alternative名称中使用FQDN。
警告当证书包含其他名称时,所有常见名称都将被忽略。CA生成的较新证书甚至可能不包括任何常见名称。因此,将所有想要的主机名都包含在可选名称列表中。
https://serverfault.com/questions/1010634
复制相似问题