From d85bb59d57dcaf87b6d43b6612d52ffb98f21fe3 Mon Sep 17 00:00:00 2001 From: Robert Muir Date: Tue, 15 Dec 2015 01:04:37 -0500 Subject: [PATCH] fix smoke-test-plugins-ssl to work when ::1 does not resolve at all. My previous change only fixed it when it resolves to something different than localhost. But in some cases, it does not resolve at all, we must specify the IP. Original commit: elastic/x-pack-elasticsearch@547eb4c42fdc1d862e83d13f44b9f16f49403593 --- elasticsearch/qa/smoke-test-plugins-ssl/build.gradle | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/elasticsearch/qa/smoke-test-plugins-ssl/build.gradle b/elasticsearch/qa/smoke-test-plugins-ssl/build.gradle index 08899bc956f..2bda5811e46 100644 --- a/elasticsearch/qa/smoke-test-plugins-ssl/build.gradle +++ b/elasticsearch/qa/smoke-test-plugins-ssl/build.gradle @@ -20,11 +20,17 @@ task createKey(type: LoggedExec) { } String subjectAlternateNames = 'san=dns:localhost,ip:127.0.0.1' // some machines have a different name for ipv6 loopback, - // at least on ubuntu its ip6-localhost + // at least on ubuntu its ip6-localhost. other machines, like windows, + // won't resolve it back to any hostname at all. Try to setup ipv6 to + // work in all cases. try { String localhost6 = InetAddress.getByName("::1").getCanonicalHostName() if (!localhost6.equals("localhost")) { - subjectAlternateNames += ",dns:" + localhost6 + if (localhost6.startsWith("0")) { + subjectAlternateNames += ",ip:" + localhost6 + } else { + subjectAlternateNames += ",dns:" + localhost6 + } } } catch (UnknownHostException ok) { // e.g. no ipv6 support