2018-07-24 10:44:26 -04:00
|
|
|
import java.nio.file.Path
|
|
|
|
import java.nio.file.Paths
|
|
|
|
import java.nio.file.Files
|
|
|
|
|
|
|
|
apply plugin: 'elasticsearch.standalone-rest-test'
|
|
|
|
apply plugin: 'elasticsearch.rest-test'
|
2019-03-28 11:23:40 -04:00
|
|
|
apply plugin: 'elasticsearch.test.fixtures'
|
|
|
|
|
|
|
|
testFixtures.useFixture ":test:fixtures:krb5kdc-fixture"
|
2018-07-24 10:44:26 -04:00
|
|
|
|
2019-06-12 23:02:16 -04:00
|
|
|
integTest.enabled = true
|
2019-03-29 16:24:08 -04:00
|
|
|
|
2018-07-24 10:44:26 -04:00
|
|
|
dependencies {
|
2019-06-04 16:50:23 -04:00
|
|
|
testCompile project(':x-pack:plugin:core')
|
2018-07-24 10:44:26 -04:00
|
|
|
testCompile project(path: xpackModule('core'), configuration: 'testArtifacts')
|
|
|
|
testCompile project(path: xpackModule('security'), configuration: 'testArtifacts')
|
|
|
|
}
|
|
|
|
|
|
|
|
integTestCluster {
|
2018-07-31 22:57:33 -04:00
|
|
|
// force localhost IPv4 otherwise it is a chicken and egg problem where we need the keytab for the hostname when starting the cluster
|
|
|
|
// but do not know the exact address that is first in the http ports file
|
|
|
|
setting 'http.host', '127.0.0.1'
|
2018-07-24 10:44:26 -04:00
|
|
|
setting 'xpack.license.self_generated.type', 'trial'
|
|
|
|
setting 'xpack.security.enabled', 'true'
|
2018-11-29 02:06:52 -05:00
|
|
|
setting 'xpack.security.authc.realms.file.file1.order', '0'
|
2018-07-24 10:44:26 -04:00
|
|
|
setting 'xpack.ml.enabled', 'false'
|
|
|
|
setting 'xpack.security.audit.enabled', 'true'
|
|
|
|
// Kerberos realm
|
2018-11-29 02:06:52 -05:00
|
|
|
setting 'xpack.security.authc.realms.kerberos.kerberos.order', '1'
|
|
|
|
setting 'xpack.security.authc.realms.kerberos.kerberos.keytab.path', 'es.keytab'
|
|
|
|
setting 'xpack.security.authc.realms.kerberos.kerberos.krb.debug', 'true'
|
|
|
|
setting 'xpack.security.authc.realms.kerberos.kerberos.remove_realm_name', 'false'
|
2018-07-24 10:44:26 -04:00
|
|
|
|
2019-03-28 11:23:40 -04:00
|
|
|
jvmArgs += " -Djava.security.krb5.conf=${project(':test:fixtures:krb5kdc-fixture').ext.krb5Conf("peppa")}"
|
|
|
|
jvmArgs += " -Dsun.security.krb5.debug=true"
|
|
|
|
|
|
|
|
extraConfigFile("es.keytab", project(':test:fixtures:krb5kdc-fixture').ext.krb5Keytabs("peppa", "HTTP_localhost.keytab"))
|
2018-07-24 10:44:26 -04:00
|
|
|
|
|
|
|
setupCommand 'setupTestAdmin',
|
|
|
|
'bin/elasticsearch-users', 'useradd', "test_admin", '-p', 'x-pack-test-password', '-r', "superuser"
|
|
|
|
|
|
|
|
waitCondition = { node, ant ->
|
|
|
|
File tmpFile = new File(node.cwd, 'wait.success')
|
|
|
|
ant.get(src: "http://${node.httpUri()}/_cluster/health?wait_for_nodes=>=${numNodes}&wait_for_status=yellow",
|
|
|
|
dest: tmpFile.toString(),
|
|
|
|
username: 'test_admin',
|
|
|
|
password: 'x-pack-test-password',
|
|
|
|
ignoreerrors: true,
|
|
|
|
retries: 10)
|
|
|
|
return tmpFile.exists()
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2019-03-28 11:23:40 -04:00
|
|
|
String realm = "BUILD.ELASTIC.CO"
|
2018-07-24 10:44:26 -04:00
|
|
|
integTestRunner {
|
|
|
|
Path peppaKeytab = Paths.get("${project.buildDir}", "generated-resources", "keytabs", "peppa.keytab")
|
2019-06-12 23:02:16 -04:00
|
|
|
nonInputProperties.systemProperty 'test.userkt', "peppa@${realm}"
|
|
|
|
nonInputProperties.systemProperty 'test.userkt.keytab', "${peppaKeytab}"
|
|
|
|
nonInputProperties.systemProperty 'test.userpwd', "george@${realm}"
|
2018-07-24 10:44:26 -04:00
|
|
|
systemProperty 'test.userpwd.password', "dino"
|
|
|
|
systemProperty 'tests.security.manager', 'true'
|
2019-03-28 11:23:40 -04:00
|
|
|
jvmArgs([
|
|
|
|
"-Djava.security.krb5.conf=${project(':test:fixtures:krb5kdc-fixture').ext.krb5Conf("peppa")}",
|
|
|
|
"-Dsun.security.krb5.debug=true"
|
|
|
|
])
|
2018-07-24 10:44:26 -04:00
|
|
|
}
|
|
|
|
|
2019-03-28 11:23:40 -04:00
|
|
|
def generatedResources = "$buildDir/generated-resources/keytabs"
|
|
|
|
task copyKeytabToGeneratedResources(type: Copy) {
|
|
|
|
from project(':test:fixtures:krb5kdc-fixture').ext.krb5Keytabs("peppa", "peppa.keytab")
|
|
|
|
into generatedResources
|
|
|
|
dependsOn project(':test:fixtures:krb5kdc-fixture').postProcessFixture
|
2018-07-24 10:44:26 -04:00
|
|
|
}
|
2019-03-28 11:23:40 -04:00
|
|
|
project.sourceSets.test.output.dir(generatedResources, builtBy:copyKeytabToGeneratedResources)
|
|
|
|
|