|
94 | 94 | import org.jenkinsci.remoting.protocol.impl.ConnectionRefusalException;
|
95 | 95 | import org.jenkinsci.remoting.util.KeyUtils;
|
96 | 96 | import org.jenkinsci.remoting.util.VersionNumber;
|
| 97 | +import org.kohsuke.accmod.Restricted; |
| 98 | +import org.kohsuke.accmod.restrictions.NoExternalUse; |
97 | 99 |
|
98 | 100 | /**
|
99 | 101 | * Agent engine that proactively connects to Jenkins controller.
|
@@ -169,7 +171,7 @@ public Thread newThread(@NonNull final Runnable r) {
|
169 | 171 | private String proxyCredentials = System.getProperty("proxyCredentials");
|
170 | 172 |
|
171 | 173 | /**
|
172 |
| - * See {@link hudson.remoting.jnlp.Main#tunnel} for the documentation. |
| 174 | + * See {@link Launcher#tunnel} for the documentation. |
173 | 175 | */
|
174 | 176 | @CheckForNull
|
175 | 177 | private String tunnel;
|
@@ -885,7 +887,7 @@ private JnlpEndpointResolver createEndpointResolver(List<String> jenkinsUrls) {
|
885 | 887 | if (directConnection == null) {
|
886 | 888 | SSLSocketFactory sslSocketFactory = null;
|
887 | 889 | try {
|
888 |
| - sslSocketFactory = getSSLSocketFactory(); |
| 890 | + sslSocketFactory = getSSLSocketFactory(candidateCertificates); |
889 | 891 | } catch (Exception e) {
|
890 | 892 | events.error(e);
|
891 | 893 | }
|
@@ -1034,16 +1036,18 @@ private static FileInputStream getFileInputStream(final File file) throws Privil
|
1034 | 1036 | });
|
1035 | 1037 | }
|
1036 | 1038 |
|
1037 |
| - private SSLSocketFactory getSSLSocketFactory() |
| 1039 | + @CheckForNull |
| 1040 | + @Restricted(NoExternalUse.class) |
| 1041 | + static SSLSocketFactory getSSLSocketFactory(List<X509Certificate> x509Certificates) |
1038 | 1042 | throws PrivilegedActionException, KeyStoreException, NoSuchProviderException, CertificateException,
|
1039 | 1043 | NoSuchAlgorithmException, IOException, KeyManagementException {
|
1040 | 1044 | SSLSocketFactory sslSocketFactory = null;
|
1041 |
| - if (candidateCertificates != null && !candidateCertificates.isEmpty()) { |
| 1045 | + if (x509Certificates != null && !x509Certificates.isEmpty()) { |
1042 | 1046 | KeyStore keyStore = getCacertsKeyStore();
|
1043 | 1047 | // load the keystore
|
1044 | 1048 | keyStore.load(null, null);
|
1045 | 1049 | int i = 0;
|
1046 |
| - for (X509Certificate c : candidateCertificates) { |
| 1050 | + for (X509Certificate c : x509Certificates) { |
1047 | 1051 | keyStore.setCertificateEntry(String.format("alias-%d", i++), c);
|
1048 | 1052 | }
|
1049 | 1053 | // prepare the trust manager
|
|
0 commit comments