2018-12-13 14:47:20 -05:00
---
2019-08-21 00:48:59 -04:00
id: druid-basic-security
2018-12-13 14:47:20 -05:00
title: "Basic Security"
---
2018-11-13 12:38:37 -05:00
<!--
~ Licensed to the Apache Software Foundation (ASF) under one
~ or more contributor license agreements. See the NOTICE file
~ distributed with this work for additional information
~ regarding copyright ownership. The ASF licenses this file
~ to you under the Apache License, Version 2.0 (the
~ "License"); you may not use this file except in compliance
~ with the License. You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing,
~ software distributed under the License is distributed on an
~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
~ KIND, either express or implied. See the License for the
~ specific language governing permissions and limitations
~ under the License.
-->
2017-12-14 13:36:04 -05:00
2020-10-29 15:47:24 -04:00
The Basic Security extension for Apache Druid adds:
2019-07-24 18:26:03 -04:00
2020-10-29 15:47:24 -04:00
- an Authenticator which supports [HTTP Basic authentication ](https://en.wikipedia.org/wiki/Basic_access_authentication ) using the Druid metadata store or LDAP as its credentials store.
2021-10-08 17:45:09 -04:00
- an Escalator which determines the authentication scheme for internal Druid processes.
2020-10-29 15:47:24 -04:00
- an Authorizer which implements basic role-based access control for Druid metadata store or LDAP users and groups.
2017-12-14 13:36:04 -05:00
2020-10-29 15:47:24 -04:00
To load the extension, [include ](../../development/extensions.md#loading-extensions ) `druid-basic-security` in the `druid.extensions.loadList` in your `common.runtime.properties` . For example:
```
druid.extensions.loadList=["postgresql-metadata-storage", "druid-hdfs-storage", "druid-basic-security"]
```
2017-12-14 13:36:04 -05:00
2021-10-08 17:45:09 -04:00
To enable basic auth, configure the basic Authenticator, Escalator, and Authorizer in `common.runtime.properties` .
See [Security overview ](../../operations/security-overview.html#enable-an-authenticator ) for an example configuration for HTTP basic authentication.
Visit [Authentication and Authorization ](../../design/auth.md ) for more information on the implemented extension interfaces and for an example configuration.
2017-12-14 13:36:04 -05:00
## Configuration
2020-10-29 15:47:24 -04:00
The examples in the section use the following names for the Authenticators and Authorizers:
- `MyBasicMetadataAuthenticator`
- `MyBasicLDAPAuthenticator`
- `MyBasicMetadataAuthorizer`
2021-10-08 17:45:09 -04:00
- `MyBasicLDAPAuthorizer`
2017-12-14 13:36:04 -05:00
These properties are not tied to specific Authenticator or Authorizer instances.
2020-10-29 15:47:24 -04:00
To set the value for the configuration properties, add them to the common runtime properties file.
2017-12-14 13:36:04 -05:00
2021-10-08 17:45:09 -04:00
### General properties
2022-11-29 12:26:32 -05:00
**`druid.auth.basic.common.pollingPeriod`**
2023-03-02 14:19:32 -05:00
Defines in milliseconds how often processes should poll the Coordinator for the current Druid metadata store authenticator/authorizer state.< br / >
**Required**: No< br / >
2022-11-29 12:26:32 -05:00
**Default**: 60000
**`druid.auth.basic.common.maxRandomDelay`**
2023-03-02 14:19:32 -05:00
Defines in milliseconds the amount of random delay to add to the pollingPeriod, to spread polling requests across time.< br / >
**Required**: No< br / >
2022-11-29 12:26:32 -05:00
**Default**: 6000
**`druid.auth.basic.common.maxSyncRetries`**
2023-03-02 14:19:32 -05:00
Determines how many times a service will retry if the authentication/authorization Druid metadata store state sync with the Coordinator fails.< br / >
**Required**: No< br / >
2022-11-29 12:26:32 -05:00
**Default**: 10
**`druid.auth.basic.common.cacheDirectory`**
2023-03-02 14:19:32 -05:00
If defined, snapshots of the basic Authenticator and Authorizer Druid metadata store caches will be stored on disk in this directory. If this property is defined, when a service is starting, it will attempt to initialize its caches from these on-disk snapshots, if the service is unable to initialize its state by communicating with the Coordinator.< br / >
**Required**: No< br / >
2022-11-29 12:26:32 -05:00
**Default**: null
2017-12-14 13:36:04 -05:00
2021-10-08 17:45:09 -04:00
### Authenticator
2017-12-14 13:36:04 -05:00
2018-12-12 23:42:12 -05:00
To use the Basic authenticator, add an authenticator with type `basic` to the authenticatorChain.
2020-10-29 15:47:24 -04:00
The default credentials validator (`credentialsValidator`) is `metadata` . To use the LDAP validator, define a credentials validator with a type of 'ldap'.
2017-12-14 13:36:04 -05:00
2021-10-08 17:45:09 -04:00
Use the following syntax to configure a named authenticator:
2017-12-14 13:36:04 -05:00
```
druid.auth.authenticator.< authenticatorName > .< authenticatorProperty >
```
2021-10-08 17:45:09 -04:00
Example configuration of an authenticator that uses the Druid metadata store to look up and validate credentials:
```
# Druid basic security
druid.auth.authenticatorChain=["MyBasicMetadataAuthenticator"]
druid.auth.authenticator.MyBasicMetadataAuthenticator.type=basic
# Default password for 'admin' user, should be changed for production.
druid.auth.authenticator.MyBasicMetadataAuthenticator.initialAdminPassword=password1
# Default password for internal 'druid_system' user, should be changed for production.
druid.auth.authenticator.MyBasicMetadataAuthenticator.initialInternalClientPassword=password2
# Uses the metadata store for storing users, you can use authentication API to create new users and grant permissions
druid.auth.authenticator.MyBasicMetadataAuthenticator.credentialsValidator.type=metadata
# If true and the request credential doesn't exists in this credentials store, the request will proceed to next Authenticator in the chain.
druid.auth.authenticator.MyBasicMetadataAuthenticator.skipOnFailure=false
druid.auth.authenticator.MyBasicMetadataAuthenticator.authorizerName=MyBasicMetadataAuthorizer
```
2020-10-29 15:47:24 -04:00
The remaining examples of authenticator configuration use either `MyBasicMetadataAuthenticator` or `MyBasicLDAPAuthenticator` as the authenticator name.
2017-12-14 13:36:04 -05:00
2019-10-08 20:08:27 -04:00
#### Properties for Druid metadata store user authentication
2022-11-29 12:26:32 -05:00
**`druid.auth.authenticator.MyBasicMetadataAuthenticator.initialAdminPassword`**
2023-03-02 14:19:32 -05:00
Initial [Password Provider ](../../operations/password-provider.md ) for the automatically created default admin user. If no password is specified, the default admin user will not be created. If the default admin user already exists, setting this property will not affect its password.< br />
**Required**: No< br / >
2022-11-29 12:26:32 -05:00
**Default**: null
**`druid.auth.authenticator.MyBasicMetadataAuthenticator.initialInternalClientPassword`**
2023-03-02 14:19:32 -05:00
Initial [Password Provider ](../../operations/password-provider.md ) for the default internal system user, used for internal process communication. If no password is specified, the default internal system user will not be created. If the default internal system user already exists, setting this property will not affect its password.< br />
**Required**: No< br / >
2022-11-29 12:26:32 -05:00
**Default**: null
**`druid.auth.authenticator.MyBasicMetadataAuthenticator.enableCacheNotifications`**
2023-03-02 14:19:32 -05:00
If true, the Coordinator will notify Druid processes whenever a configuration change to this Authenticator occurs, allowing them to immediately update their state without waiting for polling.< br / >
**Required**: No< br / >
2022-11-29 12:26:32 -05:00
**Default**: True
**`druid.auth.authenticator.MyBasicMetadataAuthenticator.cacheNotificationTimeout`**
2023-03-02 14:19:32 -05:00
The timeout in milliseconds for the cache notifications.< br / >
**Required**: No< br / >
2022-11-29 12:26:32 -05:00
**Default**: 5000
**`druid.auth.authenticator.MyBasicMetadataAuthenticator.credentialIterations`**
2023-03-02 14:19:32 -05:00
Number of iterations to use for password hashing. See [Credential iterations and API performance ](#credential-iterations-and-api-performance )< br />
**Required**: No< br / >
2022-11-29 12:26:32 -05:00
**Default**: 10000
**`druid.auth.authenticator.MyBasicMetadataAuthenticator.credentialsValidator.type`**
2023-03-02 14:19:32 -05:00
The type of credentials store (metadata) to validate requests credentials.< br / >
**Required**: No< br / >
2022-11-29 12:26:32 -05:00
**Default**: metadata
**`druid.auth.authenticator.MyBasicMetadataAuthenticator.skipOnFailure`**
2023-03-02 14:19:32 -05:00
If true and the request credential doesn't exists or isn't fully configured in the credentials store, the request will proceed to next Authenticator in the chain.< br / >
**Required**: No< br / >
2022-11-29 12:26:32 -05:00
**Default**: false
**`druid.auth.authenticator.MyBasicMetadataAuthenticator.authorizerName`**
2023-03-02 14:19:32 -05:00
Authorizer that requests should be directed to.< br / >
**Required**: Yes< br / >
2022-11-29 12:26:32 -05:00
**Default**: N/A
2019-10-08 20:08:27 -04:00
2020-10-29 15:47:24 -04:00
##### Credential iterations and API performance
2021-08-13 20:02:07 -04:00
As noted above, `credentialIterations` determines the number of iterations used to hash a password. A higher number increases security, but costs more in terms of CPU utilization.
This cost affects API performance, including query times. The default setting of 10000 is intentionally high to prevent attackers from using brute force to guess passwords.
You can decrease the number of iterations to speed up API response times, but it may expose your system to dictionary attacks. Therefore, only reduce the number of iterations if your environment fits one of the following conditions:
2020-10-29 15:47:24 -04:00
- **All** passwords are long and random which make them as safe as a randomly-generated token.
- You have secured network access to Druid so that no attacker can execute a dictionary attack against it.
2021-08-13 20:02:07 -04:00
If Druid uses the default credentials validator (i.e., `credentialsValidator.type=metadata` ), changing the `credentialIterations` value affects the number of hashing iterations only for users created after the change or for users who subsequently update their passwords via the `/druid-ext/basic-security/authentication/db/basic/users/{userName}/credentials` endpoint. If Druid uses the `ldap` validator, the change applies to any user at next log in (as well as to new users or users who update their passwords).
2019-10-08 20:08:27 -04:00
#### Properties for LDAP user authentication
2021-08-13 20:02:07 -04:00
2022-11-29 12:26:32 -05:00
**`druid.auth.authenticator.MyBasicLDAPAuthenticator.initialAdminPassword`**
2023-03-02 14:19:32 -05:00
Initial [Password Provider ](../../operations/password-provider.md ) for the automatically created default admin user. If no password is specified, the default admin user will not be created. If the default admin user already exists, setting this property will not affect its password.< br />
**Required**: No< br / >
2022-11-29 12:26:32 -05:00
**Default**: null
**`druid.auth.authenticator.MyBasicLDAPAuthenticator.initialInternalClientPassword`**
2023-03-02 14:19:32 -05:00
Initial [Password Provider ](../../operations/password-provider.md ) for the default internal system user, used for internal process communication. If no password is specified, the default internal system user will not be created. If the default internal system user already exists, setting this property will not affect its password.< br />
**Required**: No< br / >
2022-11-29 12:26:32 -05:00
**Default**: null
**`druid.auth.authenticator.MyBasicLDAPAuthenticator.enableCacheNotifications`**
2023-03-02 14:19:32 -05:00
If true, the Coordinator will notify Druid processes whenever a configuration change to this Authenticator occurs, allowing them to immediately update their state without waiting for polling.< br / >
**Required**: No< br / >
2022-11-29 12:26:32 -05:00
**Default**: true
**`druid.auth.authenticator.MyBasicLDAPAuthenticator.cacheNotificationTimeout`**
2023-03-02 14:19:32 -05:00
The timeout in milliseconds for the cache notifications.< br / >
**Required**: No< br / >
2022-11-29 12:26:32 -05:00
**Default**: 5000
**`druid.auth.authenticator.MyBasicLDAPAuthenticator.credentialIterations`**
2023-03-02 14:19:32 -05:00
Number of iterations to use for password hashing.< br / >
**Required**: No< br / >
2022-11-29 12:26:32 -05:00
**Default**: 10000
**`druid.auth.authenticator.MyBasicLDAPAuthenticator.credentialsValidator.type`**
2023-03-02 14:19:32 -05:00
The type of credentials store (ldap) to validate requests credentials.< br / >
**Required**: No< br / >
2022-11-29 12:26:32 -05:00
**Default**: metadata
**`druid.auth.authenticator.MyBasicLDAPAuthenticator.credentialsValidator.url`**
2023-03-02 14:19:32 -05:00
URL of the LDAP server.< br / >
**Required**: Yes< br / >
2022-11-29 12:26:32 -05:00
**Default**: null
**`druid.auth.authenticator.MyBasicLDAPAuthenticator.credentialsValidator.bindUser`**
2023-03-02 14:19:32 -05:00
LDAP bind user username.< br / >
**Required**: Yes< br / >
2022-11-29 12:26:32 -05:00
**Default**: null
**`druid.auth.authenticator.MyBasicLDAPAuthenticator.credentialsValidator.bindPassword`**
2023-03-02 14:19:32 -05:00
[Password Provider ](../../operations/password-provider.md ) LDAP bind user password.< br />
**Required**: Yes< br / >
2022-11-29 12:26:32 -05:00
**Default**: null
**`druid.auth.authenticator.MyBasicLDAPAuthenticator.credentialsValidator.baseDn`**
2023-03-02 14:19:32 -05:00
The point from where the LDAP server will search for users.< br / >
**Required**: Yes< br / >
2022-11-29 12:26:32 -05:00
**Default**: null
**`druid.auth.authenticator.MyBasicLDAPAuthenticator.credentialsValidator.userSearch`**
2023-03-02 14:19:32 -05:00
The filter/expression to use for the search. For example, (& (sAMAccountName=%s)(objectClass=user))< br / >
**Required**: Yes< br / >
2022-11-29 12:26:32 -05:00
**Default**: null
**`druid.auth.authenticator.MyBasicLDAPAuthenticator.credentialsValidator.userAttribute`**
2023-03-02 14:19:32 -05:00
The attribute id identifying the attribute that will be returned as part of the search. For example, sAMAccountName.< br / >
**Required**: Yes< br / >
2022-11-29 12:26:32 -05:00
**Default**: null
**`druid.auth.authenticator.MyBasicLDAPAuthenticator.credentialsValidator.credentialVerifyDuration`**
2023-03-02 14:19:32 -05:00
The duration in seconds for how long valid credentials are verifiable within the cache when not requested.< br / >
**Required**: No< br / >
2022-11-29 12:26:32 -05:00
**Default**: 600
**`druid.auth.authenticator.MyBasicLDAPAuthenticator.credentialsValidator.credentialMaxDuration`**
2023-03-02 14:19:32 -05:00
The max duration in seconds for valid credentials that can reside in cache regardless of how often they are requested.< br / >
**Required**: No< br / >
2022-11-29 12:26:32 -05:00
**Default**: 3600
**`druid.auth.authenticator.MyBasicLDAPAuthenticator.credentialsValidator.credentialCacheSize`**
2023-03-02 14:19:32 -05:00
The valid credentials cache size. The cache uses a LRU policy.< br / >
**Required**: No< br / >
2022-11-29 12:26:32 -05:00
**Default**: 100
**`druid.auth.authenticator.MyBasicLDAPAuthenticator.skipOnFailure`**
2023-03-02 14:19:32 -05:00
If true and the request credential doesn't exists or isn't fully configured in the credentials store, the request will proceed to next Authenticator in the chain.< br / >
**Required**: No< br / >
2022-11-29 12:26:32 -05:00
**Default**: false
**`druid.auth.authenticator.MyBasicLDAPAuthenticator.authorizerName`**
2023-03-02 14:19:32 -05:00
Authorizer that requests should be directed to.< br / >
**Required**: Yes< br / >
2022-11-29 12:26:32 -05:00
**Default**: N/A
2017-12-14 13:36:04 -05:00
2021-10-08 17:45:09 -04:00
### Escalator
2017-12-14 13:36:04 -05:00
2021-10-08 17:45:09 -04:00
The Escalator determines the authentication scheme to use for internal Druid cluster communications, for example, when a Broker service communicates with a Historical service during query processing.
Example configuration:
2017-12-14 13:36:04 -05:00
```
# Escalator
druid.escalator.type=basic
druid.escalator.internalClientUsername=druid_system
druid.escalator.internalClientPassword=password2
2019-10-08 20:08:27 -04:00
druid.escalator.authorizerName=MyBasicMetadataAuthorizer
2017-12-14 13:36:04 -05:00
```
#### Properties
2022-11-29 12:26:32 -05:00
**`druid.escalator.internalClientUsername`**
2023-03-02 14:19:32 -05:00
The escalator will use this username for requests made as the internal system user.< br / >
**Required**: Yes< br / >
2022-11-29 12:26:32 -05:00
**Default**: N/A
**`druid.escalator.internalClientPassword`**
2023-03-02 14:19:32 -05:00
The escalator will use this [Password Provider ](../../operations/password-provider.md ) for requests made as the internal system user.< br />
**Required**: Yes< br / >
2022-11-29 12:26:32 -05:00
**Default**: N/A
**`druid.escalator.authorizerName`**
2023-03-02 14:19:32 -05:00
Authorizer that requests should be directed to.< br / >
**Required**: Yes< br / >
2022-11-29 12:26:32 -05:00
**Default**: N/A
2017-12-14 13:36:04 -05:00
2021-10-08 17:45:09 -04:00
### Authorizer
2017-12-14 13:36:04 -05:00
2019-10-08 20:08:27 -04:00
To use the Basic authorizer, add an authorizer with type `basic` to the authorizers list.
2017-12-14 13:36:04 -05:00
2021-10-08 17:45:09 -04:00
Use the following syntax to configure a named authorizer:
2017-12-14 13:36:04 -05:00
```
druid.auth.authorizer.< authorizerName > .< authorizerProperty >
```
2021-10-08 17:45:09 -04:00
Example configuration:
```
# Authorizer
druid.auth.authorizers=["MyBasicMetadataAuthorizer"]
druid.auth.authorizer.MyBasicMetadataAuthorizer.type=basic
```
The examples in the rest of this article use `MyBasicMetadataAuthorizer` or `MyBasicLDAPAuthorizer` as the authorizer name.
2019-10-08 20:08:27 -04:00
#### Properties for Druid metadata store user authorization
2022-11-29 12:26:32 -05:00
**`druid.auth.authorizer.MyBasicMetadataAuthorizer.enableCacheNotifications`**
2023-03-02 14:19:32 -05:00
If true, the Coordinator will notify Druid processes whenever a configuration change to this Authorizer occurs, allowing them to immediately update their state without waiting for polling.< br / >
**Required**: No< br / >
2022-11-29 12:26:32 -05:00
**Default**: true
**`druid.auth.authorizer.MyBasicMetadataAuthorizer.cacheNotificationTimeout`**
2023-03-02 14:19:32 -05:00
The timeout in milliseconds for the cache notifications.< br / >
**Required**: No< br / >
2022-11-29 12:26:32 -05:00
**Default**: 5000
**`druid.auth.authorizer.MyBasicMetadataAuthorizer.initialAdminUser`**
2023-03-02 14:19:32 -05:00
The initial admin user with role defined in initialAdminRole property if specified, otherwise the default admin role will be assigned.< br / >
**Required**: No< br / >
2022-11-29 12:26:32 -05:00
**Default**: admin
**`druid.auth.authorizer.MyBasicMetadataAuthorizer.initialAdminRole`**
2023-03-02 14:19:32 -05:00
The initial admin role to create if it doesn't already exists.< br / >
**Required**: No< br / >
2022-11-29 12:26:32 -05:00
**Default**: admin
**`druid.auth.authorizer.MyBasicMetadataAuthorizer.roleProvider.type`**
2023-03-02 14:19:32 -05:00
The type of role provider to authorize requests credentials.< br / >
**Required**: No< br / >
2022-11-29 12:26:32 -05:00
**Default**: metadata
2019-10-08 20:08:27 -04:00
#### Properties for LDAP user authorization
2022-11-29 12:26:32 -05:00
**`druid.auth.authorizer.MyBasicLDAPAuthorizer.enableCacheNotifications`**
2023-03-02 14:19:32 -05:00
If true, the Coordinator will notify Druid processes whenever a configuration change to this Authorizer occurs, allowing them to immediately update their state without waiting for polling.< br / >
**Required**: No< br / >
2022-11-29 12:26:32 -05:00
**Default**: true
**`druid.auth.authorizer.MyBasicLDAPAuthorizer.cacheNotificationTimeout`**
2023-03-02 14:19:32 -05:00
The timeout in milliseconds for the cache notifications.< br / >
**Required**: No< br / >
2022-11-29 12:26:32 -05:00
**Default**: 5000
**`druid.auth.authorizer.MyBasicLDAPAuthorizer.initialAdminUser`**
2023-03-02 14:19:32 -05:00
The initial admin user with role defined in initialAdminRole property if specified, otherwise the default admin role will be assigned.< br / >
**Required**: No< br / >
2022-11-29 12:26:32 -05:00
**Default**: admin
**`druid.auth.authorizer.MyBasicLDAPAuthorizer.initialAdminRole`**
2023-03-02 14:19:32 -05:00
The initial admin role to create if it doesn't already exists.< br / >
**Required**: No< br / >
2022-11-29 12:26:32 -05:00
**Default**: admin
**`druid.auth.authorizer.MyBasicLDAPAuthorizer.initialAdminGroupMapping`**
2023-03-02 14:19:32 -05:00
The initial admin group mapping with role defined in initialAdminRole property if specified, otherwise the default admin role will be assigned. The name of this initial admin group mapping will be set to adminGroupMapping< br / >
**Required**: No< br / >
2022-11-29 12:26:32 -05:00
**Default**: null
**`druid.auth.authorizer.MyBasicLDAPAuthorizer.roleProvider.type`**
2023-03-02 14:19:32 -05:00
The type of role provider (ldap) to authorize requests credentials.< br / >
**Required**: No< br / >
2022-11-29 12:26:32 -05:00
**Default**: metadata
**`druid.auth.authorizer.MyBasicLDAPAuthorizer.roleProvider.groupFilters`**
2023-03-02 14:19:32 -05:00
Array of LDAP group filters used to filter out the allowed set of groups returned from LDAP search. Filters can be begin with *, or end with ,* to provide configurational flexibility to limit or filter allowed set of groups available to LDAP Authorizer.< br />
**Required**: No< br / >
2022-11-29 12:26:32 -05:00
**Default**: null
#### Properties for LDAPS
Use the following properties to configure Druid authentication with LDAP over TLS (LDAPS). See [Configure LDAP authentication ](../../operations/auth-ldap.md ) for more information.
**`druid.auth.basic.ssl.protocol`**
2023-03-02 14:19:32 -05:00
SSL protocol to use. The TLS version is 1.2.< br / >
**Required**: Yes< br / >
2022-11-29 12:26:32 -05:00
**Default**: tls
**`druid.auth.basic.ssl.trustStorePath`**
2023-03-02 14:19:32 -05:00
Path to the trust store file.< br / >
**Required**: Yes< br / >
2022-11-29 12:26:32 -05:00
**Default**: N/A
**`druid.auth.basic.ssl.trustStorePassword`**
2023-03-02 14:19:32 -05:00
Password to access the trust store file.< br / >
**Required**: Yes< br / >
2022-11-29 12:26:32 -05:00
**Default**: N/A
**`druid.auth.basic.ssl.trustStoreType`**
2023-03-02 14:19:32 -05:00
Format of the trust store file. For Java the format is jks.< br / >
**Required**: No< br / >
2022-11-29 12:26:32 -05:00
**Default**: jks
**`druid.auth.basic.ssl.trustStoreAlgorithm`**
2023-03-02 14:19:32 -05:00
Algorithm used by the trust manager to validate certificate chains.< br / >
**Required**: No< br / >
2022-11-29 12:26:32 -05:00
**Default**: N/A
**`druid.auth.basic.ssl.trustStorePassword`**
2023-03-02 14:19:32 -05:00
Password details that enable access to the truststore.< br / >
**Required**: No< br / >
2022-11-29 12:26:32 -05:00
**Default**: N/A
Example LDAPS configuration:
```json
druid.auth.basic.ssl.protocol=tls
druid.auth.basic.ssl.trustStorePath=/usr/local/druid-path/certs/truststore.jks
druid.auth.basic.ssl.trustStorePassword=xxxxx
druid.auth.basic.ssl.trustStoreType=jks
druid.auth.basic.ssl.trustStoreAlgorithm=PKIX
```
You can configure `druid.auth.basic.ssl.trustStorePassword` to be a plain text password or you can set the password as an environment variable. See [Password providers ](../../operations/password-provider.md ) for more information.
2017-12-14 13:36:04 -05:00
## Usage
### Coordinator Security API
To use these APIs, a user needs read/write permissions for the CONFIG resource type with name "security".
#### Authentication API
Root path: `/druid-ext/basic-security/authentication`
Each API endpoint includes {authenticatorName}, specifying which Authenticator instance is being configured.
##### User/Credential Management
2023-03-02 14:19:32 -05:00
`GET(/druid-ext/basic-security/authentication/db/{authenticatorName}/users)` < br />
2017-12-14 13:36:04 -05:00
Return a list of all user names.
2023-03-02 14:19:32 -05:00
`GET(/druid-ext/basic-security/authentication/db/{authenticatorName}/users/{userName})` < br />
2017-12-14 13:36:04 -05:00
Return the name and credentials information of the user with name {userName}
2023-03-02 14:19:32 -05:00
`POST(/druid-ext/basic-security/authentication/db/{authenticatorName}/users/{userName})` < br />
2017-12-14 13:36:04 -05:00
Create a new user with name {userName}
2023-03-02 14:19:32 -05:00
`DELETE(/druid-ext/basic-security/authentication/db/{authenticatorName}/users/{userName})` < br />
2017-12-14 13:36:04 -05:00
Delete the user with name {userName}
2023-03-02 14:19:32 -05:00
`POST(/druid-ext/basic-security/authentication/db/{authenticatorName}/users/{userName}/credentials)` < br />
2017-12-14 13:36:04 -05:00
Assign a password used for HTTP basic authentication for {userName}
Content: JSON password request object
Example request body:
```
{
"password": "helloworld"
}
```
##### Cache Load Status
2023-03-02 14:19:32 -05:00
`GET(/druid-ext/basic-security/authentication/loadStatus)` < br />
2019-10-08 20:08:27 -04:00
Return the current load status of the local caches of the authentication Druid metadata store.
2017-12-14 13:36:04 -05:00
#### Authorization API
2023-03-02 14:19:32 -05:00
Root path: `/druid-ext/basic-security/authorization` < br />
2017-12-14 13:36:04 -05:00
Each API endpoint includes {authorizerName}, specifying which Authorizer instance is being configured.
##### User Creation/Deletion
2023-03-02 14:19:32 -05:00
`GET(/druid-ext/basic-security/authorization/db/{authorizerName}/users)` < br />
2017-12-14 13:36:04 -05:00
Return a list of all user names.
2023-03-02 14:19:32 -05:00
`GET(/druid-ext/basic-security/authorization/db/{authorizerName}/users/{userName})` < br />
2017-12-14 13:36:04 -05:00
Return the name and role information of the user with name {userName}
2019-05-15 15:59:32 -04:00
Example output:
2019-07-15 12:55:18 -04:00
2019-05-15 15:59:32 -04:00
```json
{
"name": "druid2",
"roles": [
"druidRole"
]
}
```
This API supports the following flags:
2019-07-15 12:55:18 -04:00
2019-05-15 15:59:32 -04:00
- `?full` : The response will also include the full information for each role currently assigned to the user.
Example output:
2019-07-15 12:55:18 -04:00
2019-05-15 15:59:32 -04:00
```json
{
"name": "druid2",
"roles": [
{
"name": "druidRole",
"permissions": [
{
"resourceAction": {
"resource": {
"name": "A",
"type": "DATASOURCE"
},
"action": "READ"
},
"resourceNamePattern": "A"
},
{
"resourceAction": {
"resource": {
"name": "C",
"type": "CONFIG"
},
"action": "WRITE"
},
"resourceNamePattern": "C"
}
]
}
]
}
```
2019-08-21 00:48:59 -04:00
The output format of this API when `?full` is specified is deprecated and in later versions will be switched to the output format used when both `?full` and `?simplifyPermissions` flag is set.
2019-05-15 15:59:32 -04:00
The `resourceNamePattern` is a compiled version of the resource name regex. It is redundant and complicates the use of this API for clients such as frontends that edit the authorization configuration, as the permission format in this output does not match the format used for adding permissions to a role.
- `?full?simplifyPermissions` : When both `?full` and `?simplifyPermissions` are set, the permissions in the output will contain only a list of `resourceAction` objects, without the extraneous `resourceNamePattern` field.
```json
{
"name": "druid2",
"roles": [
{
"name": "druidRole",
"users": null,
"permissions": [
{
"resource": {
"name": "A",
"type": "DATASOURCE"
},
"action": "READ"
},
{
"resource": {
"name": "C",
"type": "CONFIG"
},
"action": "WRITE"
}
]
}
]
}
```
2023-03-02 14:19:32 -05:00
`POST(/druid-ext/basic-security/authorization/db/{authorizerName}/users/{userName})` < br />
2017-12-14 13:36:04 -05:00
Create a new user with name {userName}
2023-03-02 14:19:32 -05:00
`DELETE(/druid-ext/basic-security/authorization/db/{authorizerName}/users/{userName})` < br />
2017-12-14 13:36:04 -05:00
Delete the user with name {userName}
2019-10-08 20:08:27 -04:00
##### Group mapping Creation/Deletion
2023-03-02 14:19:32 -05:00
`GET(/druid-ext/basic-security/authorization/db/{authorizerName}/groupMappings)` < br />
2019-10-08 20:08:27 -04:00
Return a list of all group mappings.
2023-03-02 14:19:32 -05:00
`GET(/druid-ext/basic-security/authorization/db/{authorizerName}/groupMappings/{groupMappingName})` < br />
2019-10-08 20:08:27 -04:00
Return the group mapping and role information of the group mapping with name {groupMappingName}
2023-03-02 14:19:32 -05:00
`POST(/druid-ext/basic-security/authorization/db/{authorizerName}/groupMappings/{groupMappingName})` < br />
2019-10-08 20:08:27 -04:00
Create a new group mapping with name {groupMappingName}
Content: JSON group mapping object
Example request body:
```
{
"name": "user",
"groupPattern": "CN=aaa,OU=aaa,OU=Groupings,DC=corp,DC=company,DC=com",
"roles": [
"user"
]
}
```
2023-03-02 14:19:32 -05:00
`DELETE(/druid-ext/basic-security/authorization/db/{authorizerName}/groupMappings/{groupMappingName})` < br />
2019-10-08 20:08:27 -04:00
Delete the group mapping with name {groupMappingName}
2017-12-14 13:36:04 -05:00
#### Role Creation/Deletion
2023-03-02 14:19:32 -05:00
`GET(/druid-ext/basic-security/authorization/db/{authorizerName}/roles)` < br />
2017-12-14 13:36:04 -05:00
Return a list of all role names.
2023-03-02 14:19:32 -05:00
`GET(/druid-ext/basic-security/authorization/db/{authorizerName}/roles/{roleName})` < br />
2019-05-15 15:59:32 -04:00
Return name and permissions for the role named {roleName}.
Example output:
2019-07-15 12:55:18 -04:00
2019-05-15 15:59:32 -04:00
```json
{
"name": "druidRole2",
"permissions": [
{
"resourceAction": {
"resource": {
"name": "E",
"type": "DATASOURCE"
},
"action": "WRITE"
},
"resourceNamePattern": "E"
}
]
}
```
The default output format of this API is deprecated and in later versions will be switched to the output format used when the `?simplifyPermissions` flag is set. The `resourceNamePattern` is a compiled version of the resource name regex. It is redundant and complicates the use of this API for clients such as frontends that edit the authorization configuration, as the permission format in this output does not match the format used for adding permissions to a role.
This API supports the following flags:
- `?full` : The output will contain an extra `users` list, containing the users that currently have this role.
```json
2019-10-08 20:08:27 -04:00
{"users":["druid"]}
2019-05-15 15:59:32 -04:00
```
- `?simplifyPermissions` : The permissions in the output will contain only a list of `resourceAction` objects, without the extraneous `resourceNamePattern` field. The `users` field will be null when `?full` is not specified.
Example output:
2019-07-15 12:55:18 -04:00
2019-05-15 15:59:32 -04:00
```json
{
"name": "druidRole2",
"users": null,
"permissions": [
{
"resource": {
"name": "E",
"type": "DATASOURCE"
},
"action": "WRITE"
}
]
}
```
2017-12-14 13:36:04 -05:00
2023-03-02 14:19:32 -05:00
`POST(/druid-ext/basic-security/authorization/db/{authorizerName}/roles/{roleName})` < br />
2017-12-14 13:36:04 -05:00
Create a new role with name {roleName}.
Content: username string
2023-03-02 14:19:32 -05:00
`DELETE(/druid-ext/basic-security/authorization/db/{authorizerName}/roles/{roleName})` < br />
2017-12-14 13:36:04 -05:00
Delete the role with name {roleName}.
#### Role Assignment
2023-03-02 14:19:32 -05:00
`POST(/druid-ext/basic-security/authorization/db/{authorizerName}/users/{userName}/roles/{roleName})` < br />
2017-12-14 13:36:04 -05:00
Assign role {roleName} to user {userName}.
2023-03-02 14:19:32 -05:00
`DELETE(/druid-ext/basic-security/authorization/db/{authorizerName}/users/{userName}/roles/{roleName})` < br />
2017-12-14 13:36:04 -05:00
Unassign role {roleName} from user {userName}
2023-03-02 14:19:32 -05:00
`POST(/druid-ext/basic-security/authorization/db/{authorizerName}/groupMappings/{groupMappingName}/roles/{roleName})` < br />
2019-10-08 20:08:27 -04:00
Assign role {roleName} to group mapping {groupMappingName}.
2023-03-02 14:19:32 -05:00
`DELETE(/druid-ext/basic-security/authorization/db/{authorizerName}/groupMappings/{groupMappingName}/roles/{roleName})` < br />
2019-10-08 20:08:27 -04:00
Unassign role {roleName} from group mapping {groupMappingName}
2017-12-14 13:36:04 -05:00
#### Permissions
2023-03-02 14:19:32 -05:00
`POST(/druid-ext/basic-security/authorization/db/{authorizerName}/roles/{roleName}/permissions)` < br />
2017-12-14 13:36:04 -05:00
Set the permissions of {roleName}. This replaces the previous set of permissions on the role.
Content: List of JSON Resource-Action objects, e.g.:
2019-07-24 18:26:03 -04:00
2017-12-14 13:36:04 -05:00
```
[
2018-12-12 23:42:12 -05:00
{
2017-12-14 13:36:04 -05:00
"resource": {
"name": "wiki.*",
"type": "DATASOURCE"
},
"action": "READ"
},
2018-12-12 23:42:12 -05:00
{
2017-12-14 13:36:04 -05:00
"resource": {
"name": "wikiticker",
"type": "DATASOURCE"
},
"action": "WRITE"
}
]
```
2018-12-12 23:42:12 -05:00
The "name" field for resources in the permission definitions are regexes used to match resource names during authorization checks.
2017-12-14 13:36:04 -05:00
2020-11-19 18:24:58 -05:00
Please see [Defining permissions ](../../operations/security-user-auth.md#defining-permissions ) for more details.
2017-12-14 13:36:04 -05:00
##### Cache Load Status
2023-03-02 14:19:32 -05:00
`GET(/druid-ext/basic-security/authorization/loadStatus)` < br />
2019-10-08 20:08:27 -04:00
Return the current load status of the local caches of the authorization Druid metadata store.