Samba,主机允许 = .example.com

Samba,主机允许 = .example.com

我试图将 Samba 共享的访问权限限制为 .example.com 域中的主机。但是当我尝试从该域中的主机进行连接时,却被拒绝了。

smb配置文件

[share1]
...
valid users = ralph
hosts allow = .example.com

Samba 日志

check_ntlm_password:  authentication for user [ralph] -> [ralph] -> [ralph] succeeded
Denied connection from 10.234.56.1 (10.234.56.1)

该 IP 地址有一个反向 DNS 记录。这让我怀疑 Samba 服务器是否真的在检查反向记录以查看主机是否在该域上。

如果我删除主机允许语句,共享将按预期工作。每次重新启动 smb 服务时,我都会重新启动 nmb 服务。

哪个组件负责执行 PTR 记录查找?

答案1

DNS 解析似乎不起作用。添加前三个三元组而不是域名作为hosts allow

hosts allow = 10.234.56

重新启动 samba 并再次尝试登录。

如果需要使用 DNS,则 Samba 中需要进行一些额外的配置:

7.3.4.4 DNS 代理

If you want the domain name service (DNS) to be used if a name isn't found in WINS, you can
set the following option:

[global]
    dns proxy = yes

还请检查以下内容:

7.3.4.5 名称解析顺序

The global name resolve order option specifies the order of services that Samba will use
in attempting name resolution. The default order is to use the LMHOSTS file, followed by
standard Unix name resolution methods (some combination of /etc/hosts, DNS, and NIS), then 
query a WINS server, and finally use broadcasting to determine the address of a NetBIOS name.
You can override this option by specifying something like the following:

[global]
    name resolve order = lmhosts wins hosts bcast

答案2

为了使主机允许使用主机名的条目正常工作,您需要启用

hostname lookups = yes

在smb.conf的全局配置中。

我无需进行任何 WINS 设置即可实现此功能。禁用 nmb 服务后测试共享继续有效。

相关内容