2018-07-24 10:44:26 -04:00
|
|
|
import java.nio.file.Path
|
|
|
|
import java.nio.file.Paths
|
|
|
|
import java.nio.file.Files
|
|
|
|
|
2019-06-17 02:24:18 -04:00
|
|
|
apply plugin: 'elasticsearch.testclusters'
|
2018-07-24 10:44:26 -04:00
|
|
|
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
|
|
|
|
|
|
|
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')
|
|
|
|
}
|
|
|
|
|
2019-06-17 02:24:18 -04:00
|
|
|
testClusters.integTest {
|
|
|
|
distribution = 'DEFAULT'
|
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'
|
2019-06-19 04:26:52 -04:00
|
|
|
setting 'xpack.security.authc.token.enabled', 'true'
|
2018-07-24 10:44:26 -04:00
|
|
|
// 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-06-17 02:24:18 -04:00
|
|
|
systemProperty "java.security.krb5.conf", { project(':test:fixtures:krb5kdc-fixture').ext.krb5Conf("peppa").toString() }
|
|
|
|
systemProperty "sun.security.krb5.debug", "true"
|
2018-07-24 10:44:26 -04:00
|
|
|
|
2019-06-17 02:24:18 -04:00
|
|
|
extraConfigFile "es.keytab", project(':test:fixtures:krb5kdc-fixture').ext.krb5Keytabs("peppa", "HTTP_localhost.keytab")
|
2018-07-24 10:44:26 -04:00
|
|
|
|
2019-06-17 02:24:18 -04:00
|
|
|
user username: "test_admin", password: "x-pack-test-password"
|
2019-06-19 04:26:52 -04:00
|
|
|
user username: "test_kibana_user", password: "x-pack-test-password", role: "kibana_system"
|
2018-07-24 10:44:26 -04:00
|
|
|
}
|
|
|
|
|
2019-06-26 17:24:36 -04:00
|
|
|
task copyKeytabToGeneratedResources(type: Copy) {
|
|
|
|
from project(':test:fixtures:krb5kdc-fixture').ext.krb5Keytabs("peppa", "peppa.keytab")
|
|
|
|
into "$buildDir/generated-resources/keytabs"
|
|
|
|
dependsOn project(':test:fixtures:krb5kdc-fixture').postProcessFixture
|
|
|
|
}
|
|
|
|
|
2019-03-28 11:23:40 -04:00
|
|
|
String realm = "BUILD.ELASTIC.CO"
|
2019-06-17 02:24:18 -04:00
|
|
|
integTest.runner {
|
2018-07-24 10:44:26 -04:00
|
|
|
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"
|
|
|
|
])
|
2019-06-26 17:24:36 -04:00
|
|
|
classpath += copyKeytabToGeneratedResources.outputs.files
|
2018-07-24 10:44:26 -04:00
|
|
|
}
|