-
-
Notifications
You must be signed in to change notification settings - Fork 561
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: add example to show full encryption
- Loading branch information
Showing
7 changed files
with
139 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 57 additions & 0 deletions
57
...mand/portals/kafka/redpanda/docker-field-encryption/data_team_consumer/docker-compose.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
--- | ||
networks: | ||
data_team: | ||
driver: bridge | ||
services: | ||
# Start a consumer node with ockam. | ||
# | ||
# Read kafka_client.dockerfile and run_ockam.sh to understand | ||
# how the node is set up. | ||
consumer: | ||
container_name: data-consumer | ||
build: | ||
context: . | ||
dockerfile: ../kafka_client.dockerfile | ||
args: | ||
OCKAM_VERSION: ${OCKAM_VERSION:-latest} | ||
volumes: | ||
- ./ockam-node.yaml:/ockam-node.yaml | ||
environment: | ||
ENROLLMENT_TICKET: ${DATA_CONSUMER_ENROLLMENT_TICKET:-} | ||
OCKAM_DEVELOPER: ${OCKAM_DEVELOPER:-false} | ||
networks: | ||
- data_team | ||
command: | ||
- -c | ||
- ( | ||
set -e | ||
|
||
sleep 10 | ||
|
||
ockam node create ./ockam-node.yaml --enrollment-ticket $${ENROLLMENT_TICKET} & | ||
|
||
sleep 14 | ||
|
||
echo ""; | ||
echo "Messages sent from producers will appear shortly."; | ||
echo "It may take a couple of minutes for the first message to appear."; | ||
echo "======================================================================="; | ||
echo "Press Ctrl+C to stop the container at any time, then execute "\ | ||
"'./run.sh cleanup' to remove all containers."; | ||
echo ""; | ||
kafka-console-consumer.sh --topic data_team_topic --timeout-ms 50000 --bootstrap-server 127.0.0.1:9092 --max-messages 8 | tee output.txt; | ||
if [[ ! -s output.txt ]]; then | ||
echo "Failed to receive messages"; | ||
exit 1; | ||
fi; | ||
|
||
echo ""; | ||
echo "The example run was successful 🥳."; | ||
echo "The consumer was able to decrypt encrypted message"; | ||
echo ""; | ||
|
||
echo "======================================================================="; | ||
echo "Open the console at http://127.0.0.1:8080 to see the encryted message."; | ||
echo "======================================================================="; | ||
tail -f /dev/null; | ||
) |
8 changes: 8 additions & 0 deletions
8
...command/portals/kafka/redpanda/docker-field-encryption/data_team_consumer/ockam-node.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
relay: data-consumer | ||
|
||
kafka-inlet: | ||
from: 127.0.0.1:9092 | ||
to: /project/default/service/forward_to_redpanda/secure/api | ||
avoid-publishing: true | ||
allow-producer: data-producer | ||
allow: redpanda |
54 changes: 54 additions & 0 deletions
54
...mand/portals/kafka/redpanda/docker-field-encryption/data_team_producer/docker-compose.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
--- | ||
networks: | ||
data_team: | ||
driver: bridge | ||
services: | ||
# Start a producer node with ockam. | ||
# | ||
# Read kafka_client.dockerfile and run_ockam.sh to understand | ||
# how the node is set up | ||
producer: | ||
container_name: data-producer | ||
build: | ||
context: . | ||
dockerfile: ../kafka_client.dockerfile | ||
volumes: | ||
- ./ockam-node.yaml:/ockam-node.yaml | ||
environment: | ||
ENROLLMENT_TICKET: ${DATA_PRODUCER_ENROLLMENT_TICKET:-} | ||
OCKAM_DEVELOPER: ${OCKAM_DEVELOPER:-false} | ||
networks: | ||
- data_team | ||
command: | ||
- -c | ||
- | | ||
set -e | ||
sleep 17 | ||
ockam node create -vv ./ockam-node.yaml --enrollment-ticket $${ENROLLMENT_TICKET} & | ||
sleep 20 | ||
MESSAGES=( | ||
'{"id":"1234","first_name":"Red","age":22,"job":"writer","pii":{"last_name":"Jones","ssn":"777-223-4344","zip":98208}}' | ||
'{"id":"5678","first_name":"Blue","age":35,"job":"developer","pii":{"last_name":"Smith","ssn":"555-867-5309","zip":10001}}' | ||
'{"id":"9012","first_name":"Green","age":28,"job":"designer","pii":{"last_name":"Johnson","ssn":"123-456-7890","zip":60601}}' | ||
'{"id":"3456","first_name":"Yellow","age":41,"job":"manager","pii":{"last_name":"Brown","ssn":"999-888-7777","zip":90210}}' | ||
'{"id":"7890","first_name":"Purple","age":19,"job":"student","pii":{"last_name":"Davis","ssn":"111-222-3333","zip":20001}}' | ||
'{"id":"2345","first_name":"Orange","age":55,"job":"consultant","pii":{"last_name":"Wilson","ssn":"444-555-6666","zip":75001}}' | ||
'{"id":"6789","first_name":"Pink","age":33,"job":"artist","pii":{"last_name":"Taylor","ssn":"888-999-0000","zip":80202}}' | ||
'{"id":"0123","first_name":"Gray","age":47,"job":"scientist","pii":{"last_name":"Anderson","ssn":"222-333-4444","zip":94103}}' | ||
) | ||
for n in {0..7}; do | ||
sleep 2 | ||
echo "Sending message: $${MESSAGES[n]}" | ||
echo -n "$${MESSAGES[n]}" | kafka-console-producer.sh \ | ||
--topic data_team_topic \ | ||
--bootstrap-server 127.0.0.1:9092 \ | ||
--producer-property request.timeout.ms=30000 | ||
done | ||
# Keep the container running | ||
tail -f /dev/null |
7 changes: 7 additions & 0 deletions
7
...command/portals/kafka/redpanda/docker-field-encryption/data_team_producer/ockam-node.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
kafka-inlet: | ||
from: 127.0.0.1:9092 | ||
to: /project/default/service/forward_to_redpanda/secure/api | ||
consumer: /project/default/service/forward_to_data-consumer/secure/api | ||
avoid-publishing: true | ||
allow-consumer: data-consumer | ||
allow: redpanda |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters