简体   繁体   English

Windows Jenkins 服务器无法访问代理后面的插件中心

[英]Windows Jenkins Server Unable To Reach Plugin Center Behind Proxy

Summary概括

Currently, I am trying to install plugins on a windows Jenkins server running behind a proxy.目前,我正在尝试在代理后面运行的 windows Jenkins 服务器上安装插件。 As of now although, the proxy settings are set I am receiving a 403 error when I click the "Check now" button at the bottom of the Advanced tab under plugin manager.到目前为止,虽然代理设置已设置,但当我单击插件管理器下高级选项卡底部的“立即检查”按钮时,我收到 403 错误。

What I tried我试过的

I attempted several fixes.我尝试了几个修复。

  1. Added the proxy settings in the Plugin Manager Advanced tab.插件管理器高级选项卡中添加了代理设置。 With this included the "validate proxy" button returned an error.其中包括“验证代理”按钮返回错误。 I couldn't make out anything useful from the stack trace ( Stack trace listed below )我无法从堆栈跟踪中找出任何有用的东西(下面列出的堆栈跟踪
  2. Added the proxy settings in the jenkins.xml file and restarted the Jenkins service.jenkins.xml文件中添加代理设置并重启 Jenkins 服务。 ( Arguments added to the Jenkinsfile listed below ) Arguments 添加到下面列出的 Jenkinsfile 中
  3. I rebooted the server and validated that I am able to reach the same update center URL through the internet browser and via powershell.我重新启动服务器并验证我能够通过 Internet 浏览器和 powershell 访问相同的更新中心 URL。 However, jenkin's was still getting a 403 error even though these tests were ran from the same machine.但是,即使这些测试是在同一台机器上运行的,jenkin's 仍然会出现 403 错误。 ( Powershell command used to validate connectivity listed below ) Powershell 命令用于验证下面列出的连接

Stack trace from Plugin Manager>Advanced>Validate Proxy against https://www.google.com/来自插件管理器的堆栈跟踪>高级>针对https://www.google.com/验证代理

jenkins plugin proxy settings jenkins 插件代理设置

java.lang.NullPointerException
    at hudson.util.Secret$1.convert(Secret.java:306)
    at hudson.util.Secret$1.convert(Secret.java:304)
    at org.kohsuke.stapler.AnnotationHandler.convert(AnnotationHandler.java:66)
    at org.kohsuke.stapler.QueryParameter$HandlerImpl.parse(QueryParameter.java:74)
    at org.kohsuke.stapler.QueryParameter$HandlerImpl.parse(QueryParameter.java:62)
    at org.kohsuke.stapler.AnnotationHandler.handle(AnnotationHandler.java:91)
    at org.kohsuke.stapler.Function.bindAndInvoke(Function.java:204)
    at org.kohsuke.stapler.Function.bindAndInvokeAndServeResponse(Function.java:145)
    at org.kohsuke.stapler.MetaClass$11.doDispatch(MetaClass.java:535)
    at org.kohsuke.stapler.NameBasedDispatcher.dispatch(NameBasedDispatcher.java:58)
    at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:747)
    at org.kohsuke.stapler.Stapler.invoke(Stapler.java:878)
    at org.kohsuke.stapler.MetaClass$4.doDispatch(MetaClass.java:280)
    at org.kohsuke.stapler.NameBasedDispatcher.dispatch(NameBasedDispatcher.java:58)
    at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:747)
    at org.kohsuke.stapler.Stapler.invoke(Stapler.java:878)
    at org.kohsuke.stapler.Stapler.invoke(Stapler.java:676)
    at org.kohsuke.stapler.Stapler.service(Stapler.java:238)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
    at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:755)
    at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1617)
    at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:154)
    at jenkins.security.ResourceDomainFilter.doFilter(ResourceDomainFilter.java:76)
    at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:151)
    at jenkins.telemetry.impl.UserLanguages$AcceptLanguageFilter.doFilter(UserLanguages.java:128)
    at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:151)
    at hudson.util.PluginServletFilter.doFilter(PluginServletFilter.java:157)
    at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1604)
    at hudson.security.csrf.CrumbFilter.doFilter(CrumbFilter.java:153)
    at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1604)
    at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:84)
    at hudson.security.ChainedServletFilter.doFilter(ChainedServletFilter.java:90)
    at hudson.security.HudsonFilter.doFilter(HudsonFilter.java:171)
    at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1604)
    at org.kohsuke.stapler.compression.CompressionFilter.doFilter(CompressionFilter.java:49)
    at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1604)
    at hudson.util.CharacterEncodingFilter.doFilter(CharacterEncodingFilter.java:82)
    at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1604)
    at org.kohsuke.stapler.DiagnosticThreadNameFilter.doFilter(DiagnosticThreadNameFilter.java:30)
    at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1604)
    at jenkins.security.SuspiciousRequestFilter.doFilter(SuspiciousRequestFilter.java:36)
    at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1604)
    at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:545)
    at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)
    at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:566)
    at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127)
    at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:235)
    at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1610)
    at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:233)
    at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1300)
    at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:188)
    at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:485)
    at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1580)
    at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:186)
    at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1215)
    at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
    at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127)
    at org.eclipse.jetty.server.Server.handle(Server.java:500)
    at org.eclipse.jetty.server.HttpChannel.lambda$handle$1(HttpChannel.java:383)
    at org.eclipse.jetty.server.HttpChannel.dispatch(HttpChannel.java:547)
    at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:375)
    at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:273)
    at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:311)
    at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:103)
    at org.eclipse.jetty.io.ChannelEndPoint$2.run(ChannelEndPoint.java:117)
    at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.runTask(EatWhatYouKill.java:336)
    at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:313)
    at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.tryProduce(EatWhatYouKill.java:171)
    at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:129)
    at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:375)
    at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:806)
    at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:938)
    at java.lang.Thread.run(Unknown Source)

Values added to the arguments section of the jenkins.xml file添加到jenkins.xml文件的arguments部分的值

-Djdk.http.auth.tunneling.disabledSchemes="" -Dhttp.proxyUser=EXAMPLE\user -Dhttp.proxyPassword=EXAMPLEPASS -Dhttp.proxyHost=proxy.example.com -Dhttp.proxyPort=8080 -Dhttps.proxyHost=proxy.example.com -Dhttps.proxyPort=8080 -Dhttp.auth.ntlm.domain=true -Dcom.sun.net.ssl.checkRevocation=false

Powershell command used to successfully validate internet connectivity Powershell 命令用于成功验证互联网连接

Invoke-WebRequest -Uri https://www.google.com `
                  -Proxy http://proxy.example.com:8080 `
                  -ProxyCredential $(Get-Credential)

jenkins.err Log File jenkins.err日志文件

Too add some more context to the 403 error.也为403错误添加更多上下文。 403 as far as I'm aware suggests it is forbidden, however I do not get any 403 errors if I attempt to reach the site directly through the browser or powershell.据我所知,403 表明它是被禁止的,但是如果我尝试通过浏览器或 powershell 直接访问该站点,我不会收到任何 403 错误。 If I purposely enter the wrong proxy credentials I get a 407, but I'm able to reach the update center site, https://updates.jenkins.io/update-center.json through the browser and powershell with no errors returned. If I purposely enter the wrong proxy credentials I get a 407, but I'm able to reach the update center site, https://updates.jenkins.io/update-center.json through the browser and powershell with no errors returned.

2020-04-23 01:54:27.133+0000 [id=1] INFO    org.eclipse.jetty.util.log.Log#initialized: Logging initialized @578ms to org.eclipse.jetty.util.log.JavaUtilLog
2020-04-23 01:54:27.242+0000 [id=1] INFO    winstone.Logger#logInternal: Beginning extraction from war file
2020-04-23 01:54:27.273+0000 [id=1] WARNING o.e.j.s.handler.ContextHandler#setContextPath: Empty contextPath
2020-04-23 01:54:27.336+0000 [id=1] INFO    org.eclipse.jetty.server.Server#doStart: jetty-9.4.27.v20200227; built: 2020-02-27T18:37:21.340Z; git: a304fd9f351f337e7c0e2a7c28878dd536149c6c; jvm 1.8.0_144-b01
2020-04-23 01:54:27.820+0000 [id=1] INFO    o.e.j.w.StandardDescriptorProcessor#visitServlet: NO JSP Support for /, did not find org.eclipse.jetty.jsp.JettyJspServlet
2020-04-23 01:54:27.883+0000 [id=1] INFO    o.e.j.s.s.DefaultSessionIdManager#doStart: DefaultSessionIdManager workerName=node0
2020-04-23 01:54:27.883+0000 [id=1] INFO    o.e.j.s.s.DefaultSessionIdManager#doStart: No SessionScavenger set, using defaults
2020-04-23 01:54:27.883+0000 [id=1] INFO    o.e.j.server.session.HouseKeeper#startScavenging: node0 Scavenging every 600000ms
2020-04-23 01:54:28.273+0000 [id=1] INFO    hudson.WebAppMain#contextInitialized: Jenkins home directory: C:\Program Files (x86)\Jenkins found at: EnvVars.masterEnvVars.get("JENKINS_HOME")
2020-04-23 01:54:28.367+0000 [id=1] INFO    o.e.j.s.handler.ContextHandler#doStart: Started w.@2f59fa{Jenkins v2.222.1,/,file:///C:/Program%20Files%20(x86)/Jenkins/war/,AVAILABLE}{C:\Program Files (x86)\Jenkins\war}
2020-04-23 01:54:28.383+0000 [id=1] INFO    o.e.j.server.AbstractConnector#doStart: Started ServerConnector@bc464{HTTP/1.1, (http/1.1)}{0.0.0.0:8080}
2020-04-23 01:54:28.383+0000 [id=1] INFO    org.eclipse.jetty.server.Server#doStart: Started @1827ms
2020-04-23 01:54:28.383+0000 [id=19]    INFO    winstone.Logger#logInternal: Winstone Servlet Engine running: controlPort=disabled
2020-04-23 01:54:30.617+0000 [id=26]    INFO    jenkins.InitReactorRunner$1#onAttained: Started initialization
2020-04-23 01:54:30.648+0000 [id=25]    INFO    jenkins.InitReactorRunner$1#onAttained: Listed all plugins
2020-04-23 01:54:31.851+0000 [id=27]    INFO    jenkins.InitReactorRunner$1#onAttained: Prepared all plugins
2020-04-23 01:54:31.851+0000 [id=27]    INFO    jenkins.InitReactorRunner$1#onAttained: Started all plugins
2020-04-23 01:54:31.867+0000 [id=26]    INFO    jenkins.InitReactorRunner$1#onAttained: Augmented all extensions
2020-04-23 01:54:32.070+0000 [id=26]    INFO    jenkins.InitReactorRunner$1#onAttained: System config loaded
2020-04-23 01:54:32.070+0000 [id=26]    INFO    jenkins.InitReactorRunner$1#onAttained: System config adapted
2020-04-23 01:54:32.070+0000 [id=26]    INFO    jenkins.InitReactorRunner$1#onAttained: Loaded all jobs
2020-04-23 01:54:32.070+0000 [id=24]    INFO    jenkins.InitReactorRunner$1#onAttained: Configuration for all jobs updated
2020-04-23 01:54:32.086+0000 [id=40]    INFO    hudson.model.AsyncPeriodicWork#lambda$doRun$0: Started Download metadata
2020-04-23 01:54:32.101+0000 [id=40]    INFO    hudson.util.Retrier#start: Attempt #1 to do the action check updates server
2020-04-23 01:54:32.414+0000 [id=40]    INFO    hudson.util.Retrier#start: The attempt #1 to do the action check updates server failed with an allowed exception:
java.io.IOException: Server returned HTTP response code: 403 for URL: https://updates.jenkins.io/update-center.json?id=default&version=2.222.1
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(Unknown Source)
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
    at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(Unknown Source)
    at hudson.model.DownloadService.loadJSON(DownloadService.java:114)
    at hudson.model.UpdateSite.updateDirectlyNow(UpdateSite.java:208)
    at hudson.model.UpdateSite.updateDirectlyNow(UpdateSite.java:203)
    at hudson.PluginManager.checkUpdatesServer(PluginManager.java:1765)
    at hudson.util.Retrier.start(Retrier.java:63)
    at hudson.PluginManager.doCheckUpdatesServer(PluginManager.java:1736)
    at jenkins.DailyCheck.execute(DailyCheck.java:93)
    at hudson.model.AsyncPeriodicWork.lambda$doRun$0(AsyncPeriodicWork.java:100)
    at java.lang.Thread.run(Unknown Source)
2020-04-23 01:54:32.414+0000 [id=40]    INFO    hudson.util.Retrier#start: Calling the listener of the allowed exception 'Server returned HTTP response code: 403 for URL: https://updates.jenkins.io/update-center.json?id=default&version=2.222.1' at the attempt #1 to do the action check updates server
2020-04-23 01:54:32.414+0000 [id=40]    INFO    hudson.util.Retrier#start: Attempted the action check updates server for 1 time(s) with no success
2020-04-23 01:54:32.414+0000 [id=40]    SEVERE  hudson.PluginManager#doCheckUpdatesServer: Error checking update sites for 1 attempt(s). Last exception was: IOException: Server returned HTTP response code: 403 for URL: https://updates.jenkins.io/update-center.json?id=default&version=2.222.1
2020-04-23 01:54:32.414+0000 [id=40]    INFO    hudson.model.AsyncPeriodicWork#lambda$doRun$0: Finished Download metadata. 328 ms
2020-04-23 01:54:32.430+0000 [id=27]    INFO    jenkins.InitReactorRunner$1#onAttained: Completed initialization
2020-04-23 01:54:32.445+0000 [id=18]    INFO    hudson.WebAppMain$3#run: Jenkins is fully up and running

I had exactly same problem on freshly installed Jenkins 2.222.1.我在新安装的 Jenkins 2.222.1 上遇到了完全相同的问题。 It seem that this error is only due to "Validate proxy" button( I think this button does not like when authentication fields are not set) Indeed, when clicking on "submit" button, Jenkins were able to detect they was a newer version of Jenkins and installed it (so I suppose proxy config were ok).似乎这个错误只是由于“验证代理”按钮(我认为这个按钮在没有设置身份验证字段时不喜欢)确实,当点击“提交”按钮时,Jenkins 能够检测到它们是更新版本的Jenkins 并安装它(所以我想代理配置没问题)。 After accepting automatic upgrade in Jenkins in version 2.222.3, button "Validate proxy" is working fine now...在版本 2.222.3 中接受 Jenkins 中的自动升级后,“验证代理”按钮现在工作正常......

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM