https://github.com/anderseknert/opa-kafka-docker-compose
Example of OPA authorization for Kafka using Docker Compose
https://github.com/anderseknert/opa-kafka-docker-compose
Last synced: 10 months ago
JSON representation
Example of OPA authorization for Kafka using Docker Compose
- Host: GitHub
- URL: https://github.com/anderseknert/opa-kafka-docker-compose
- Owner: anderseknert
- Created: 2021-11-15T15:25:42.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2021-11-30T04:53:32.000Z (about 4 years ago)
- Last Synced: 2025-03-14T20:50:41.821Z (10 months ago)
- Language: Shell
- Size: 6.84 KB
- Stars: 0
- Watchers: 4
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Open Policy Agent and Kafka
Example code for running Kafka with client certificates for authentication, and using OPA for authorization decisons.
## Setup
1. Copy an OPA configuration file (`opa-conf.yaml`) into the `opa` directory.
2. Copy the [OPA Kafka Authorizer Plugin](https://github.com/anderseknert/opa-kafka-plugin) into the `plugin` directory.
3. Run the `create_cert.sh` script to create server and client certificates. These will be found in the `cert` directory.
4. `docker compose up`
## Querying Kafka
Using the `alice` user with a client certificate.
### Producing to a topic
```shell
bin/kafka-console-producer.sh --broker-list localhost:9093 --topic test --producer.config path/to/cert/client/alice.properties
> My first message
> My second message
...
Ctrl+c
```
### Consuming from a topic
```shell
bin/kafka-console-consumer.sh --bootstrap-server localhost:9093 --topic test --consumer.config path/to/cert/client/alice.properties --from-beginning
My first message
My second message
...
Ctrl+c
Processed a total of 4 messages
```