2021-02-23 16:29:57 -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.
|
|
|
|
dn: ou=Users,dc=example,dc=org
|
|
|
|
objectClass: top
|
|
|
|
objectClass: organizationalUnit
|
|
|
|
ou: Users
|
|
|
|
|
|
|
|
dn: ou=Groups,dc=example,dc=org
|
|
|
|
objectClass: top
|
|
|
|
objectClass: organizationalUnit
|
|
|
|
ou: Groups
|
|
|
|
|
|
|
|
dn: uid=admin,ou=Users,dc=example,dc=org
|
|
|
|
uid: admin
|
|
|
|
cn: admin
|
|
|
|
sn: admin
|
|
|
|
objectClass: top
|
|
|
|
objectClass: posixAccount
|
|
|
|
objectClass: inetOrgPerson
|
|
|
|
homeDirectory: /home/admin
|
|
|
|
uidNumber: 1
|
|
|
|
gidNumber: 1
|
|
|
|
userPassword: priest
|
|
|
|
|
|
|
|
dn: uid=druid_system,ou=Users,dc=example,dc=org
|
|
|
|
uid: druid_system
|
|
|
|
cn: druid_system
|
|
|
|
sn: druid_system
|
|
|
|
objectClass: top
|
|
|
|
objectClass: posixAccount
|
|
|
|
objectClass: inetOrgPerson
|
|
|
|
homeDirectory: /home/druid_system
|
|
|
|
uidNumber: 2
|
|
|
|
gidNumber: 2
|
|
|
|
userPassword: warlock
|
|
|
|
|
|
|
|
dn: cn=admin,ou=Groups,dc=example,dc=org
|
|
|
|
objectClass: groupOfUniqueNames
|
|
|
|
cn: admin
|
|
|
|
description: Admin users
|
|
|
|
uniqueMember: uid=admin,ou=Users,dc=example,dc=org
|
|
|
|
uniqueMember: uid=druid_system,ou=Users,dc=example,dc=org
|
|
|
|
|
2021-10-25 05:20:38 -04:00
|
|
|
dn: uid=datasourceOnlyUser,ou=Users,dc=example,dc=org
|
|
|
|
uid: datasourceOnlyUser
|
|
|
|
cn: datasourceOnlyUser
|
|
|
|
sn: datasourceOnlyUser
|
2021-02-23 16:29:57 -05:00
|
|
|
objectClass: top
|
|
|
|
objectClass: posixAccount
|
|
|
|
objectClass: inetOrgPerson
|
2021-10-25 05:20:38 -04:00
|
|
|
homeDirectory: /home/datasourceOnlyUser
|
2021-02-23 16:29:57 -05:00
|
|
|
uidNumber: 3
|
|
|
|
gidNumber: 3
|
|
|
|
userPassword: helloworld
|
|
|
|
|
2021-10-25 05:20:38 -04:00
|
|
|
dn: cn=datasourceOnlyGroup,ou=Groups,dc=example,dc=org
|
2021-02-23 16:29:57 -05:00
|
|
|
objectClass: groupOfUniqueNames
|
2021-10-25 05:20:38 -04:00
|
|
|
cn: datasourceOnlyGroup
|
|
|
|
description: datasourceOnlyGroup users
|
|
|
|
uniqueMember: uid=datasourceOnlyUser,ou=Users,dc=example,dc=org
|
|
|
|
|
|
|
|
dn: uid=datasourceWithStateUser,ou=Users,dc=example,dc=org
|
|
|
|
uid: datasourceWithStateUser
|
|
|
|
cn: datasourceWithStateUser
|
|
|
|
sn: datasourceWithStateUser
|
2021-02-23 16:29:57 -05:00
|
|
|
objectClass: top
|
|
|
|
objectClass: posixAccount
|
|
|
|
objectClass: inetOrgPerson
|
2021-10-25 05:20:38 -04:00
|
|
|
homeDirectory: /home/datasourceWithStateUser
|
2021-02-23 16:29:57 -05:00
|
|
|
uidNumber: 4
|
|
|
|
gidNumber: 4
|
|
|
|
userPassword: helloworld
|
|
|
|
|
2021-10-25 05:20:38 -04:00
|
|
|
dn: cn=datasourceWithStateGroup,ou=Groups,dc=example,dc=org
|
2021-02-23 16:29:57 -05:00
|
|
|
objectClass: groupOfUniqueNames
|
2021-10-25 05:20:38 -04:00
|
|
|
cn: datasourceWithStateGroup
|
|
|
|
description: datasourceWithStateGroup users
|
|
|
|
uniqueMember: uid=datasourceWithStateUser,ou=Users,dc=example,dc=org
|
2021-02-23 16:29:57 -05:00
|
|
|
|
|
|
|
dn: uid=stateOnlyUser,ou=Users,dc=example,dc=org
|
|
|
|
uid: stateOnlyUser
|
|
|
|
cn: stateOnlyUser
|
|
|
|
sn: stateOnlyUser
|
|
|
|
objectClass: top
|
|
|
|
objectClass: posixAccount
|
|
|
|
objectClass: inetOrgPerson
|
|
|
|
homeDirectory: /home/stateOnlyUser
|
|
|
|
uidNumber: 5
|
|
|
|
gidNumber: 5
|
|
|
|
userPassword: helloworld
|
|
|
|
|
|
|
|
dn: cn=stateOnlyGroup,ou=Groups,dc=example,dc=org
|
|
|
|
objectClass: groupOfUniqueNames
|
|
|
|
cn: stateOnlyGroup
|
|
|
|
description: stateOnlyGroup users
|
|
|
|
uniqueMember: uid=stateOnlyUser,ou=Users,dc=example,dc=org
|
|
|
|
|
|
|
|
dn: uid=druid,ou=Users,dc=example,dc=org
|
|
|
|
uid: druid
|
|
|
|
cn: druid
|
|
|
|
sn: druid
|
|
|
|
objectClass: top
|
|
|
|
objectClass: posixAccount
|
|
|
|
objectClass: inetOrgPerson
|
|
|
|
homeDirectory: /home/druid
|
|
|
|
uidNumber: 6
|
|
|
|
gidNumber: 6
|
|
|
|
userPassword: helloworld
|
|
|
|
|
|
|
|
dn: cn=druidGroup,ou=Groups,dc=example,dc=org
|
|
|
|
objectClass: groupOfUniqueNames
|
|
|
|
cn: druidGroup
|
|
|
|
description: druidGroup users
|
|
|
|
uniqueMember: uid=druid,ou=Users,dc=example,dc=org
|
|
|
|
|
|
|
|
dn: uid=stateOnlyNoLdapGroup,ou=Users,dc=example,dc=org
|
|
|
|
uid: druid
|
|
|
|
cn: druid
|
|
|
|
sn: druid
|
|
|
|
objectClass: top
|
|
|
|
objectClass: posixAccount
|
|
|
|
objectClass: inetOrgPerson
|
|
|
|
homeDirectory: /home/druid
|
|
|
|
uidNumber: 7
|
|
|
|
gidNumber: 7
|
|
|
|
userPassword: helloworld
|
2021-09-21 16:28:26 -04:00
|
|
|
|
2021-10-25 05:20:38 -04:00
|
|
|
dn: uid=datasourceAndSysUser,ou=Users,dc=example,dc=org
|
|
|
|
uid: datasourceAndSysUser
|
|
|
|
cn: datasourceAndSysUser
|
|
|
|
sn: datasourceAndSysUser
|
2021-09-21 16:28:26 -04:00
|
|
|
objectClass: top
|
|
|
|
objectClass: posixAccount
|
|
|
|
objectClass: inetOrgPerson
|
2021-10-25 05:20:38 -04:00
|
|
|
homeDirectory: /home/datasourceAndSysUser
|
2021-09-21 16:28:26 -04:00
|
|
|
uidNumber: 8
|
|
|
|
gidNumber: 8
|
|
|
|
userPassword: helloworld
|
|
|
|
|
2021-10-25 05:20:38 -04:00
|
|
|
dn: cn=datasourceWithSysGroup,ou=Groups,dc=example,dc=org
|
2021-09-21 16:28:26 -04:00
|
|
|
objectClass: groupOfUniqueNames
|
2021-10-25 05:20:38 -04:00
|
|
|
cn: datasourceWithSysGroup
|
|
|
|
description: datasourceWithSysGroup users
|
|
|
|
uniqueMember: uid=datasourceAndSysUser,ou=Users,dc=example,dc=org
|
Add support for authorizing query context params (#12396)
The query context is a way that the user gives a hint to the Druid query engine, so that they enforce a certain behavior or at least let the query engine prefer a certain plan during query planning. Today, there are 3 types of query context params as below.
Default context params. They are set via druid.query.default.context in runtime properties. Any user context params can be default params.
User context params. They are set in the user query request. See https://druid.apache.org/docs/latest/querying/query-context.html for parameters.
System context params. They are set by the Druid query engine during query processing. These params override other context params.
Today, any context params are allowed to users. This can cause
1) a bad UX if the context param is not matured yet or
2) even query failure or system fault in the worst case if a sensitive param is abused, ex) maxSubqueryRows.
This PR adds an ability to limit context params per user role. That means, a query will fail if you have a context param set in the query that is not allowed to you. To do that, this PR adds a new built-in resource type, QUERY_CONTEXT. The resource to authorize has a name of the context param (such as maxSubqueryRows) and the type of QUERY_CONTEXT. To allow a certain context param for a user, the user should be granted WRITE permission on the context param resource. Here is an example of the permission.
{
"resourceAction" : {
"resource" : {
"name" : "maxSubqueryRows",
"type" : "QUERY_CONTEXT"
},
"action" : "WRITE"
},
"resourceNamePattern" : "maxSubqueryRows"
}
Each role can have multiple permissions for context params. Each permission should be set for different context params.
When a query is issued with a query context X, the query will fail if the user who issued the query does not have WRITE permission on the query context X. In this case,
HTTP endpoints will return 403 response code.
JDBC will throw ForbiddenException.
Note: there is a context param called brokerService that is used only by the router. This param is used to pin your query to run it in a specific broker. Because the authorization is done not in the router, but in the broker, if you have brokerService set in your query without a proper permission, your query will fail in the broker after routing is done. Technically, this is not right because the authorization is checked after the context param takes effect. However, this should not cause any user-facing issue and thus should be OK. The query will still fail if the user doesn’t have permission for brokerService.
The context param authorization can be enabled using druid.auth.authorizeQueryContextParams. This is disabled by default to avoid any hassle when someone upgrades his cluster blindly without reading release notes.
2022-04-21 04:51:16 -04:00
|
|
|
|
|
|
|
dn: uid=datasourceAndContextParamsUser,ou=Users,dc=example,dc=org
|
|
|
|
uid: datasourceAndContextParamsUser
|
|
|
|
cn: datasourceAndContextParamsUser
|
|
|
|
sn: datasourceAndContextParamsUser
|
|
|
|
objectClass: top
|
|
|
|
objectClass: posixAccount
|
|
|
|
objectClass: inetOrgPerson
|
|
|
|
homeDirectory: /home/datasourceAndContextParamsUser
|
|
|
|
uidNumber: 9
|
|
|
|
gidNumber: 9
|
|
|
|
userPassword: helloworld
|
|
|
|
|
|
|
|
dn: cn=datasourceAndContextParamsGroup,ou=Groups,dc=example,dc=org
|
|
|
|
objectClass: groupOfUniqueNames
|
|
|
|
cn: datasourceAndContextParamsGroup
|
|
|
|
description: datasourceAndContextParamsGroup users
|
|
|
|
uniqueMember: uid=datasourceAndContextParamsUser,ou=Users,dc=example,dc=org
|