如何使用Active Directory中的Kerberos设置NFS4服务器?
我可以安装和配置NFS4服务器并连接到它,但是在Active Directory控制KDC的任何情况下,我都无法让Kerberos工作。即使是在我自己安装的新安装的Windows中,也不是这样。
我用我为公司的Active Directory安装的服务器进行了大量调试,其中很多都是在这里记录的:Linux服务器如何实现setclientid? --对于一个带有Active Directory的新Windows服务器,结果是一样的--但令人惊讶的是(也许这并不奇怪)--如果我安装了其他类型的KDC,它就能工作。
我有一个工作服务器(就像Active Directory中的NFS4和Kerberos那样),它也是在运行CentOS 7.6.1810 --但是即使我把我做的所有事情都复制到那个服务器上,我也无法让它工作。
我使用了SSSD、PBIS和Kerberos的手动配置。
几乎所有事情都会导致“权限被拒绝”,似乎来自错误代码--来自RPC的13。我检查过的所有Kerberos票看上去都是正确的。
在NFS4 Linux7.6.1810发行版(Core)上配置CentOS服务器使用Active Directory中的Kerberos,需要采取哪些具体步骤?
发布于 2019-03-09 15:19:01
我在Linux (ubuntu)和FreeBSD上都使用了这种方法,所以我很确定它们在UN*X类系统中是相当通用的。
首先,您需要确保dns正常工作,主机名是正确的。确保没有指向127.0.1.1到hostname.domain.name的指针
此外,确保您的系统设置为使用nfs4与sec=krb5 (或krb5i或krb5p)。
您需要设置一个SPN以供nfs使用。有一个名为msktutil的unix命令可以处理它。它可能在centos有售。我知道它可以在ubuntu的标准回复中找到。请参阅https://github.com/msktutil/msktutil
我有一个脚本来处理这一切。
确保您已经加入了域,并且一切都按其应有的方式工作。(当然,除了角化nfs4。)我通常做以下几件事:
kinit Administrator
(enter password)klist应该显示您的管理员票证。
在运行脚本之前备份/etc/krb5.keytab。
之后,我运行以下脚本:(您将两次加入域,以便正确更新/etc/krb5.keytab。我不确定是否严格需要它。)
#!/bin/bash
HOST_NAME=`hostname -s`
DOMAIN_NAME=`hostname -d`
FULL_NAME=`hostname -A`
DC=your-dc.your.domain
kinit Administrator;
rm -f /etc/krb5.keytab
msktutil \
--delegation --dont-expire-password --no-pac --computer-name $HOST_NAME \
--enctypes 0x1F -b "OU=Services" -k /etc/krb5.keytab \
-h $HOST_NAME -s nfs/$FULL_NAME --upn nfs/$FULL_NAME --verbose
net ads join -k在那之后你应该准备好走了!(假设您的nfs-服务器设置正确。还有kerberos和其他一切。例如,在ubuntu18.04/etc/default/nfs-内核服务器上,我的系统上看起来是这样的。
# Number of servers to start up
RPCNFSDCOUNT=8
# Runtime priority of server (see nice(1))
RPCNFSDPRIORITY=0
# Options for rpc.mountd.
# If you have a port-based firewall, you might want to set up
# a fixed port here using the --port option. For more information,
# see rpc.mountd(8) or http://wiki.debian.org/SecuringNFS
# To disable NFSv4 on the server, specify '--no-nfs-version 4' here
RPCMOUNTDOPTS="--manage-gids"
# Do you want to start the svcgssd daemon? It is only required for Kerberos
# exports. Valid alternatives are "yes" and "no"; the default is "no".
NEED_SVCGSSD="yes"
# Options for rpc.svcgssd.
#RPCSVCGSSDOPTS=""
# Options for rpc.nfsd.
RPCNFSDOPTS=""
RPCSVCGSSDOPTS="-k /etc/krb5.keytab"我的/etc/idmapd.conf是这样的:
[General]
Verbosity = 1
Pipefs-Directory = /run/rpc_pipefs
# set your own domain here, if id differs from FQDN minus hostname.
# Domain = localdomain
Domain = my.domain
Local-Realms = MY.DOMAIN
[Mapping]
Nobody-User = nobody
Nobody-Group = nogroup
[Translation]
Method = nsswitch和/etc/default/nfs-常见的样子如下:(centos可能有类似的东西)
# If you do not set values for the NEED_ options, they will be attempted
# autodetected; this should be sufficient for most people. Valid alternatives
# for the NEED_ options are "yes" and "no".
# Options for rpc.statd.
# Should rpc.statd listen on a specific port? This is especially useful
# when you have a port-based firewall. To use a fixed port, set this
# this variable to a statd argument like: "--port 4000 --outgoing-port 4001".
# For more information, see rpc.statd(8)
STATDOPTS=
NEED_IDMAPD=yes
# Do you want to start the gssd daemon? It is required for Kerberos mounts.
NEED_GSSD=yes
RPCSVCGSSDOPTS="-k /etc/krb5.keytab"希望这能有所帮助!
https://serverfault.com/questions/945788
复制相似问题