trino-opa-demo

Trino Access Control with OPA

This repository guides you through the process of setting up Trino with OPA for access control.

Considerations

Architecture (Docker)

Docker Architecture

Running Trino Cluster with OPA Locally

Setting up Github SSH Key (Optional)

If you are using a private repository for the policy files in OPAL Server, you need to add the SSH Public key to the GitHub repository as a deploy key. Read OPAL Documentation

Setting up Environment Variables for OPAL Server

Running Docker Compose

Create a .env file with the variables from .env.sample and run the following command:

docker compose up -d

Docker Compose

Create User, Groups & Policies

Please use this Postman Collection to create users, groups, and policies.

Running queries in Trino through Trino CLI

For this demo, I have created a user nilanjan172nsvian@gmail.com and associated it with the group sales and with the following access policy:

trino --server localhost:8081 --user nilanjan172nsvian@gmail.com

Trino CLI-1 Trino CLI-2

trino --server localhost:8082 --user nilanjan172nsvian@gmail.com

Trino CLI-3

Changing Policies on Runtime

Now, I have created another group marketing and associated it with the following access policy:

trino --server localhost:8082 --user nilanjan172nsvian@gmail.com

Trino CLI-4 Trino CLI-5


References


Made with ❤️ by nil1729