Jenkins 插件 地址证书报错问题解决思路

2024-09-09 04:58

本文主要是介绍Jenkins 插件 地址证书报错问题解决思路,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

问题提示摘要:

SunCertPathBuilderException: unable to find valid certification path to requested target
......

网上很多的解决方式是更新站点的地址,我这里修改了一个日本的地址(清华镜像也好),其实发现是解决不了上述的报错问题的,其实,最终拉去插件的时候,会提示证书的问题,几经周折找到了其中一遍博文的方案,经实践是可行的,实践出真知。
之前我一直停留在 https 改成 http 的认知,但其实当你细心的看报错信息,其实提示的是证书问题。于是带着问题去找方案就好办了,感谢下属方案的博主分享。

解决方案:
配置Java SSL 访问网站证书

最近在开发 Java 访问 Azure ServiceBus 时遇到SSL证书问题,导致JAVA报错,不能正常访问,报错信息如下:

javax.net.ssl.SSLException: Connection has been shutdown: javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target

解决方法:配置要访问网站的域名证书,并导入的服务器jdk环境中

  1. 从https://github.com/escline/InstallCert下载InstallCert.java
  2. 编译javac InstallCert.java
  3. 运行InstallCert,参数是你调用的网址(Azure事件中心的地址),如果是80端口可以省略port
java InstallCert [host]:[port]例:java InstallCert abc.com:443

  运行后会列出证书让你选择,输入1回车,最后会在当前目录生成一个jssecacerts文件。

1. 导出证书文件

1)     使用CMD命令进入jssecacerts文件所在目录

2)     运行以下命令,导出证书文件:

keytool -exportcert -alias [host]-1 -keystore jssecacerts -storepass changeit -file [host].cer例:keytool -exportcert -alias www.abc.com-1 -keystore jssecacerts -storepass changeit -file www.abc.com.cer<br>

将证书文件导入系统keystore

keytool -importcert -alias [host] -keystore [path to system keystore] -storepass changeit -file [host].cer例:keytool -importcert -alias www.abc.com -keystore "C:\Program Files\Java\jre1.8.0_111\lib\security\cacerts" -storepass changeit -file www.abc.com.cer

 

# Example:java InstallCert woot.com:443Loading KeyStore /usr/lib/jvm/java-6-sun-1.6.0.26/jre/lib/security/cacerts...Opening connection to woot.com:443...Starting SSL handshake...javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target<...>Server sent 1 certificate(s):1 Subject O=Woot Inc, C=US, ST=Texas, L=Carrollton, CN=*.woot.comIssuer  CN=SecureTrust CA, O=SecureTrust Corporation, C=USsha1    4b 46 ca 6b 83 05 b3 51 ff c6 e7 9c fd b3 9b e3 3f 2e c4 53md5     e8 a5 88 1b d5 67 bb fc 88 cc b1 c5 2b ac c4 7dEnter certificate to add to trusted keystore or 'q' to quit: [1][enter][[Version: V3Subject: O=Woot Inc, C=US, ST=Texas, L=Carrollton, CN=*.woot.comSignature Algorithm: SHA1withRSA, OID = 1.2.840.113549.1.1.5<...>Added certificate to keystore 'jssecacerts' using alias 'woot.com-1'keytool -exportcert -alias woot.com-1 -keystore jssecacerts -storepass changeit -file woot.com.cerCertificate stored in file <woot.com.cer>(sudo) keytool -importcert -alias woot.com -keystore /usr/lib/jvm/java-6-sun-1.6.0.26/jre/lib/security/cacerts -storepass changeit -file woot.com.cerOwner: O=Woot Inc, C=US, ST=Texas, L=Carrollton, CN=*.woot.comIssuer: CN=SecureTrust CA, O=SecureTrust Corporation, C=US<...>Trust this certificate? [no]:yesCertificate was added to keystore

  

修改默认Jenkins插件源与连接检测位置(加速)

$ sed -i 's/http:\/\/updates.jenkins.io\/download/https:\/\/mirrors.tuna.tsinghua.edu.cn\/jenkins/g' /home/jenkins/root/updates/default.json
$ sed -i 's/http:\/\/www.google.com/https:\/\/www.baidu.com/g' /home/jenkins/root/updates/default.json

修改为清华镜像的文件下载:https://download.csdn.net/download/u013490585/12831832 

附件:https://github.com/mwanlyc/InstallCert
参考地址:https://www.cnblogs.com/oceanwang/p/6229789.html

这篇关于Jenkins 插件 地址证书报错问题解决思路的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/1150223

相关文章

如何解决idea的Module:‘:app‘platform‘android-32‘not found.问题

《如何解决idea的Module:‘:app‘platform‘android-32‘notfound.问题》:本文主要介绍如何解决idea的Module:‘:app‘platform‘andr... 目录idea的Module:‘:app‘pwww.chinasem.cnlatform‘android-32

kali linux 无法登录root的问题及解决方法

《kalilinux无法登录root的问题及解决方法》:本文主要介绍kalilinux无法登录root的问题及解决方法,本文给大家介绍的非常详细,对大家的学习或工作具有一定的参考借鉴价值,... 目录kali linux 无法登录root1、问题描述1.1、本地登录root1.2、ssh远程登录root2、

SpringBoot应用中出现的Full GC问题的场景与解决

《SpringBoot应用中出现的FullGC问题的场景与解决》这篇文章主要为大家详细介绍了SpringBoot应用中出现的FullGC问题的场景与解决方法,文中的示例代码讲解详细,感兴趣的小伙伴可... 目录Full GC的原理与触发条件原理触发条件对Spring Boot应用的影响示例代码优化建议结论F

Python中使用正则表达式精准匹配IP地址的案例

《Python中使用正则表达式精准匹配IP地址的案例》Python的正则表达式(re模块)是完成这个任务的利器,但你知道怎么写才能准确匹配各种合法的IP地址吗,今天我们就来详细探讨这个问题,感兴趣的朋... 目录为什么需要IP正则表达式?IP地址的基本结构基础正则表达式写法精确匹配0-255的数字验证IP地

MySQL 中查询 VARCHAR 类型 JSON 数据的问题记录

《MySQL中查询VARCHAR类型JSON数据的问题记录》在数据库设计中,有时我们会将JSON数据存储在VARCHAR或TEXT类型字段中,本文将详细介绍如何在MySQL中有效查询存储为V... 目录一、问题背景二、mysql jsON 函数2.1 常用 JSON 函数三、查询示例3.1 基本查询3.2

Pyserial设置缓冲区大小失败的问题解决

《Pyserial设置缓冲区大小失败的问题解决》本文主要介绍了Pyserial设置缓冲区大小失败的问题解决,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面... 目录问题描述原因分析解决方案问题描述使用set_buffer_size()设置缓冲区大小后,buf

PyInstaller打包selenium-wire过程中常见问题和解决指南

《PyInstaller打包selenium-wire过程中常见问题和解决指南》常用的打包工具PyInstaller能将Python项目打包成单个可执行文件,但也会因为兼容性问题和路径管理而出现各种运... 目录前言1. 背景2. 可能遇到的问题概述3. PyInstaller 打包步骤及参数配置4. 依赖

resultMap如何处理复杂映射问题

《resultMap如何处理复杂映射问题》:本文主要介绍resultMap如何处理复杂映射问题,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝赐教... 目录resultMap复杂映射问题Ⅰ 多对一查询:学生——老师Ⅱ 一对多查询:老师——学生总结resultMap复杂映射问题

解决SpringBoot启动报错:Failed to load property source from location 'classpath:/application.yml'

《解决SpringBoot启动报错:Failedtoloadpropertysourcefromlocationclasspath:/application.yml问题》这篇文章主要介绍... 目录在启动SpringBoot项目时报如下错误原因可能是1.yml中语法错误2.yml文件格式是GBK总结在启动S

Python获取C++中返回的char*字段的两种思路

《Python获取C++中返回的char*字段的两种思路》有时候需要获取C++函数中返回来的不定长的char*字符串,本文小编为大家找到了两种解决问题的思路,感兴趣的小伙伴可以跟随小编一起学习一下... 有时候需要获取C++函数中返回来的不定长的char*字符串,目前我找到两种解决问题的思路,具体实现如下: