fix smoke-test-plugins-ssl to work with ip6-localhost

Original commit: elastic/x-pack-elasticsearch@747714b0d1
This commit is contained in:
Robert Muir 2015-12-14 22:48:56 -05:00
parent fbc8da8c4d
commit fb22b54202
3 changed files with 14 additions and 3 deletions

View File

@ -18,6 +18,17 @@ task createKey(type: LoggedExec) {
project.delete(keystore.parentFile)
keystore.parentFile.mkdirs()
}
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
try {
String localhost6 = InetAddress.getByName("::1").getCanonicalHostName()
if (!localhost6.equals("localhost")) {
subjectAlternateNames += ",dns:" + localhost6
}
} catch (UnknownHostException ok) {
// e.g. no ipv6 support
}
executable = 'keytool'
standardInput = new ByteArrayInputStream('FirstName LastName\nUnit\nOrganization\nCity\nState\nNL\nyes\n\n'.getBytes('UTF-8'))
args '-genkey',
@ -26,7 +37,7 @@ task createKey(type: LoggedExec) {
'-keyalg', 'RSA',
'-keysize', '2048',
'-validity', '712',
'-ext', 'san=dns:localhost,ip:127.0.0.1',
'-ext', subjectAlternateNames,
'-storepass', 'keypass'
}

View File

@ -3,7 +3,7 @@
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
package org.elasticsearch.watcher.test.rest;
package org.elasticsearch.smoketest;
import com.carrotsearch.randomizedtesting.annotations.Name;
import com.carrotsearch.randomizedtesting.annotations.ParametersFactory;

View File

@ -3,7 +3,7 @@
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
package org.elasticsearch.watcher.test.rest;
package org.elasticsearch.smoketest;
import org.elasticsearch.test.rest.RestTestCandidate;