Samba使用freeipa auth为Windows客户端访问cifs共享


0

TL; DR

我希望Windows客户端能够使用freeipa凭证访问samba共享。

问题

这是超级用户而不是服务器故障,因为它不是工作生产环境; 这是我的家庭网络。有许多使用GNU / Linux samba与Windows互操作的指南。但我不想拥有跨域信任(我的Windows AD域最终会消失)。

我可以将samba配置为指向freeipa(ipasam?ldapsam?),以便在我的Windows客户端上(我保留游戏)我可以使用“bgstack15@myfreeipadomain.example.com”连接到\ linuxserver \ sharename吗?

我知道如何配置samba以将现有的AD域用于加入域的GNU / Linux主机,但这不是我在这里做的。我的主机这次是freeipa域控制器,但我可能会将freeipa客户端作为我的文件服务器。我有其他Linux主机的nfs,但我对“nfs windows”的快速搜索没有显示任何比我想要的目标更好/更容易的东西。

可能性

  • 我可以使用ipasam或ldapsam后端吗?
  • 我可以将samba用作“Windows域控制器”并让它信任ipa域并映射用户吗?

9月7日更新

我找到了https://techslaves.org/2011/08/24/freeipa-and-samba-3-integration/,并按照其步骤显示如何修改freeipa的架构以包含samba属性。但我仍然得到错误:NT_STATUS_WRONG_PASSWORD。

Answers:


0

8个月后,我终于解决了这个问题!

Samba与freeipa auth分享

完整的信息集在https://bgstack15.wordpress.com/2017/05/10/samba-share-with-freeipa-auth/

在freeipa控制器上:

yum -y install ipa-server-trust-ad
ipa-adtrust-install --add-sids

运行--add-sids后,用户需要重置密码,以便freeipa生成密码的ipaNTHash值。

在samba服务器上:

yum -y install ipa-server-trust-ad

打开它要求的防火墙端口(TCP 135,138,139,445,1024-1300; UDP 138,139,389,445)

允许samba读取密码

ipa permission-add "CIFS server can read user passwords" \
   --attrs={ipaNTHash,ipaNTSecurityIdentifier} \
   --type=user --right={read,search,compare} --bindtype=permission
ipa privilege-add "CIFS server privilege"
ipa privilege-add-permission "CIFS server privilege" \
   --permission="CIFS server can read user passwords"
ipa role-add "CIFS server"
ipa role-add-privilege "CIFS server" --privilege="CIFS server privilege"
ipa role-add-member "CIFS server" --services=cifs/host2.vm.example.com

准备samba conf并重新启动samba。

tf=/etc/samba/smb.conf
touch "${tf}"; chmod 0644 "${tf}"; chown root:root "${tf}"; restorecon "${tf}"
cat < "${tf}"
[global]
    debug pid = yes
    realm = VM.EXAMPLE.COM
    workgroup = VM
    domain master = Yes
    ldap group suffix = cn=groups,cn=accounts
    ldap machine suffix = cn=computers,cn=accounts
    ldap ssl = off
    ldap suffix = dc=vm,dc=example,dc=com
    ldap user suffix = cn=users,cn=accounts
    log file = /var/log/samba/log
    max log size = 100000
    domain logons = Yes
    registry shares = Yes
    disable spoolss = Yes
    dedicated keytab file = FILE:/etc/samba/samba.keytab
    kerberos method = dedicated keytab
    #passdb backend = ipasam:ldapi://%2fvar%2frun%2fslapd-VM-EXAMPLE-COM.socket
    #passdb backend = ldapsam:ldapi://%2fvar%2frun%2fslapd-VM-EXAMPLE-COM.socket
    passdb backend = ipasam:ldap://host2.vm.example.com ldap://host1.vm.example.com
    security = USER
    create krb5 conf = No
    rpc_daemon:lsasd = fork
    rpc_daemon:epmd = fork
    rpc_server:tcpip = yes
    rpc_server:netlogon = external
    rpc_server:samr = external
    rpc_server:lsasd = external
    rpc_server:lsass = external
    rpc_server:lsarpc = external
    rpc_server:epmapper = external
    ldapsam:trusted = yes
    idmap config * : backend = tdb

    ldap admin dn = cn=Directory Manager

[homes]
    comment = Home Directories
    valid users = %S, %D%w%S
    browseable = No
    read only = No
    inherit acls = Yes
EOFCONF
systemctl restart smb.service
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.