Skip to content

Commit

Permalink
Merge branch 'main' into validate_empty_index_names
Browse files Browse the repository at this point in the history
  • Loading branch information
craigtaverner authored Jan 10, 2025
2 parents 35492d0 + 2b0c81c commit caec1f8
Show file tree
Hide file tree
Showing 10 changed files with 143 additions and 1 deletion.
15 changes: 15 additions & 0 deletions docs/reference/rest-api/security/get-service-accounts.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,21 @@ GET /_security/service/elastic/fleet-server
"view_index_metadata"
],
"allow_restricted_indices": false
},
{
"names": [
"agentless-*",
],
"privileges": [
"read",
"write",
"monitor",
"create_index",
"auto_configure",
"maintenance",
"view_index_metadata"
],
"allow_restricted_indices": false
}
],
"applications": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -781,6 +781,7 @@ protected Set<String> preserveILMPolicyIds() {
"profiling-60-days",
"profiling-60-days@lifecycle",
"synthetics",
"agentless",
"synthetics@lifecycle",
"traces@lifecycle",
"7-days-default",
Expand Down Expand Up @@ -2215,6 +2216,7 @@ protected static boolean isXPackTemplate(String name) {
case "metrics-tsdb-settings":
case "metrics-mappings":
case "synthetics":
case "agentless":
case "synthetics-settings":
case "synthetics-mappings":
case ".snapshot-blob-cache":
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

import org.elasticsearch.action.admin.indices.alias.TransportIndicesAliasesAction;
import org.elasticsearch.action.admin.indices.delete.TransportDeleteIndexAction;
import org.elasticsearch.action.admin.indices.mapping.put.TransportAutoPutMappingAction;
import org.elasticsearch.action.admin.indices.mapping.put.TransportPutMappingAction;
import org.elasticsearch.action.admin.indices.rollover.RolloverAction;
import org.elasticsearch.action.admin.indices.settings.put.TransportUpdateSettingsAction;
Expand Down Expand Up @@ -428,7 +429,6 @@ static RoleDescriptor kibanaSystem(String name) {
RoleDescriptor.IndicesPrivileges.builder()
.indices(
"logs-cloud_security_posture.findings_latest-default*",
"logs-cloud_security_posture.scores-default*",
"logs-cloud_security_posture.vulnerabilities_latest-default*"
)
.privileges(
Expand All @@ -440,6 +440,20 @@ static RoleDescriptor kibanaSystem(String name) {
TransportUpdateSettingsAction.TYPE.name()
)
.build(),
// For destination indices of the Cloud Security Posture packages that ships a
// transform (specific for scores indexes, as of 9.0.0 score indices will need to have auto_put priviliges)
RoleDescriptor.IndicesPrivileges.builder()
.indices("logs-cloud_security_posture.scores-default*")
.privileges(
"create_index",
"read",
"index",
"delete",
TransportIndicesAliasesAction.NAME,
TransportUpdateSettingsAction.TYPE.name(),
TransportAutoPutMappingAction.TYPE.name()
)
.build(),
// For source indices of the Cloud Detection & Response (CDR) packages that ships a
// transform
RoleDescriptor.IndicesPrivileges.builder()
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"template": {
"mappings": {
"properties": {
"v": {
"type": "object",
"enabled": false
},
"updated_at": {
"type": "date",
"format": "strict_date_optional_time||epoch_millis"
}
}
}
},
"_meta": {
"description": "default mappings for the agentless index template installed by x-pack",
"managed": true
},
"version": ${xpack.stack.template.version},
"deprecated": ${xpack.stack.template.deprecated}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"template": {
"settings": {
"index": {
"hidden": true
}
}
},
"_meta": {
"description": "default settings for the agentless index template installed by x-pack",
"managed": true
},
"version": ${xpack.stack.template.version},
"deprecated": ${xpack.stack.template.deprecated}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"index_patterns": ["agentless-*-*"],
"priority": 100,
"composed_of": [
"agentless@mappings",
"agentless@settings"
],
"allow_auto_create": true,
"_meta": {
"description": "default agentless template installed by x-pack",
"managed": true
},
"version": ${xpack.stack.template.version},
"deprecated": ${xpack.stack.template.deprecated}
}
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,21 @@ public class ServiceAccountIT extends ESRestTestCase {
"view_index_metadata"
],
"allow_restricted_indices": false
},
{
"names": [
"agentless-*"
],
"privileges": [
"read",
"write",
"monitor",
"create_index",
"auto_configure",
"maintenance",
"view_index_metadata"
],
"allow_restricted_indices": false
}
],
"applications": [ {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,12 @@ final class ElasticServiceAccounts {
RoleDescriptor.IndicesPrivileges.builder()
.indices("content-*", ".search-acl-filter-*")
.privileges("read", "write", "monitor", "create_index", "auto_configure", "maintenance", "view_index_metadata")
.build(),
// Custom permissions required for stateful agentless integrations
RoleDescriptor.IndicesPrivileges.builder()
.indices("agentless-*")
.privileges("read", "write", "monitor", "create_index", "auto_configure", "maintenance", "view_index_metadata")
.allowRestrictedIndices(false)
.build(), },
new RoleDescriptor.ApplicationResourcePrivileges[] {
RoleDescriptor.ApplicationResourcePrivileges.builder()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,13 @@ public class StackTemplateRegistry extends IndexTemplateRegistry {
public static final String SYNTHETICS_ILM_POLICY_NAME = "synthetics@lifecycle";
public static final String SYNTHETICS_INDEX_TEMPLATE_NAME = "synthetics";

//////////////////////////////////////////////////////////
// Agentless components (for matching agentless-*-* indices)
//////////////////////////////////////////////////////////
public static final String AGENTLESS_MAPPINGS_COMPONENT_TEMPLATE_NAME = "agentless@mappings";
public static final String AGENTLESS_SETTINGS_COMPONENT_TEMPLATE_NAME = "agentless@settings";
public static final String AGENTLESS_INDEX_TEMPLATE_NAME = "agentless";

///////////////////////////////////
// Kibana reporting template
///////////////////////////////////
Expand Down Expand Up @@ -199,6 +206,20 @@ private Map<String, ComponentTemplate> loadComponentTemplateConfigs() {
TEMPLATE_VERSION_VARIABLE,
ADDITIONAL_TEMPLATE_VARIABLES
),
new IndexTemplateConfig(
AGENTLESS_MAPPINGS_COMPONENT_TEMPLATE_NAME,
"/[email protected]",
REGISTRY_VERSION,
TEMPLATE_VERSION_VARIABLE,
ADDITIONAL_TEMPLATE_VARIABLES
),
new IndexTemplateConfig(
AGENTLESS_SETTINGS_COMPONENT_TEMPLATE_NAME,
"/[email protected]",
REGISTRY_VERSION,
TEMPLATE_VERSION_VARIABLE,
ADDITIONAL_TEMPLATE_VARIABLES
),
new IndexTemplateConfig(
KIBANA_REPORTING_COMPONENT_TEMPLATE_NAME,
"/[email protected]",
Expand Down Expand Up @@ -287,6 +308,13 @@ protected Map<String, ComponentTemplate> getComponentTemplateConfigs() {
TEMPLATE_VERSION_VARIABLE,
ADDITIONAL_TEMPLATE_VARIABLES
),
new IndexTemplateConfig(
AGENTLESS_INDEX_TEMPLATE_NAME,
"/[email protected]",
REGISTRY_VERSION,
TEMPLATE_VERSION_VARIABLE,
ADDITIONAL_TEMPLATE_VARIABLES
),
new IndexTemplateConfig(
KIBANA_REPORTING_INDEX_TEMPLATE_NAME,
"/[email protected]",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -414,6 +414,8 @@ public void testSameOrHigherVersionTemplateNotUpgraded() {
versions.put(StackTemplateRegistry.METRICS_MAPPINGS_COMPONENT_TEMPLATE_NAME, StackTemplateRegistry.REGISTRY_VERSION);
versions.put(StackTemplateRegistry.SYNTHETICS_SETTINGS_COMPONENT_TEMPLATE_NAME, StackTemplateRegistry.REGISTRY_VERSION);
versions.put(StackTemplateRegistry.SYNTHETICS_MAPPINGS_COMPONENT_TEMPLATE_NAME, StackTemplateRegistry.REGISTRY_VERSION);
versions.put(StackTemplateRegistry.AGENTLESS_SETTINGS_COMPONENT_TEMPLATE_NAME, StackTemplateRegistry.REGISTRY_VERSION);
versions.put(StackTemplateRegistry.AGENTLESS_MAPPINGS_COMPONENT_TEMPLATE_NAME, StackTemplateRegistry.REGISTRY_VERSION);
versions.put(StackTemplateRegistry.KIBANA_REPORTING_COMPONENT_TEMPLATE_NAME, StackTemplateRegistry.REGISTRY_VERSION);
versions.put(StackTemplateRegistry.TRACES_MAPPINGS_COMPONENT_TEMPLATE_NAME, StackTemplateRegistry.REGISTRY_VERSION);
versions.put(StackTemplateRegistry.TRACES_SETTINGS_COMPONENT_TEMPLATE_NAME, StackTemplateRegistry.REGISTRY_VERSION);
Expand Down Expand Up @@ -472,6 +474,14 @@ public void testSameOrHigherVersionTemplateNotUpgraded() {
StackTemplateRegistry.SYNTHETICS_MAPPINGS_COMPONENT_TEMPLATE_NAME,
StackTemplateRegistry.REGISTRY_VERSION + randomIntBetween(1, 1000)
);
versions.put(
StackTemplateRegistry.AGENTLESS_SETTINGS_COMPONENT_TEMPLATE_NAME,
StackTemplateRegistry.REGISTRY_VERSION + randomIntBetween(1, 1000)
);
versions.put(
StackTemplateRegistry.AGENTLESS_MAPPINGS_COMPONENT_TEMPLATE_NAME,
StackTemplateRegistry.REGISTRY_VERSION + randomIntBetween(1, 1000)
);
versions.put(
StackTemplateRegistry.KIBANA_REPORTING_COMPONENT_TEMPLATE_NAME,
StackTemplateRegistry.REGISTRY_VERSION + randomIntBetween(1, 1000)
Expand Down

0 comments on commit caec1f8

Please sign in to comment.