Default to basic license at startup (elastic/x-pack-elasticsearch#3878)

This is related to elastic/x-pack-elasticsearch#3877. This commit modifies the license settings to
default to self generating a basic license.

Original commit: elastic/x-pack-elasticsearch@cd6ee8e06f
This commit is contained in:
Tim Brooks 2018-02-12 12:57:04 -07:00 committed by GitHub
parent b95c971352
commit 5dbbe8fef8
34 changed files with 46 additions and 7 deletions

View File

@ -142,6 +142,7 @@ integTestCluster {
// Disable monitoring exporters for the docs tests
setting 'xpack.monitoring.exporters._local.type', 'local'
setting 'xpack.monitoring.exporters._local.enabled', 'false'
setting 'xpack.license.self_generated.type', 'trial'
setupCommand 'setupTestAdmin',
'bin/x-pack/users', 'useradd', 'test_admin', '-p', 'x-pack-test-password', '-r', 'superuser'
waitCondition = waitWithAuth

View File

@ -10,10 +10,10 @@ For more information, see
{xpack-ref}/license-management.html[{xpack} License Management].
`xpack.license.self_generated.type`::
Set to `trial` (default) to enable all {xpack} features. +
Set to `basic` (default) to enable basic {xpack} features. +
+
--
If set to `basic`, the self-generated license gives access only to the features
of a standard basic license. You can later upgrade the cluster to a trial
license.
If set to `trial`, the self-generated license gives access only to all the features
of a x-pack for 30 days. You can later downgrade the cluster to a basic license if
needed.
--

View File

@ -100,6 +100,7 @@ integTestCluster {
setting 'xpack.security.transport.ssl.keystore.path', nodeKeystore.name
setting 'xpack.security.transport.ssl.verification_mode', 'certificate'
setting 'xpack.security.audit.enabled', 'true'
setting 'xpack.license.self_generated.type', 'trial'
keystoreSetting 'bootstrap.password', 'x-pack-test-password'
keystoreSetting 'xpack.security.transport.ssl.keystore.secure_password', 'keypass'
distribution = 'zip' // this is important since we use the reindex module in ML

View File

@ -55,7 +55,7 @@ import java.util.concurrent.atomic.AtomicReference;
public class LicenseService extends AbstractLifecycleComponent implements ClusterStateListener, SchedulerEngine.Listener {
public static final Setting<String> SELF_GENERATED_LICENSE_TYPE = new Setting<>("xpack.license.self_generated.type",
(s) -> "trial", (s) -> {
(s) -> "basic", (s) -> {
if (validSelfGeneratedType(s)) {
return s;
} else {

View File

@ -51,7 +51,7 @@ public class LicensesTransportTests extends ESSingleNodeTestCase {
}
public void testEmptyGetLicense() throws Exception {
// trail license is added async, we should wait for it
// basic license is added async, we should wait for it
assertBusy(() -> {
try {
final ActionFuture<GetLicenseResponse> getLicenseFuture =
@ -59,7 +59,7 @@ public class LicensesTransportTests extends ESSingleNodeTestCase {
final GetLicenseResponse getLicenseResponse;
getLicenseResponse = getLicenseFuture.get();
assertNotNull(getLicenseResponse.license());
assertThat(getLicenseResponse.license().operationMode(), equalTo(License.OperationMode.TRIAL));
assertThat(getLicenseResponse.license().operationMode(), equalTo(License.OperationMode.BASIC));
} catch (Exception e) {
throw new RuntimeException("unexpected exception", e);
}

View File

@ -15,6 +15,7 @@ import org.elasticsearch.common.settings.Settings.Builder;
import org.elasticsearch.common.unit.TimeValue;
import org.elasticsearch.index.query.QueryBuilders;
import org.elasticsearch.index.query.ScriptQueryBuilder;
import org.elasticsearch.license.LicenseService;
import org.elasticsearch.plugins.Plugin;
import org.elasticsearch.script.MockScriptPlugin;
import org.elasticsearch.script.Script;
@ -137,6 +138,7 @@ public class GraphTests extends ESSingleNodeTestCase {
// Disable security otherwise authentication failures happen creating indices.
Builder newSettings = Settings.builder();
newSettings.put(super.nodeSettings());
newSettings.put(LicenseService.SELF_GENERATED_LICENSE_TYPE.getKey(), "trial");
// newSettings.put(XPackSettings.SECURITY_ENABLED.getKey(), false);
// newSettings.put(XPackSettings.MONITORING_ENABLED.getKey(), false);
// newSettings.put(XPackSettings.WATCHER_ENABLED.getKey(), false);

View File

@ -6,6 +6,7 @@
package org.elasticsearch.xpack.ml;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.license.LicenseService;
import org.elasticsearch.test.ESSingleNodeTestCase;
import org.elasticsearch.xpack.core.ml.MachineLearningField;
@ -19,6 +20,7 @@ public abstract class MlSingleNodeTestCase extends ESSingleNodeTestCase {
Settings.Builder newSettings = Settings.builder();
// Disable native ML autodetect_process as the c++ controller won't be available
newSettings.put(MachineLearningField.AUTODETECT_PROCESS.getKey(), false);
newSettings.put(LicenseService.SELF_GENERATED_LICENSE_TYPE.getKey(), "trial");
return newSettings.build();
}

View File

@ -21,6 +21,7 @@ import org.elasticsearch.common.unit.ByteSizeValue;
import org.elasticsearch.common.unit.TimeValue;
import org.elasticsearch.index.reindex.ReindexPlugin;
import org.elasticsearch.indices.recovery.RecoveryState;
import org.elasticsearch.license.LicenseService;
import org.elasticsearch.plugins.Plugin;
import org.elasticsearch.test.ESIntegTestCase;
import org.elasticsearch.test.discovery.TestZenDiscovery;
@ -79,6 +80,7 @@ public abstract class BaseMlIntegTestCase extends ESIntegTestCase {
settings.put(MachineLearningField.AUTODETECT_PROCESS.getKey(), false);
settings.put(XPackSettings.MACHINE_LEARNING_ENABLED.getKey(), true);
settings.put(XPackSettings.SECURITY_ENABLED.getKey(), false);
settings.put(LicenseService.SELF_GENERATED_LICENSE_TYPE.getKey(), "trial");
// settings.put(XPackSettings.WATCHER_ENABLED.getKey(), false);
// settings.put(XPackSettings.MONITORING_ENABLED.getKey(), false);
// settings.put(XPackSettings.GRAPH_ENABLED.getKey(), false);

View File

@ -30,6 +30,7 @@ import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.common.xcontent.json.JsonXContent;
import org.elasticsearch.gateway.GatewayService;
import org.elasticsearch.index.Index;
import org.elasticsearch.license.LicenseService;
import org.elasticsearch.plugins.Plugin;
import org.elasticsearch.xpack.core.XPackClient;
import org.elasticsearch.xpack.core.XPackSettings;
@ -206,6 +207,7 @@ public abstract class SecurityIntegTestCase extends ESIntegTestCase {
// builder.put(MachineLearningField.AUTODETECT_PROCESS.getKey(), false);
Settings customSettings = customSecuritySettingsSource.nodeSettings(nodeOrdinal);
builder.put(customSettings, false); // handle secure settings separately
builder.put(LicenseService.SELF_GENERATED_LICENSE_TYPE.getKey(), "trial");
Settings.Builder customBuilder = Settings.builder().put(customSettings);
if (customBuilder.getSecureSettings() != null) {
SecuritySettingsSource.addSecureSettings(builder, secureSettings ->

View File

@ -26,6 +26,7 @@ import org.elasticsearch.common.xcontent.XContentParser;
import org.elasticsearch.common.xcontent.json.JsonXContent;
import org.elasticsearch.common.xcontent.support.XContentMapValues;
import org.elasticsearch.index.query.QueryBuilder;
import org.elasticsearch.license.LicenseService;
import org.elasticsearch.license.XPackLicenseState;
import org.elasticsearch.plugins.Plugin;
import org.elasticsearch.script.MockMustacheScriptEngine;
@ -108,6 +109,7 @@ public abstract class AbstractWatcherIntegrationTestCase extends ESIntegTestCase
.put(super.nodeSettings(nodeOrdinal))
.put(XPackSettings.MONITORING_ENABLED.getKey(), false)
.put(XPackSettings.SECURITY_ENABLED.getKey(), false)
.put(LicenseService.SELF_GENERATED_LICENSE_TYPE.getKey(), "trial")
// we do this by default in core, but for watcher this isn't needed and only adds noise.
.put("index.store.mock.check_index_on_close", false)
// watcher settings that should work despite randomization

View File

@ -8,6 +8,7 @@ package org.elasticsearch.xpack.watcher.test.integration;
import org.elasticsearch.ExceptionsHelper;
import org.elasticsearch.action.search.SearchResponse;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.license.LicenseService;
import org.elasticsearch.plugins.Plugin;
import org.elasticsearch.script.MockMustacheScriptEngine;
import org.elasticsearch.test.ESSingleNodeTestCase;
@ -56,6 +57,7 @@ public class HipChatServiceTests extends ESSingleNodeTestCase {
return Settings.builder()
.put(super.nodeSettings())
.put(XPackSettings.WATCHER_ENABLED.getKey(), true)
.put(LicenseService.SELF_GENERATED_LICENSE_TYPE.getKey(), "trial")
// this is for the `test-watcher-integration` group level integration in HipChat
.put("xpack.notification.hipchat.account.integration_account.profile", "integration")

View File

@ -22,6 +22,7 @@ integTestCluster {
setting 'xpack.monitoring.enabled', 'false'
setting 'xpack.security.audit.enabled', 'true'
setting 'xpack.security.audit.outputs', 'index'
setting 'xpack.license.self_generated.type', 'trial'
setting 'logger.level', 'DEBUG'
setupCommand 'setupDummyUser',
'bin/x-pack/users', 'useradd', 'test_user', '-p', 'x-pack-test-password', '-r', 'superuser'

View File

@ -11,6 +11,7 @@ integTestCluster {
setting 'xpack.monitoring.enabled', 'false'
setting 'xpack.watcher.enabled', 'false'
setting 'xpack.ml.enabled', 'true'
setting 'xpack.license.self_generated.type', 'trial'
numNodes = 3
distribution = 'zip'
plugin xpackProject('plugin').path

View File

@ -59,6 +59,7 @@ integTestCluster {
setting 'xpack.security.transport.ssl.keystore.path', nodeKeystore.name
setting 'xpack.security.transport.ssl.verification_mode', 'certificate'
setting 'xpack.security.audit.enabled', 'true'
setting 'xpack.license.self_generated.type', 'trial'
plugin xpackProject('plugin').path
keystoreSetting 'bootstrap.password', 'x-pack-test-password'

View File

@ -8,5 +8,6 @@ dependencies {
integTestCluster {
setting 'xpack.security.enabled', 'false'
setting 'xpack.license.self_generated.type', 'trial'
plugin xpackProject('plugin').path
}

View File

@ -20,6 +20,7 @@ remoteClusterTestCluster {
setting 'xpack.watcher.enabled', 'false'
setting 'xpack.monitoring.enabled', 'false'
setting 'xpack.ml.enabled', 'false'
setting 'xpack.license.self_generated.type', 'trial'
setupCommand 'setupDummyUser',
'bin/x-pack/users', 'useradd', 'test_user', '-p', 'x-pack-test-password', '-r', 'superuser'
waitCondition = { node, ant ->
@ -46,6 +47,7 @@ mixedClusterTestCluster {
setting 'xpack.watcher.enabled', 'false'
setting 'xpack.monitoring.enabled', 'false'
setting 'xpack.ml.enabled', 'false'
setting 'xpack.license.self_generated.type', 'trial'
setupCommand 'setupDummyUser',
'bin/x-pack/users', 'useradd', 'test_user', '-p', 'x-pack-test-password', '-r', 'superuser'
waitCondition = { node, ant ->

View File

@ -13,6 +13,7 @@ integTestCluster {
// Whitelist reindexing from the local node so we can test it.
setting 'reindex.remote.whitelist', '127.0.0.1:*'
setting 'xpack.ml.enabled', 'false'
setting 'xpack.license.self_generated.type', 'trial'
extraConfigFile 'x-pack/roles.yml', 'roles.yml'
[
test_admin: 'superuser',

View File

@ -21,6 +21,7 @@ integTestRunner {
integTestCluster {
plugin xpackProject('plugin').path
setting 'xpack.ml.enabled', 'false'
setting 'xpack.license.self_generated.type', 'trial'
setupCommand 'setupDummyUser',
'bin/x-pack/users', 'useradd', 'test_user', '-p', 'x-pack-test-password', '-r', 'superuser'
setupCommand 'setupTransportClientUser',

View File

@ -29,6 +29,7 @@ integTestCluster {
setting 'xpack.security.authc.realms.native.order', '2'
setting 'xpack.ml.enabled', 'false'
setting 'xpack.monitoring.enabled', 'false'
setting 'xpack.license.self_generated.type', 'trial'
// This is important, so that all the modules are available too.
// There are index templates that use token filters that are in analysis-module and

View File

@ -9,6 +9,7 @@ dependencies {
integTestCluster {
plugin xpackProject('plugin').path
setting 'xpack.license.self_generated.type', 'trial'
extraConfigFile 'x-pack/roles.yml', 'roles.yml'
[
test_admin: 'superuser',

View File

@ -15,6 +15,7 @@ integTestCluster {
plugin xpackProject('plugin').path
setupCommand 'setupTestAdmin',
'bin/x-pack/users', 'useradd', "test_admin", '-p', 'x-pack-test-password', '-r', "superuser"
setting 'xpack.license.self_generated.type', 'trial'
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",

View File

@ -22,6 +22,7 @@ integTestCluster {
'bin/x-pack/users', 'useradd', 'graph_explorer', '-p', 'x-pack-test-password', '-r', 'graph_explorer'
setupCommand 'setupPowerlessUser',
'bin/x-pack/users', 'useradd', 'no_graph_explorer', '-p', 'x-pack-test-password', '-r', 'no_graph_explorer'
setting 'xpack.license.self_generated.type', 'trial'
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",

View File

@ -102,6 +102,7 @@ integTestCluster {
'bin/x-pack/users', 'useradd', 'ml_user', '-p', 'x-pack-test-password', '-r', 'minimal,machine_learning_user'
setupCommand 'setupPowerlessUser',
'bin/x-pack/users', 'useradd', 'no_ml', '-p', 'x-pack-test-password', '-r', 'minimal'
setting 'xpack.license.self_generated.type', 'trial'
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",

View File

@ -13,6 +13,7 @@ integTestCluster {
setting 'xpack.watcher.enabled', 'true'
setting 'xpack.security.enabled', 'false'
setting 'xpack.ml.enabled', 'false'
setting 'xpack.license.self_generated.type', 'trial'
// exporter settings are configured dynamically in our tests
// configure a local exporter, the HTTP exporter is configured via dynamic settings change

View File

@ -11,6 +11,7 @@ integTestCluster {
plugin xpackProject('plugin').path
setting 'xpack.watcher.enabled', 'false'
setting 'xpack.monitoring.enabled', 'false'
setting 'xpack.license.self_generated.type', 'trial'
setupCommand 'setupDummyUser',
'bin/x-pack/users', 'useradd', 'test_admin', '-p', 'x-pack-test-password', '-r', 'superuser'
waitCondition = { node, ant ->

View File

@ -11,4 +11,5 @@ integTestCluster {
plugin xpackProject('plugin').path
setting 'xpack.security.enabled', 'false'
setting 'xpack.monitoring.enabled', 'false'
setting 'xpack.license.self_generated.type', 'trial'
}

View File

@ -10,4 +10,5 @@ integTestCluster {
plugin xpackProject('plugin').path
setting 'xpack.security.enabled', 'false'
setting 'xpack.monitoring.enabled', 'false'
setting 'xpack.license.self_generated.type', 'trial'
}

View File

@ -28,6 +28,7 @@ integTestCluster {
setting 'xpack.notification.email.account._email.smtp.port', '587'
setting 'xpack.notification.email.account._email.smtp.user', '_user'
setting 'xpack.notification.email.account._email.smtp.password', '_passwd'
setting 'xpack.license.self_generated.type', 'trial'
plugin xpackProject('plugin').path
extraConfigFile 'x-pack/roles.yml', 'roles.yml'
setupCommand 'setupTestAdminUser',

View File

@ -22,6 +22,7 @@ integTestCluster {
setting 'xpack.security.enabled', 'false'
setting 'xpack.monitoring.enabled', 'false'
setting 'xpack.ml.enabled', 'false'
setting 'xpack.license.self_generated.type', 'trial'
setting 'logger.org.elasticsearch.xpack.watcher', 'DEBUG'
//

View File

@ -9,4 +9,5 @@ description = 'Run a subset of SQL tests against multiple nodes'
integTestCluster {
numNodes = 2
setting 'xpack.security.enabled', 'false'
setting 'xpack.license.self_generated.type', 'trial'
}

View File

@ -1,5 +1,6 @@
integTestCluster {
setting 'xpack.security.enabled', 'false'
setting 'xpack.license.self_generated.type', 'trial'
}
runqa {

View File

@ -3,6 +3,7 @@ integTestRunner {
}
integTestCluster {
setting 'xpack.license.self_generated.type', 'trial'
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",

View File

@ -156,6 +156,8 @@ integTestCluster {
setting 'xpack.ssl.keystore.path', 'test-node.jks'
keystoreSetting 'xpack.ssl.keystore.secure_password', 'keypass'
setting 'xpack.license.self_generated.type', 'trial'
// copy keystores into config/
extraConfigFile nodeKeystore.name, nodeKeystore
extraConfigFile clientKeyStore.name, clientKeyStore

View File

@ -8,5 +8,6 @@ dependencies {
integTestCluster {
setting 'xpack.security.enabled', 'false'
setting 'xpack.license.self_generated.type', 'trial'
plugin xpackProject('plugin').path
}