2018-07-24 10:44:26 -04:00
|
|
|
import java.nio.file.Path
|
|
|
|
import java.nio.file.Paths
|
|
|
|
|
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'
|
|
|
|
|
2019-09-23 05:48:47 -04:00
|
|
|
testFixtures.useFixture ":test:fixtures:krb5kdc-fixture", "peppa"
|
2018-07-24 10:44:26 -04:00
|
|
|
|
|
|
|
dependencies {
|
2020-06-14 16:30:44 -04:00
|
|
|
testImplementation project(':x-pack:plugin:core')
|
|
|
|
testImplementation project(path: xpackModule('core'), configuration: 'testArtifacts')
|
|
|
|
testImplementation project(path: xpackModule('security'), configuration: 'testArtifacts')
|
2018-07-24 10:44:26 -04:00
|
|
|
}
|
|
|
|
|
2019-06-17 02:24:18 -04:00
|
|
|
testClusters.integTest {
|
2019-11-14 06:01:23 -05:00
|
|
|
testDistribution = 'DEFAULT'
|
|
|
|
// 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'
|
|
|
|
setting 'xpack.license.self_generated.type', 'trial'
|
|
|
|
setting 'xpack.security.enabled', 'true'
|
|
|
|
setting 'xpack.security.authc.realms.file.file1.order', '0'
|
|
|
|
setting 'xpack.ml.enabled', 'false'
|
|
|
|
setting 'xpack.security.audit.enabled', 'true'
|
|
|
|
setting 'xpack.security.authc.token.enabled', 'true'
|
|
|
|
// Kerberos realm
|
|
|
|
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'
|
|
|
|
|
|
|
|
|
|
|
|
systemProperty "java.security.krb5.conf", { project(':test:fixtures:krb5kdc-fixture').ext.krb5Conf("peppa").toString() }
|
|
|
|
systemProperty "sun.security.krb5.debug", "true"
|
|
|
|
|
|
|
|
extraConfigFile "es.keytab", project(':test:fixtures:krb5kdc-fixture').ext.krb5Keytabs("peppa", "HTTP_localhost.keytab")
|
|
|
|
|
|
|
|
user username: "test_admin", password: "x-pack-test-password"
|
|
|
|
user username: "test_kibana_user", password: "x-pack-test-password", role: "kibana_system"
|
2018-07-24 10:44:26 -04:00
|
|
|
}
|
|
|
|
|
2020-07-31 07:09:04 -04:00
|
|
|
tasks.register("copyKeytabToGeneratedResources", Copy) {
|
2019-11-14 06:01:23 -05:00
|
|
|
from project(':test:fixtures:krb5kdc-fixture').ext.krb5Keytabs("peppa", "peppa.keytab")
|
|
|
|
into "$buildDir/generated-resources/keytabs"
|
|
|
|
dependsOn project(':test:fixtures:krb5kdc-fixture').postProcessFixture
|
2019-06-26 17:24:36 -04:00
|
|
|
}
|
|
|
|
|
2019-03-28 11:23:40 -04:00
|
|
|
String realm = "BUILD.ELASTIC.CO"
|
2019-06-17 02:24:18 -04:00
|
|
|
integTest.runner {
|
2019-11-14 06:01:23 -05:00
|
|
|
Path peppaKeytab = Paths.get("${project.buildDir}", "generated-resources", "keytabs", "peppa.keytab")
|
|
|
|
nonInputProperties.systemProperty 'test.userkt', "peppa@${realm}"
|
|
|
|
nonInputProperties.systemProperty 'test.userkt.keytab', "${peppaKeytab}"
|
|
|
|
nonInputProperties.systemProperty 'test.userpwd', "george@${realm}"
|
|
|
|
systemProperty 'test.userpwd.password', "dino"
|
|
|
|
systemProperty 'tests.security.manager', 'true'
|
|
|
|
jvmArgs([
|
|
|
|
"-Djava.security.krb5.conf=${project(':test:fixtures:krb5kdc-fixture').ext.krb5Conf("peppa")}",
|
|
|
|
"-Dsun.security.krb5.debug=true"
|
|
|
|
])
|
|
|
|
classpath += copyKeytabToGeneratedResources.outputs.files
|
2018-07-24 10:44:26 -04:00
|
|
|
}
|