【问题标题】:RPC Authentication errorRPC 身份验证错误
【发布时间】:2012-10-18 04:39:09
【问题描述】:

上周我在使用 RPC,并且可以很好地运行我的 RPC 服务器程序。但是,今天我尝试再次启动它,但出现此错误:

无法注册服务:RPC:身份验证错误;为什么=客户 凭据太弱无法注册(X_PROG、X_VERS、udp)

谁能告诉我这个错误的原因是什么?

rpcinfo 给了我这个:

   program version netid     address                service    owner
    100000    4    tcp6      ::.0.111               portmapper superuser
    100000    3    tcp6      ::.0.111               portmapper superuser
    100000    4    udp6      ::.0.111               portmapper superuser
    100000    3    udp6      ::.0.111               portmapper superuser
    100000    4    tcp       0.0.0.0.0.111          portmapper superuser
    100000    3    tcp       0.0.0.0.0.111          portmapper superuser
    100000    2    tcp       0.0.0.0.0.111          portmapper superuser
    100000    4    udp       0.0.0.0.0.111          portmapper superuser
    100000    3    udp       0.0.0.0.0.111          portmapper superuser
    100000    2    udp       0.0.0.0.0.111          portmapper superuser
    100000    4    local     /run/rpcbind.sock      portmapper superuser
    100000    3    local     /run/rpcbind.sock      portmapper superuser

奇怪的是,过去一周我什至没有使用过这台电脑。 有没有应该运行的服务?

希望你能帮助我。 格茨·斯特凡

【问题讨论】:

    标签: authentication rpc


    【解决方案1】:

    此错误与 rpcbind 相关,因此您应该像这样停止服务端口映射:

    sudo -i service portmap stop
    

    然后

    sudo -i rpcbind -i -w
    

    在结束时启动服务端口图:

    sudo -i service portmap start
    

    【讨论】:

    • 值得一提的是 -i 是“不安全”模式,因此允许任何主机对已注册的程序进行 RPC。 (来自手册:“出于安全原因,通常 rpcbind 仅接受来自环回接口的这些请求。对于使用早期版本的 rpc 库编译并且不使用环回接口发出这些请求的程序,此更改是必要的。”)
    【解决方案2】:

    我意识到这是一个较旧的线程,但谷歌发现它在前 3 个结果中,人们仍在发现 nfs 服务错误。甚至 Red Hat 的 RHN 修复程序也不起作用。

    截至 2013 年 12 月,在 RHEL 6.4 (x64) 上并在 2013 年 11 月进行了修补,唯一的解决方案是更改 tcp_wrapper 配置文件的权限。因为我们对盒子进行了相当严格的保护,所以我们在 /etc/hosts.allow 和 /etc/hosts.deny 上拥有 640 的权限,这两个文件都归 root:root 所有。我们确实尝试给这些文件不同的组所有权,但在 nfs 启动时没有解决问题。

    一旦我们将 perms 放回“开箱即用”(644),nfs (rquotad) 服务就会按预期启动。或者,如果我们将 hosts.allow/deny 完全移开。

    想明白是多么痛苦啊。如果我早点查看,selinux 日志可能会有所帮助。

    现在,如果我们让 selinux 处于强制模式,这可能不是问题。我仍然需要验证这个理论。

    祝你好运。

    【讨论】:

      【解决方案3】:

      使更改在 Ubuntu12.04 上持久化 (假设使用 -i 运行 rpcbind 的安全隐患无关紧要):

      echo 'OPTIONS="-w -i"' | sudo tee /etc/default/rpcbind
      sudo service portmap restart
      

      【讨论】:

        【解决方案4】:

        又一个解决方案:CentOS 7.3 版

        除了 rpcbind,我还得在 /etc/hosts.allow 中允许 mountd:

        rpcbind : ALL : allow
        mountd : ALL : allow
        

        这最终让我不仅可以执行 rpcinfo,还可以执行 showmount 和 mount。

        【讨论】:

          【解决方案5】:

          到目前为止,这里介绍的解决方案都没有对我从 Debian Squeeze 升级到 Wheezy 有效。

          就我而言,我唯一要做的就是用“rpcbind”替换 /etc/hosts.allow 中所有出现的“portmapper”(或“portmap”,不再确定)。这就是全部了。 (否则 ypbind 无法通过 localhost 连接到 rpcbind。)

          【讨论】:

            【解决方案6】:

            如果使用 iptables 并且它阻止 localhost 的 UDP 连接,也会发生这种情况。今天碰到这个。停止 iptables,连接开始工作。

            你需要找出破坏它的规则。

            【讨论】:

              【解决方案7】:

              我认为值得一提的是,如果您看到以下错误:

              0-rpc-service: Could not register with portmap
              

              它可能与hosts.allow和hosts.deny文件设置有关,并且hosts.allow文件中缺少对localhost的权限。

              我在使用 GlusterFS 设置 NFS 时遇到了这种问题。

              在我添加的 /etc/hosts.allow 文件中:

              ALL: 127.0.0.1 : ALLOW
              

              使用 portmap 注册服务的问题消失了,一切正常。

              注意:使用 GlusterFS 记得重启 glusterd 服务

              /etc/init.d/glusterd restart
              

              【讨论】:

                【解决方案8】:

                我在 rhel7 上收到类似的错误:

                ypserv: Cannot register service: RPC: Authentication error; why = Client credential too weak  
                

                在启动 ypbind 时。我尝试了所有方法,包括上面的'-i'rpcbind。最后,正如 XTaran 提到的修改 /etc/hosts。允许添加此行:

                rpcbind: 127.0.0.1 
                

                为我工作。

                【讨论】:

                  【解决方案9】:

                  FWIW,这是一个“替代”解决方案。

                  1. 检查 /etc/hosts.deny 文件。它应该是这样的:
                  2. rpcbind mountd nfsd statd lockd rquotad : ALL
                  3. 确保此文件的最后一行有空白。
                  4. 检查 /etc/hosts.allow 文件。它应该是这样的:
                  5. rpcbind mountd nfsd statd lockd rquotad: 127.0.0.1 192.168.1.100
                  6. 确保此文件的最后一行有空白。

                  “诀窍”(对我而言)是文件中的最后一行空白。

                  【讨论】:

                    猜你喜欢
                    • 2014-06-20
                    • 1970-01-01
                    • 1970-01-01
                    • 1970-01-01
                    • 1970-01-01
                    • 2019-01-03
                    • 2012-05-16
                    • 2011-02-16
                    • 2013-11-28
                    相关资源
                    最近更新 更多