【发布时间】:2017-03-22 10:37:35
【问题描述】:
我已经使用 Github Jenkins webhook 一段时间了,没有任何问题。 我的 Jenkins 在 Nginx 代理后面运行,唯一安装的安全性是 nginx htpasswd。 所以我的 Github webhook 看起来像这样:
https://user:pass@jenkins.blablabla.biz/job/script/buildWithParameters
成为用户并从 htpasswd 文件传递凭据。
现在我正在尝试将用户添加到我的 Jenkins 中,并且我激活了基于矩阵的安全性,并提供了注册和登录 Jenkins 的选项。 服务器在最初要求 nginx 凭据和 jenkins 登录时完美运行。
我在 Jenkins 中创建了一个 github 用户,并为他生成了一个令牌。 现在我更改了我的 Github webhook 以使用新的 Jenkins github 用户凭据:
https://github:token@jenkins.blablabla.biz/job/script/buildWithParameters
只要我知道这应该可行。但事实并非如此。 我认为这里的问题是激活了两个安全系统(nginx htpasswd 和 jenkins 登录)。但我两个都想要。
我是否必须在我的 webhook 中使用这两个凭据?我该怎么做?
当我使用 nginx 凭据时,Github 在 webhook 被触发时收到来自 jenkins 的此响应:
需要身份验证您的身份验证为:匿名 您所在的群组:您需要拥有(但没有)的权限: hudson.model.Hudson.Read ... 这暗示着: hudson.security.Permission.GenericRead ... 这暗示着: hudson.model.Hudson.Administer
当我使用 jenkins 凭证时,当 webhook 被触发时,Github 会收到来自 jenkins 的响应:
需要401授权
需要401授权
nginx/1.11.10
【问题讨论】: