Skip to content

Commit 92acb28

Browse files
author
Peter Schretlen
authored
Allow kibana_system to create and invalidate API keys on behalf of other users
1 parent be20bb5 commit 92acb28

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/authz/store/ReservedRolesStore.java

+2
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
import org.elasticsearch.xpack.core.ilm.action.GetLifecycleAction;
1313
import org.elasticsearch.xpack.core.ilm.action.PutLifecycleAction;
1414
import org.elasticsearch.xpack.core.monitoring.action.MonitoringBulkAction;
15+
import org.elasticsearch.xpack.core.security.action.InvalidateApiKeyAction;
1516
import org.elasticsearch.xpack.core.security.action.privilege.GetBuiltinPrivilegesAction;
1617
import org.elasticsearch.xpack.core.security.authz.RoleDescriptor;
1718
import org.elasticsearch.xpack.core.security.authz.permission.Role;
@@ -113,6 +114,7 @@ private static Map<String, RoleDescriptor> initializeReservedRoles() {
113114
.put(KibanaUser.ROLE_NAME, new RoleDescriptor(KibanaUser.ROLE_NAME,
114115
new String[] {
115116
"monitor", "manage_index_templates", MonitoringBulkAction.NAME, "manage_saml", "manage_token", "manage_oidc",
117+
InvalidateApiKeyAction.NAME, "grant_api_key",
116118
GetBuiltinPrivilegesAction.NAME, "delegate_pki", GetLifecycleAction.NAME, PutLifecycleAction.NAME,
117119
// The symbolic constant for this one is in SecurityActionMapper, so not accessible from X-Pack core
118120
"cluster:admin/analyze"

x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/security/authz/store/ReservedRolesStoreTests.java

+6
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,8 @@
111111
import org.elasticsearch.xpack.core.ml.notifications.NotificationsIndex;
112112
import org.elasticsearch.xpack.core.monitoring.action.MonitoringBulkAction;
113113
import org.elasticsearch.xpack.core.security.action.DelegatePkiAuthenticationAction;
114+
import org.elasticsearch.xpack.core.security.action.GrantApiKeyAction;
115+
import org.elasticsearch.xpack.core.security.action.InvalidateApiKeyAction;
114116
import org.elasticsearch.xpack.core.security.action.privilege.DeletePrivilegesAction;
115117
import org.elasticsearch.xpack.core.security.action.privilege.DeletePrivilegesRequest;
116118
import org.elasticsearch.xpack.core.security.action.privilege.GetBuiltinPrivilegesAction;
@@ -326,6 +328,10 @@ public void testKibanaSystemRole() {
326328
assertThat(kibanaRole.cluster().check(InvalidateTokenAction.NAME, request, authentication), is(true));
327329
assertThat(kibanaRole.cluster().check(CreateTokenAction.NAME, request, authentication), is(true));
328330

331+
// API keys
332+
assertThat(kibanaRole.cluster().check(InvalidateApiKeyAction.NAME, request, authentication), is(true));
333+
assertThat(kibanaRole.cluster().check(GrantApiKeyAction.NAME, request, authentication), is(true));
334+
329335
// Application Privileges
330336
DeletePrivilegesRequest deleteKibanaPrivileges = new DeletePrivilegesRequest("kibana-.kibana", new String[]{ "all", "read" });
331337
DeletePrivilegesRequest deleteLogstashPrivileges = new DeletePrivilegesRequest("logstash", new String[]{ "all", "read" });

0 commit comments

Comments
 (0)