403 ERR_ACCESS_DENIED 从 bitbucket webhook 到 jenkins

问题描述 投票:0回答:1

我在AWS EKS中设置了一个jenkins服务器。它在 EC2 上的私有子网中运行,并以内部 ALB 为前端。 ALB 具有安全组,允许来自我组织的 VPN 以及我在此站点上找到的位桶白名单 IP 的流量 (https://support.atlassian.com/organization-administration/docs/ip-addresses-and-domains-for -atlassian-cloud-products/#AtlassiancloudIPrangesanddomains-OutgoingConnections)和(https://support.atlassian.com/bitbucket-cloud/docs/what-are-the-bitbucket-cloud-ip-addresses-i-should-使用配置我的公司防火墙/)。

当我单击“立即构建”时,我可以从我的 jenkins 实例运行构建。但是,当我尝试从 bitbucket 推送触发构建时,我收到“ERR_ACCESS_DENIED 0”错误。

--></style>
</head><body id=ERR_ACCESS_DENIED>
<div id="titles">
<h1>ERROR</h1>
<h2>The requested URL could not be retrieved</h2>
</div>
<hr>

<div id="content">
<p>The following error was encountered while trying to retrieve the URL: <a href="https://jenkins-url/*">https://<jenkins-url>/*</a></p>

<blockquote id="error">
<p><b>Access Denied.</b></p>
</blockquote>

<p>Access control configuration prevents your request from being allowed at this time. Please contact your service provider if you feel this is incorrect.</p>

<p>Your cache administrator is <a href="mailto:webmaster">webmaster</a>.</p>
<br>
</div> 

我验证的事情:

  1. 我在 bitbucket 中为我的用户设置了一个新的应用程序密码,然后将该用户/通行证添加为 jenkins 中的凭据,并在“bitbucket 源”选项中提供它。
  2. 我检查了 ALB 中的访问日志,我可以看到源 IP 并确认它们是 SG 的一部分,并且我在日志中看到“forward”“=”“200”消息。
  3. 我将 bitbucket ips 的入口添加到我的 EC2 节点、EKS 集群、ALB SG
  4. 我从“查看请求”页面获取了所有标头和正文,并将它们放入邮递员并发送了“POST”请求,我得到了 200 OK。

还有什么我需要在这里做的吗?我缺少什么,请指教?

docker kubernetes jenkins amazon-ec2 bitbucket
1个回答
0
投票

据我了解,您

Jenkins
正在私有子网中运行,并且您正在通过内部ALB访问它。还提供了
Bitbucket
服务器 IP 的链接,告诉我您没有托管自己的
Bitbucket
服务器,因为这些是公共 IP,并在官方文档网站上列出。

在这种情况下,您将需要在公共子网中配置第二个负载均衡器,以便

Bitbucket
服务器将能够访问私有子网中的
Jenkins

官方配置示例

Jenkins
helm图表

ingress:
  enabled: true
  apiVersion: "networking.k8s.io/v1"
  annotations:
    nginx.ingress.kubernetes.io/force-ssl-redirect: "true"
  hostName: jenkins.xyz.com
  ingressClassName: internal-nginx
  tls:
    - secretName: tls-wildcard-xyz-com
      hosts:
        - jenkins.xyz.com
  secondaryingress:
  enabled: true
  paths:
    - /bitbucket-hook/
  apiVersion: "networking.k8s.io/v1"
  annotations:
    nginx.ingress.kubernetes.io/force-ssl-redirect: "true"
  hostName: jenkins-webhook.xyz.com
  ingressClassName: external-nginx
  tls:
    - secretName: tls-wildcard-xyz-com
      hosts:
        - jenkins-webhook.xyz.com

请记住,您无法从互联网访问私有子网中的资源。

© www.soinside.com 2019 - 2024. All rights reserved.