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

相关文章

SpringBoot 异常处理/自定义格式校验的问题实例详解

《SpringBoot异常处理/自定义格式校验的问题实例详解》文章探讨SpringBoot中自定义注解校验问题,区分参数级与类级约束触发的异常类型,建议通过@RestControllerAdvice... 目录1. 问题简要描述2. 异常触发1) 参数级别约束2) 类级别约束3. 异常处理1) 字段级别约束

java内存泄漏排查过程及解决

《java内存泄漏排查过程及解决》公司某服务内存持续增长,疑似内存泄漏,未触发OOM,排查方法包括检查JVM配置、分析GC执行状态、导出堆内存快照并用IDEAProfiler工具定位大对象及代码... 目录内存泄漏内存问题排查1.查看JVM内存配置2.分析gc是否正常执行3.导出 dump 各种工具分析4.

Python错误AttributeError: 'NoneType' object has no attribute问题的彻底解决方法

《Python错误AttributeError:NoneTypeobjecthasnoattribute问题的彻底解决方法》在Python项目开发和调试过程中,经常会碰到这样一个异常信息... 目录问题背景与概述错误解读:AttributeError: 'NoneType' object has no at

Spring的RedisTemplate的json反序列泛型丢失问题解决

《Spring的RedisTemplate的json反序列泛型丢失问题解决》本文主要介绍了SpringRedisTemplate中使用JSON序列化时泛型信息丢失的问题及其提出三种解决方案,可以根据性... 目录背景解决方案方案一方案二方案三总结背景在使用RedisTemplate操作redis时我们针对

Spring Boot Maven 插件如何构建可执行 JAR 的核心配置

《SpringBootMaven插件如何构建可执行JAR的核心配置》SpringBoot核心Maven插件,用于生成可执行JAR/WAR,内置服务器简化部署,支持热部署、多环境配置及依赖管理... 目录前言一、插件的核心功能与目标1.1 插件的定位1.2 插件的 Goals(目标)1.3 插件定位1.4 核

SpringBoot整合Dubbo+ZK注册失败的坑及解决

《SpringBoot整合Dubbo+ZK注册失败的坑及解决》使用Dubbo框架时,需在公共pom添加依赖,启动类加@EnableDubbo,实现类用@DubboService替代@Service,配... 目录1.先看下公共的pom(maven创建的pom工程)2.启动类上加@EnableDubbo3.实

Kotlin Map映射转换问题小结

《KotlinMap映射转换问题小结》文章介绍了Kotlin集合转换的多种方法,包括map(一对一转换)、mapIndexed(带索引)、mapNotNull(过滤null)、mapKeys/map... 目录Kotlin 集合转换:map、mapIndexed、mapNotNull、mapKeys、map

nginx中端口无权限的问题解决

《nginx中端口无权限的问题解决》当Nginx日志报错bind()to80failed(13:Permissiondenied)时,这通常是由于权限不足导致Nginx无法绑定到80端口,下面就来... 目录一、问题原因分析二、解决方案1. 以 root 权限运行 Nginx(不推荐)2. 为 Nginx

解决1093 - You can‘t specify target table报错问题及原因分析

《解决1093-Youcan‘tspecifytargettable报错问题及原因分析》MySQL1093错误因UPDATE/DELETE语句的FROM子句直接引用目标表或嵌套子查询导致,... 目录报js错原因分析具体原因解决办法方法一:使用临时表方法二:使用JOIN方法三:使用EXISTS示例总结报错原

Windows环境下解决Matplotlib中文字体显示问题的详细教程

《Windows环境下解决Matplotlib中文字体显示问题的详细教程》本文详细介绍了在Windows下解决Matplotlib中文显示问题的方法,包括安装字体、更新缓存、配置文件设置及编码調整,并... 目录引言问题分析解决方案详解1. 检查系统已安装字体2. 手动添加中文字体(以SimHei为例)步骤