Jenkins-2.318安裝后插件下載時(shí)失敗

Jenkins(2020年及以后版本,2.260以上)安裝后,插件下載時(shí)失敗,摸索到了以下Jenkins安裝插件失敗的另一種解決方法俄认。

(Update Site的默認(rèn)URL不需要?jiǎng)樱?/p>

1|11.報(bào)錯(cuò)的首行提示:sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target

報(bào)錯(cuò)原因:訪問https的插件地址因?yàn)榘踩C書問題而報(bào)錯(cuò)。

1|22.解決方案:

echo -e "

/*

* Copyright 2006 Sun Microsystems, Inc.? All Rights Reserved.

*

* Redistribution and use in source and binary forms, with or without

* modification, are permitted provided that the following conditions

* are met:

*

*? - Redistributions of source code must retain the above copyright

*? ? notice, this list of conditions and the following disclaimer.

*

*? - Redistributions in binary form must reproduce the above copyright

*? ? notice, this list of conditions and the following disclaimer in the

*? ? documentation and/or other materials provided with the distribution.

*

*? - Neither the name of Sun Microsystems nor the names of its

*? ? contributors may be used to endorse or promote products derived

*? ? from this software without specific prior written permission.

*

* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS

* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,

* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR

* PURPOSE ARE DISCLAIMED.? IN NO EVENT SHALL THE COPYRIGHT OWNER OR

* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,

* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,

* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR

* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF

* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING

* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS

* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

*/

import java.io.BufferedReader;

import java.io.File;

import java.io.FileInputStream;

import java.io.FileOutputStream;

import java.io.InputStream;

import java.io.InputStreamReader;

import java.io.OutputStream;

import java.security.KeyStore;

import java.security.MessageDigest;

import java.security.cert.CertificateException;

import java.security.cert.X509Certificate;

import javax.net.ssl.SSLContext;

import javax.net.ssl.SSLException;

import javax.net.ssl.SSLSocket;

import javax.net.ssl.SSLSocketFactory;

import javax.net.ssl.TrustManager;

import javax.net.ssl.TrustManagerFactory;

import javax.net.ssl.X509TrustManager;

public class InstallCert {

? ? public static void main(String[] args) throws Exception {

? ? ? ? String host;

? ? ? ? int port;

? ? ? ? char[] passphrase;

? ? ? ? if ((args.length == 1) || (args.length == 2)) {

? ? ? ? ? ? String[] c = args[0].split(":");

? ? ? ? ? ? host = c[0];

? ? ? ? ? ? port = (c.length == 1) ? 443 : Integer.parseInt(c[1]);

? ? ? ? ? ? String p = (args.length == 1) ? "changeit" : args[1];

? ? ? ? ? ? passphrase = p.toCharArray();

? ? ? ? } else {

? ? ? ? ? ? System.out

? ? ? ? ? ? ? ? ? ? .println("Usage: java InstallCert <host>[:port] [passphrase]");

? ? ? ? ? ? return;

? ? ? ? }

? ? ? ? File file = new File("jssecacerts");

? ? ? ? if (file.isFile() == false) {

? ? ? ? ? ? char SEP = File.separatorChar;

? ? ? ? ? ? File dir = new File(System.getProperty("java.home") + SEP + "lib"

? ? ? ? ? ? ? ? ? ? + SEP + "security");

? ? ? ? ? ? file = new File(dir, "jssecacerts");

? ? ? ? ? ? if (file.isFile() == false) {

? ? ? ? ? ? ? ? file = new File(dir, "cacerts");

? ? ? ? ? ? }

? ? ? ? }

? ? ? ? System.out.println("Loading KeyStore " + file + "...");

? ? ? ? InputStream in = new FileInputStream(file);

? ? ? ? KeyStore ks = KeyStore.getInstance(KeyStore.getDefaultType());

? ? ? ? ks.load(in, passphrase);

? ? ? ? in.close();

? ? ? ? SSLContext context = SSLContext.getInstance("TLS");

? ? ? ? TrustManagerFactory tmf = TrustManagerFactory

? ? ? ? ? ? ? ? .getInstance(TrustManagerFactory.getDefaultAlgorithm());

? ? ? ? tmf.init(ks);

? ? ? ? X509TrustManager defaultTrustManager = (X509TrustManager) tmf

? ? ? ? ? ? ? ? .getTrustManagers()[0];

? ? ? ? SavingTrustManager tm = new SavingTrustManager(defaultTrustManager);

? ? ? ? context.init(null, new TrustManager[] { tm }, null);

? ? ? ? SSLSocketFactory factory = context.getSocketFactory();

? ? ? ? System.out

? ? ? ? ? ? ? ? .println("Opening connection to " + host + ":" + port + "...");

? ? ? ? SSLSocket socket = (SSLSocket) factory.createSocket(host, port);

? ? ? ? socket.setSoTimeout(10000);

? ? ? ? try {

? ? ? ? ? ? System.out.println("Starting SSL handshake...");

? ? ? ? ? ? socket.startHandshake();

? ? ? ? ? ? socket.close();

? ? ? ? ? ? System.out.println();

? ? ? ? ? ? System.out.println("No errors, certificate is already trusted");

? ? ? ? } catch (SSLException e) {

? ? ? ? ? ? System.out.println();

? ? ? ? ? ? e.printStackTrace(System.out);

? ? ? ? }

? ? ? ? X509Certificate[] chain = tm.chain;

? ? ? ? if (chain == null) {

? ? ? ? ? ? System.out.println("Could not obtain server certificate chain");

? ? ? ? ? ? return;

? ? ? ? }

? ? ? ? BufferedReader reader = new BufferedReader(new InputStreamReader(

? ? ? ? ? ? ? ? System.in));

? ? ? ? System.out.println();

? ? ? ? System.out.println("Server sent " + chain.length + " certificate(s):");

? ? ? ? System.out.println();

? ? ? ? MessageDigest sha1 = MessageDigest.getInstance("SHA1");

? ? ? ? MessageDigest md5 = MessageDigest.getInstance("MD5");

? ? ? ? for (int i = 0; i < chain.length; i++) {

? ? ? ? ? ? X509Certificate cert = chain[i];

? ? ? ? ? ? System.out.println(" " + (i + 1) + " Subject "

? ? ? ? ? ? ? ? ? ? + cert.getSubjectDN());

? ? ? ? ? ? System.out.println("? Issuer? " + cert.getIssuerDN());

? ? ? ? ? ? sha1.update(cert.getEncoded());

? ? ? ? ? ? System.out.println("? sha1? ? " + toHexString(sha1.digest()));

? ? ? ? ? ? md5.update(cert.getEncoded());

? ? ? ? ? ? System.out.println("? md5? ? " + toHexString(md5.digest()));

? ? ? ? ? ? System.out.println();

? ? ? ? }

? ? ? ? System.out

? ? ? ? ? ? ? ? .println("Enter certificate to add to trusted keystore or 'q' to quit: [1]");

? ? ? ? String line = reader.readLine().trim();

? ? ? ? int k;

? ? ? ? try {

? ? ? ? ? ? k = (line.length() == 0) ? 0 : Integer.parseInt(line) - 1;

? ? ? ? } catch (NumberFormatException e) {

? ? ? ? ? ? System.out.println("KeyStore not changed");

? ? ? ? ? ? return;

? ? ? ? }

? ? ? ? X509Certificate cert = chain[k];

? ? ? ? String alias = host + "-" + (k + 1);

? ? ? ? ks.setCertificateEntry(alias, cert);

? ? ? ? OutputStream out = new FileOutputStream("jssecacerts");

? ? ? ? ks.store(out, passphrase);

? ? ? ? out.close();

? ? ? ? System.out.println();

? ? ? ? System.out.println(cert);

? ? ? ? System.out.println();

? ? ? ? System.out

? ? ? ? ? ? ? ? .println("Added certificate to keystore 'jssecacerts' using alias '"

? ? ? ? ? ? ? ? ? ? ? ? + alias + "'");

? ? }

? ? private static final char[] HEXDIGITS = "0123456789abcdef".toCharArray();

? ? private static String toHexString(byte[] bytes) {

? ? ? ? StringBuilder sb = new StringBuilder(bytes.length * 3);

? ? ? ? for (int b : bytes) {

? ? ? ? ? ? b &= 0xff;

? ? ? ? ? ? sb.append(HEXDIGITS[b >> 4]);

? ? ? ? ? ? sb.append(HEXDIGITS[b & 15]);

? ? ? ? ? ? sb.append(' ');

? ? ? ? }

? ? ? ? return sb.toString();

? ? }

? ? private static class SavingTrustManager implements X509TrustManager {

? ? ? ? private final X509TrustManager tm;

? ? ? ? private X509Certificate[] chain;

? ? ? ? SavingTrustManager(X509TrustManager tm) {

? ? ? ? ? ? this.tm = tm;

? ? ? ? }

? ? ? ? public X509Certificate[] getAcceptedIssuers() {

? ? ? ? ? ? throw new UnsupportedOperationException();

? ? ? ? }

? ? ? ? public void checkClientTrusted(X509Certificate[] chain, String authType)

? ? ? ? ? ? ? ? throws CertificateException {

? ? ? ? ? ? throw new UnsupportedOperationException();

? ? ? ? }

? ? ? ? public void checkServerTrusted(X509Certificate[] chain, String authType)

? ? ? ? ? ? ? ? throws CertificateException {

? ? ? ? ? ? this.chain = chain;

? ? ? ? ? ? tm.checkServerTrusted(chain, authType);

? ? ? ? }

? ? }

}

" >> InstallCert.java

javac InstallCert.java

scp -rf *.class /usr/local/jdk1.8.0_91/jre/lib

java InstallCert mirrors.tuna.tsinghua.edu.cn

#出現(xiàn)提示后按1洪乍,回車眯杏,會(huì)生成jssecacerts 文件

cp jssecacerts /usr/local/jdk1.8.0_91/jre/lib/security/

service jenkins restart

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
  • 序言:七十年代末,一起剝皮案震驚了整個(gè)濱河市壳澳,隨后出現(xiàn)的幾起案子岂贩,更是在濱河造成了極大的恐慌,老刑警劉巖巷波,帶你破解...
    沈念sama閱讀 218,204評(píng)論 6 506
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件萎津,死亡現(xiàn)場離奇詭異卸伞,居然都是意外死亡,警方通過查閱死者的電腦和手機(jī)锉屈,發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 93,091評(píng)論 3 395
  • 文/潘曉璐 我一進(jìn)店門荤傲,熙熙樓的掌柜王于貴愁眉苦臉地迎上來,“玉大人颈渊,你說我怎么就攤上這事遂黍。” “怎么了俊嗽?”我有些...
    開封第一講書人閱讀 164,548評(píng)論 0 354
  • 文/不壞的土叔 我叫張陵雾家,是天一觀的道長。 經(jīng)常有香客問我绍豁,道長芯咧,這世上最難降的妖魔是什么? 我笑而不...
    開封第一講書人閱讀 58,657評(píng)論 1 293
  • 正文 為了忘掉前任妹田,我火速辦了婚禮唬党,結(jié)果婚禮上鹃共,老公的妹妹穿的比我還像新娘鬼佣。我一直安慰自己,他們只是感情好霜浴,可當(dāng)我...
    茶點(diǎn)故事閱讀 67,689評(píng)論 6 392
  • 文/花漫 我一把揭開白布晶衷。 她就那樣靜靜地躺著,像睡著了一般阴孟。 火紅的嫁衣襯著肌膚如雪晌纫。 梳的紋絲不亂的頭發(fā)上,一...
    開封第一講書人閱讀 51,554評(píng)論 1 305
  • 那天永丝,我揣著相機(jī)與錄音锹漱,去河邊找鬼。 笑死慕嚷,一個(gè)胖子當(dāng)著我的面吹牛哥牍,可吹牛的內(nèi)容都是我干的。 我是一名探鬼主播喝检,決...
    沈念sama閱讀 40,302評(píng)論 3 418
  • 文/蒼蘭香墨 我猛地睜開眼嗅辣,長吁一口氣:“原來是場噩夢啊……” “哼!你這毒婦竟也來了挠说?” 一聲冷哼從身側(cè)響起澡谭,我...
    開封第一講書人閱讀 39,216評(píng)論 0 276
  • 序言:老撾萬榮一對(duì)情侶失蹤,失蹤者是張志新(化名)和其女友劉穎损俭,沒想到半個(gè)月后蛙奖,有當(dāng)?shù)厝嗽跇淞掷锇l(fā)現(xiàn)了一具尸體潘酗,經(jīng)...
    沈念sama閱讀 45,661評(píng)論 1 314
  • 正文 獨(dú)居荒郊野嶺守林人離奇死亡,尸身上長有42處帶血的膿包…… 初始之章·張勛 以下內(nèi)容為張勛視角 年9月15日...
    茶點(diǎn)故事閱讀 37,851評(píng)論 3 336
  • 正文 我和宋清朗相戀三年雁仲,在試婚紗的時(shí)候發(fā)現(xiàn)自己被綠了崎脉。 大學(xué)時(shí)的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片。...
    茶點(diǎn)故事閱讀 39,977評(píng)論 1 348
  • 序言:一個(gè)原本活蹦亂跳的男人離奇死亡伯顶,死狀恐怖囚灼,靈堂內(nèi)的尸體忽然破棺而出,到底是詐尸還是另有隱情祭衩,我是刑警寧澤灶体,帶...
    沈念sama閱讀 35,697評(píng)論 5 347
  • 正文 年R本政府宣布,位于F島的核電站掐暮,受9級(jí)特大地震影響蝎抽,放射性物質(zhì)發(fā)生泄漏。R本人自食惡果不足惜路克,卻給世界環(huán)境...
    茶點(diǎn)故事閱讀 41,306評(píng)論 3 330
  • 文/蒙蒙 一樟结、第九天 我趴在偏房一處隱蔽的房頂上張望。 院中可真熱鬧精算,春花似錦瓢宦、人聲如沸。這莊子的主人今日做“春日...
    開封第一講書人閱讀 31,898評(píng)論 0 22
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽。三九已至廉嚼,卻和暖如春玫镐,著一層夾襖步出監(jiān)牢的瞬間,已是汗流浹背怠噪。 一陣腳步聲響...
    開封第一講書人閱讀 33,019評(píng)論 1 270
  • 我被黑心中介騙來泰國打工恐似, 沒想到剛下飛機(jī)就差點(diǎn)兒被人妖公主榨干…… 1. 我叫王不留,地道東北人傍念。 一個(gè)月前我還...
    沈念sama閱讀 48,138評(píng)論 3 370
  • 正文 我出身青樓矫夷,卻偏偏與公主長得像,于是被迫代替她去往敵國和親捂寿。 傳聞我的和親對(duì)象是個(gè)殘疾皇子口四,可洞房花燭夜當(dāng)晚...
    茶點(diǎn)故事閱讀 44,927評(píng)論 2 355

推薦閱讀更多精彩內(nèi)容