Skip to content

Commit 4f23a6c

Browse files
committed
Removing "system" from role and user names
1 parent 2d13928 commit 4f23a6c

File tree

13 files changed

+50
-50
lines changed

13 files changed

+50
-50
lines changed

docs/reference/commands/setup-passwords.asciidoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
== elasticsearch-setup-passwords
55

66
The `elasticsearch-setup-passwords` command sets the passwords for the built-in
7-
`elastic`, `kibana`, `logstash_system`, `beats_system`, and `apm_server_system` users.
7+
`elastic`, `kibana`, `logstash_system`, `beats_system`, and `apm_system` users.
88

99
[float]
1010
=== Synopsis

x-pack/docs/en/security/configuring-es.asciidoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ simplest method to set the built-in users' passwords for the first time.
5656

5757
For example, you can run the command in an "interactive" mode, which prompts you
5858
to enter new passwords for the `elastic`, `kibana`, `beats_system`,
59-
`logstash_system`, and `apm_server_system` users:
59+
`logstash_system`, and `apm_system` users:
6060

6161
[source,shell]
6262
--------------------------------------------------

x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/authc/esnative/ClientReservedRealm.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public static boolean isReserved(String username, Settings settings) {
1919
case UsernamesField.KIBANA_NAME:
2020
case UsernamesField.LOGSTASH_NAME:
2121
case UsernamesField.BEATS_NAME:
22-
case UsernamesField.APM_SERVER_NAME:
22+
case UsernamesField.APM_NAME:
2323
return XPackSettings.RESERVED_REALM_ENABLED_SETTING.get(settings);
2424
default:
2525
return AnonymousUser.isAnonymousUsername(username, settings);

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ private static Map<String, RoleDescriptor> initializeReservedRoles() {
112112
null, MetadataUtils.DEFAULT_RESERVED_METADATA))
113113
.put(UsernamesField.BEATS_ROLE, new RoleDescriptor(UsernamesField.BEATS_ROLE,
114114
new String[] { "monitor", MonitoringBulkAction.NAME}, null, null, MetadataUtils.DEFAULT_RESERVED_METADATA))
115-
.put(UsernamesField.APM_SERVER_ROLE, new RoleDescriptor(UsernamesField.APM_SERVER_ROLE,
115+
.put(UsernamesField.APM_ROLE, new RoleDescriptor(UsernamesField.APM_ROLE,
116116
new String[] { "monitor", MonitoringBulkAction.NAME}, null, null, MetadataUtils.DEFAULT_RESERVED_METADATA))
117117
.put("machine_learning_user", new RoleDescriptor("machine_learning_user", new String[] { "monitor_ml" },
118118
new RoleDescriptor.IndicesPrivileges[] { RoleDescriptor.IndicesPrivileges.builder().indices(".ml-anomalies*",
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@
1212
/**
1313
* Built in user for APM server internals. Currently used for APM server monitoring.
1414
*/
15-
public class APMServerSystemUser extends User {
15+
public class APMSystemUser extends User {
1616

17-
public static final String NAME = UsernamesField.APM_SERVER_NAME;
18-
public static final String ROLE_NAME = UsernamesField.APM_SERVER_ROLE;
17+
public static final String NAME = UsernamesField.APM_NAME;
18+
public static final String ROLE_NAME = UsernamesField.APM_ROLE;
1919
public static final Version DEFINED_SINCE = Version.V_6_5_0;
2020
public static final BuiltinUserInfo USER_INFO = new BuiltinUserInfo(NAME, ROLE_NAME, DEFINED_SINCE);
2121

22-
public APMServerSystemUser(boolean enabled) {
22+
public APMSystemUser(boolean enabled) {
2323
super(NAME, new String[]{ ROLE_NAME }, null, null, MetadataUtils.DEFAULT_RESERVED_METADATA, enabled);
2424
}
2525
}

x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/user/UsernamesField.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ public final class UsernamesField {
2020
public static final String LOGSTASH_ROLE = "logstash_system";
2121
public static final String BEATS_NAME = "beats_system";
2222
public static final String BEATS_ROLE = "beats_system";
23-
public static final String APM_SERVER_NAME = "apm_server_system";
24-
public static final String APM_SERVER_ROLE = "apm_server_system";
23+
public static final String APM_NAME = "apm_system";
24+
public static final String APM_ROLE = "apm_system";
2525

2626
private UsernamesField() {}
2727
}

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

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@
9494
import org.elasticsearch.xpack.core.security.authz.permission.Role;
9595
import org.elasticsearch.xpack.core.security.authz.privilege.ApplicationPrivilege;
9696
import org.elasticsearch.xpack.core.security.authz.privilege.ApplicationPrivilegeDescriptor;
97-
import org.elasticsearch.xpack.core.security.user.APMServerSystemUser;
97+
import org.elasticsearch.xpack.core.security.user.APMSystemUser;
9898
import org.elasticsearch.xpack.core.security.user.BeatsSystemUser;
9999
import org.elasticsearch.xpack.core.security.user.LogstashSystemUser;
100100
import org.elasticsearch.xpack.core.security.user.SystemUser;
@@ -148,7 +148,7 @@ public void testIsReserved() {
148148
assertThat(ReservedRolesStore.isReserved(XPackUser.ROLE_NAME), is(true));
149149
assertThat(ReservedRolesStore.isReserved(LogstashSystemUser.ROLE_NAME), is(true));
150150
assertThat(ReservedRolesStore.isReserved(BeatsSystemUser.ROLE_NAME), is(true));
151-
assertThat(ReservedRolesStore.isReserved(APMServerSystemUser.ROLE_NAME), is(true));
151+
assertThat(ReservedRolesStore.isReserved(APMSystemUser.ROLE_NAME), is(true));
152152
}
153153

154154
public void testIngestAdminRole() {
@@ -630,27 +630,27 @@ public void testBeatsSystemRole() {
630630
is(false));
631631
}
632632

633-
public void testAPMServerSystemRole() {
633+
public void testAPMSystemRole() {
634634
final TransportRequest request = mock(TransportRequest.class);
635635

636-
RoleDescriptor roleDescriptor = new ReservedRolesStore().roleDescriptor(APMServerSystemUser.ROLE_NAME);
636+
RoleDescriptor roleDescriptor = new ReservedRolesStore().roleDescriptor(APMSystemUser.ROLE_NAME);
637637
assertNotNull(roleDescriptor);
638638
assertThat(roleDescriptor.getMetadata(), hasEntry("_reserved", true));
639639

640-
Role apmServerSystemRole = Role.builder(roleDescriptor, null).build();
641-
assertThat(apmServerSystemRole.cluster().check(ClusterHealthAction.NAME, request), is(true));
642-
assertThat(apmServerSystemRole.cluster().check(ClusterStateAction.NAME, request), is(true));
643-
assertThat(apmServerSystemRole.cluster().check(ClusterStatsAction.NAME, request), is(true));
644-
assertThat(apmServerSystemRole.cluster().check(PutIndexTemplateAction.NAME, request), is(false));
645-
assertThat(apmServerSystemRole.cluster().check(ClusterRerouteAction.NAME, request), is(false));
646-
assertThat(apmServerSystemRole.cluster().check(ClusterUpdateSettingsAction.NAME, request), is(false));
647-
assertThat(apmServerSystemRole.cluster().check(MonitoringBulkAction.NAME, request), is(true));
640+
Role APMSystemRole = Role.builder(roleDescriptor, null).build();
641+
assertThat(APMSystemRole.cluster().check(ClusterHealthAction.NAME, request), is(true));
642+
assertThat(APMSystemRole.cluster().check(ClusterStateAction.NAME, request), is(true));
643+
assertThat(APMSystemRole.cluster().check(ClusterStatsAction.NAME, request), is(true));
644+
assertThat(APMSystemRole.cluster().check(PutIndexTemplateAction.NAME, request), is(false));
645+
assertThat(APMSystemRole.cluster().check(ClusterRerouteAction.NAME, request), is(false));
646+
assertThat(APMSystemRole.cluster().check(ClusterUpdateSettingsAction.NAME, request), is(false));
647+
assertThat(APMSystemRole.cluster().check(MonitoringBulkAction.NAME, request), is(true));
648648

649-
assertThat(apmServerSystemRole.runAs().check(randomAlphaOfLengthBetween(1, 30)), is(false));
649+
assertThat(APMSystemRole.runAs().check(randomAlphaOfLengthBetween(1, 30)), is(false));
650650

651-
assertThat(apmServerSystemRole.indices().allowedIndicesMatcher(IndexAction.NAME).test("foo"), is(false));
652-
assertThat(apmServerSystemRole.indices().allowedIndicesMatcher(IndexAction.NAME).test(".reporting"), is(false));
653-
assertThat(apmServerSystemRole.indices().allowedIndicesMatcher("indices:foo").test(randomAlphaOfLengthBetween(8, 24)),
651+
assertThat(APMSystemRole.indices().allowedIndicesMatcher(IndexAction.NAME).test("foo"), is(false));
652+
assertThat(APMSystemRole.indices().allowedIndicesMatcher(IndexAction.NAME).test(".reporting"), is(false));
653+
assertThat(APMSystemRole.indices().allowedIndicesMatcher("indices:foo").test(randomAlphaOfLengthBetween(8, 24)),
654654
is(false));
655655
}
656656

x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/authc/esnative/ReservedRealm.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
import org.elasticsearch.xpack.core.security.authc.support.Hasher;
2525
import org.elasticsearch.xpack.core.security.authc.support.UsernamePasswordToken;
2626
import org.elasticsearch.xpack.core.security.support.Exceptions;
27-
import org.elasticsearch.xpack.core.security.user.APMServerSystemUser;
27+
import org.elasticsearch.xpack.core.security.user.APMSystemUser;
2828
import org.elasticsearch.xpack.core.security.user.AnonymousUser;
2929
import org.elasticsearch.xpack.core.security.user.BeatsSystemUser;
3030
import org.elasticsearch.xpack.core.security.user.ElasticUser;
@@ -150,8 +150,8 @@ private User getUser(String username, ReservedUserInfo userInfo) {
150150
return new LogstashSystemUser(userInfo.enabled);
151151
case BeatsSystemUser.NAME:
152152
return new BeatsSystemUser(userInfo.enabled);
153-
case APMServerSystemUser.NAME:
154-
return new APMServerSystemUser(userInfo.enabled);
153+
case APMSystemUser.NAME:
154+
return new APMSystemUser(userInfo.enabled);
155155
default:
156156
if (anonymousEnabled && anonymousUser.principal().equals(username)) {
157157
return anonymousUser;
@@ -180,8 +180,8 @@ public void users(ActionListener<Collection<User>> listener) {
180180
userInfo = reservedUserInfos.get(BeatsSystemUser.NAME);
181181
users.add(new BeatsSystemUser(userInfo == null || userInfo.enabled));
182182

183-
userInfo = reservedUserInfos.get(APMServerSystemUser.NAME);
184-
users.add(new APMServerSystemUser(userInfo == null || userInfo.enabled));
183+
userInfo = reservedUserInfos.get(APMSystemUser.NAME);
184+
users.add(new APMSystemUser(userInfo == null || userInfo.enabled));
185185

186186
if (anonymousEnabled) {
187187
users.add(anonymousUser);
@@ -236,8 +236,8 @@ private Version getDefinedVersion(String username) {
236236
return LogstashSystemUser.DEFINED_SINCE;
237237
case BeatsSystemUser.NAME:
238238
return BeatsSystemUser.DEFINED_SINCE;
239-
case APMServerSystemUser.NAME:
240-
return APMServerSystemUser.DEFINED_SINCE;
239+
case APMSystemUser.NAME:
240+
return APMSystemUser.DEFINED_SINCE;
241241
default:
242242
return Version.V_5_0_0;
243243
}

x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/authc/esnative/tool/SetupPasswordTool.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
import org.elasticsearch.env.Environment;
2828
import org.elasticsearch.xpack.core.XPackSettings;
2929
import org.elasticsearch.xpack.core.security.support.Validation;
30-
import org.elasticsearch.xpack.core.security.user.APMServerSystemUser;
30+
import org.elasticsearch.xpack.core.security.user.APMSystemUser;
3131
import org.elasticsearch.xpack.core.security.user.BeatsSystemUser;
3232
import org.elasticsearch.xpack.core.security.user.ElasticUser;
3333
import org.elasticsearch.xpack.core.security.user.KibanaUser;
@@ -65,7 +65,7 @@ public class SetupPasswordTool extends LoggingAwareMultiCommand {
6565

6666
private static final char[] CHARS = ("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789").toCharArray();
6767
public static final List<String> USERS = asList(ElasticUser.NAME, KibanaUser.NAME, LogstashSystemUser.NAME,
68-
BeatsSystemUser.NAME, APMServerSystemUser.NAME);
68+
BeatsSystemUser.NAME, APMSystemUser.NAME);
6969

7070
private final BiFunction<Environment, Settings, CommandLineHttpClient> clientFunction;
7171
private final CheckedFunction<Environment, KeyStoreWrapper, Exception> keyStoreFunction;

x-pack/plugin/security/src/test/java/org/elasticsearch/test/NativeRealmIntegTestCase.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
import org.elasticsearch.common.util.set.Sets;
1313
import org.elasticsearch.xpack.core.security.authc.support.UsernamePasswordToken;
1414
import org.elasticsearch.xpack.core.security.client.SecurityClient;
15-
import org.elasticsearch.xpack.core.security.user.APMServerSystemUser;
15+
import org.elasticsearch.xpack.core.security.user.APMSystemUser;
1616
import org.elasticsearch.xpack.core.security.user.BeatsSystemUser;
1717
import org.elasticsearch.xpack.core.security.user.ElasticUser;
1818
import org.elasticsearch.xpack.core.security.user.KibanaUser;
@@ -89,7 +89,7 @@ public void setupReservedPasswords(RestClient restClient) throws IOException {
8989
RequestOptions.Builder optionsBuilder = RequestOptions.DEFAULT.toBuilder();
9090
optionsBuilder.addHeader("Authorization", UsernamePasswordToken.basicAuthHeaderValue(ElasticUser.NAME, reservedPassword));
9191
RequestOptions options = optionsBuilder.build();
92-
for (String username : Arrays.asList(KibanaUser.NAME, LogstashSystemUser.NAME, BeatsSystemUser.NAME, APMServerSystemUser.NAME)) {
92+
for (String username : Arrays.asList(KibanaUser.NAME, LogstashSystemUser.NAME, BeatsSystemUser.NAME, APMSystemUser.NAME)) {
9393
Request request = new Request("PUT", "/_xpack/security/user/" + username + "/_password");
9494
request.setJsonEntity("{\"password\": \"" + new String(reservedPassword.getChars()) + "\"}");
9595
request.setOptions(options);

0 commit comments

Comments
 (0)