Merge pull request elastic/elasticsearch#1138 from rmuir/ip6_localhost_2
fix smoke-test-plugins-ssl to work when ::1 does not resolve at all. Original commit: elastic/x-pack-elasticsearch@06ca563b74
This commit is contained in:
commit
1d5e5b6459
|
@ -20,11 +20,17 @@ task createKey(type: LoggedExec) {
|
||||||
}
|
}
|
||||||
String subjectAlternateNames = 'san=dns:localhost,ip:127.0.0.1'
|
String subjectAlternateNames = 'san=dns:localhost,ip:127.0.0.1'
|
||||||
// some machines have a different name for ipv6 loopback,
|
// 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 {
|
try {
|
||||||
String localhost6 = InetAddress.getByName("::1").getCanonicalHostName()
|
String localhost6 = InetAddress.getByName("::1").getCanonicalHostName()
|
||||||
if (!localhost6.equals("localhost")) {
|
if (!localhost6.equals("localhost")) {
|
||||||
subjectAlternateNames += ",dns:" + localhost6
|
if (localhost6.startsWith("0")) {
|
||||||
|
subjectAlternateNames += ",ip:" + localhost6
|
||||||
|
} else {
|
||||||
|
subjectAlternateNames += ",dns:" + localhost6
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} catch (UnknownHostException ok) {
|
} catch (UnknownHostException ok) {
|
||||||
// e.g. no ipv6 support
|
// e.g. no ipv6 support
|
||||||
|
|
Loading…
Reference in New Issue