Skip to content

Commit

Permalink
[Serverless] Allow authentication via the Elasticsearch JWT realm wit…
Browse files Browse the repository at this point in the history
…h the `shared_secret` client authentication type. (#161564)
  • Loading branch information
azasypkin authored Jul 11, 2023
1 parent 95e5087 commit cdc862a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
5 changes: 2 additions & 3 deletions config/serverless.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,5 @@ server.versioned.strictClientVersionCheck: false
xpack.spaces.maxSpaces: 1
xpack.spaces.allowFeatureVisibility: false

# Temporarily allow unauthenticated access to task manager utilization & status/stats APIs for autoscaling
status.allowAnonymous: true
xpack.task_manager.unsafe.authenticate_background_task_utilization: false
# Allow authentication via the Elasticsearch JWT realm with the `shared_secret` client authentication type.
elasticsearch.requestHeadersWhitelist: ["authorization", "es-client-authentication"]
4 changes: 4 additions & 0 deletions packages/kbn-es/src/settings.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ const mockSettings = [
'abc.def=1',
'xpack.security.authc.realms.oidc.oidc1.rp.client_secret=secret',
'xpack.security.authc.realms.oidc.oidc1.rp.client_id=client id',
'xpack.security.authc.realms.jwt.jwt1.client_authentication.shared_secret=jwt_secret',
'discovery.type=single-node',
];

Expand All @@ -20,6 +21,7 @@ test('`parseSettings` parses and returns all settings by default', () => {
['abc.def', '1'],
['xpack.security.authc.realms.oidc.oidc1.rp.client_secret', 'secret'],
['xpack.security.authc.realms.oidc.oidc1.rp.client_id', 'client id'],
['xpack.security.authc.realms.jwt.jwt1.client_authentication.shared_secret', 'jwt_secret'],
['discovery.type', 'single-node'],
]);
});
Expand All @@ -29,13 +31,15 @@ test('`parseSettings` parses and returns all settings with `SettingsFilter.All`
['abc.def', '1'],
['xpack.security.authc.realms.oidc.oidc1.rp.client_secret', 'secret'],
['xpack.security.authc.realms.oidc.oidc1.rp.client_id', 'client id'],
['xpack.security.authc.realms.jwt.jwt1.client_authentication.shared_secret', 'jwt_secret'],
['discovery.type', 'single-node'],
]);
});

test('`parseSettings` parses and returns only secure settings with `SettingsFilter.SecureOnly` filter', () => {
expect(parseSettings(mockSettings, { filter: SettingsFilter.SecureOnly })).toEqual([
['xpack.security.authc.realms.oidc.oidc1.rp.client_secret', 'secret'],
['xpack.security.authc.realms.jwt.jwt1.client_authentication.shared_secret', 'jwt_secret'],
]);
});

Expand Down
1 change: 1 addition & 0 deletions packages/kbn-es/src/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
*/
const SECURE_SETTINGS_LIST = [
/^xpack\.security\.authc\.realms\.oidc\.[a-zA-Z0-9_]+\.rp\.client_secret$/,
/^xpack\.security\.authc\.realms\.jwt\.[a-zA-Z0-9_]+\.client_authentication\.shared_secret$/,
];

function isSecureSetting(settingName: string) {
Expand Down

0 comments on commit cdc862a

Please sign in to comment.