Skip to content

Commit

Permalink
Document different regorules for v414 and v428 due to authorizer changes
Browse files Browse the repository at this point in the history
  • Loading branch information
maltesander committed Nov 2, 2023
1 parent 30ffb42 commit d922089
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---
apiVersion: v1
kind: ConfigMap
metadata:
name: opa-bundle-trino
labels:
opa.stackable.tech/bundle: "true"
data:
trino.rego: |
package trino
import future.keywords.in
default allow = false
allow {
is_admin
}
extended[i] {
some i
input.action.filterResources[i]
is_admin
}
is_admin() {
input.context.identity.user == "admin"
}
13 changes: 12 additions & 1 deletion docs/modules/trino/pages/usage-guide/security.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,20 @@ In the Trino CLI and web interface, LDAP users can now be used to log in.
In order to authorize Trino via OPA, a ConfigMap containing a rego rule package for Trino has to be applied and referenced in the TrinoCluster resource.
The following example is an all-access Rego rule for testing with the user `admin`. Do not use it in production!

NOTE: Due to changes in the Trino OPA authorizer, rego rules differ from Version 414 and 428. The OPA authorizer will become part of the Trino package once this https://github.com/trinodb/trino/pull/19532[pull request] is merged. The stackable Trino version 428 already uses that new OPA authorizer and utilizes https://github.com/bloomberg/trino/blob/add-open-policy-agent/plugin/trino-opa/README.md#batch-mode[batch mode]. This is under active development and is not stable yet!

=== Rego for Trino version 414

[source,yaml]
----
include::example$usage-guide/opa-bundle-trino-cm-414.yaml[]
----

=== Rego for Trino version 428

[source,yaml]
----
include::example$usage-guide/opa-bundle-trino-cm.yaml[]
include::example$usage-guide/opa-bundle-trino-cm-428.yaml[]
----

Reference the package in the Trino cluster:
Expand Down

0 comments on commit d922089

Please sign in to comment.