【问题标题】:Configure Git with SSH for Phabricator使用 SSH 为 Phabricator 配置 Git
【发布时间】:2014-04-09 19:21:12
【问题描述】:

我正在尝试为 Phabricator 配置 SSH 以运行 git。我已经关注了这个manual,但是当我调用echo {} | ssh git@phabricator.mydomain.com conduit conduit.ping 时,我总是得到一个空结果或Permission denied (publickey,keyboard-interactive).。

/etc/ssh-phabricator/sshd_config:

AuthorizedKeysCommand /usr/libexec/ssh-phabricator-hook
AuthorizedKeysCommandUser git

Port 22
Protocol 2
PermitRootLogin no
AllowAgentForwarding no
AllowTcpForwarding no
PrintMotd no
PrintLastLog no
PasswordAuthentication no
AuthorizedKeysFile none

/etc/passwd:

phd:x:999:999::/var/tmp/phd:/bin/false
git:x:1005:1005::/home/git:/bin/bash

/etc/shadow:

phd:!:16135::::::
git:NP:16135:0:99999:7:::

/etc/sudoers:

git ALL=(phd) SETENV: NOPASSWD: /usr/bin/git-upload-pack, /usr/bin/git-receive-pack, /bin/false

~/.ssh/config:

Host phabricator.mydomain.com
    HostName phabricator.mydomain.com
    Port 22
    IdentityFile /c/Users/.../.ssh/id_rsa_phabricator
    PreferredAuthentications publickey
    User git

更新

我的问题的原因是:

  • 我没有在客户端使用 SSH 密钥。
  • 我没有确保git 用户有shell。

【问题讨论】:

  • secure.phabricator.com/T4151 中的一些信息尚未进入主文档,但可能会有所帮助。特别是,检查您的git 用户是否具有NP(不是!!)和/etc/shadow 中的/bin/sh(不是/bin/false)这样的真实shell。
  • 谢谢!这应该是文档的一部分。

标签: git ssh phabricator


【解决方案1】:

另外需要注意的是路径必须具有AuthorizedKeysCommand 的正确权限,否则这也可能导致

Permission denied (publickey,keyboard-interactive)

【讨论】:

    【解决方案2】:

    您的 ssh 挂钩工作正常 - 首先,您应该确保 git ssh 用户能够 ssh 到正常的 ssh 守护程序 - 这将确保您可以使用该用户登录。

    您很可能有一个错误的主目录或错误的 shell,如 cmets 中所述。

    如果一切正常,请确保您已将 ssh 密钥上传到您的个人资料,并且您正在使用此密钥进行连接。

    【讨论】:

      【解决方案3】:

      我遇到了

      Permission denied (publickey,keyboard-interactive)
      

      也有问题,发现了另一个此处尚未提及的原因:SELinux。

      如果您在服务器上使用带有“强制执行”策略的 SELinux,您可能会遇到同样的问题。要检查 SELinux 是否负责,请设置

      $ setenforce 0
      

      试试看

      $ echo {} | ssh git@phabricator.mydomain.com conduit conduit.ping
      

      再次。

      如果它突然工作,但您不想永久禁用 SELinux 或在许可模式下运行它,您可以使用 audit2allow 来解决您的服务器最近遇到的问题:

      $ ausearch -m avc -ts recent | audit2allow -M local
      $ semodule -i local.pp
      

      这个 ausearch 打印来自 SELinux 日志(通常是 /var/log/audit/audit.log )的最近条目,并且 audit2allow 为标记为 denied 的条目创建策略。 确保日志中没有您不想允许的最近条目。

      【讨论】:

        猜你喜欢
        • 2019-01-25
        • 2014-11-04
        • 1970-01-01
        • 1970-01-01
        • 2021-05-21
        • 2014-04-11
        • 2020-01-14
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多