This project demonstrates a basic Docker Compose setup for running Logstash and Kafka with SASL/SCRAM authentication and data encryption using the cipher filter in Logstash.
- Docker
- Docker Compose
- Zookeeper: Manages Kafka cluster metadata and maintains the cluster configuration.
- Kafka: Handles real-time data feeds with SASL/SCRAM authentication enabled for security.
- Logstash: Processes logs, encrypts data fields, and sends encrypted data to Kafka.
Kafka is configured with SASL/SCRAM for authentication. The necessary configurations are embedded into the Docker Compose and Kafka configuration files.
Logstash is set up to encrypt the message
field before sending it to Kafka. The encryption is performed using the AES-256-CBC algorithm.
To run the project:
-
Clone this repository.
-
Navigate to the repository directory.
-
Execute the following command:
docker-compose up
-
To input data into Logstash, use the stdin input by typing into your terminal where Docker Compose is running.
config/kafka_server_jaas.conf
: Contains the JAAS configuration for Kafka with a username and password.
logstash/config/logstash.yml
: Basic Logstash configuration.logstash/pipeline/logstash.conf
: Contains the Logstash pipeline configuration for processing and encrypting data.logstash/config/logstash_jaas.conf
: Contains the JAAS configuration for Logstash.
The cipher
filter in the Logstash configuration is used to encrypt data. The key and initialization vector are currently hardcoded for demonstration purposes but should be securely managed in a production environment.
Ensure to replace hardcoded credentials and keys with secure management solutions in a production environment. Consider enabling SSL/TLS for Kafka communication to secure data in transit.
Contributions to the project are welcome. Please ensure to follow the existing coding and commit message conventions when making pull requests.
Specify the license under which your project is made available.
Provide contact information for the project maintainer or team.
- Security Warnings: It's important to highlight in the README that hardcoded values for sensitive data (like encryption keys) are for demonstration purposes only and should be securely managed in a real environment.
- Contributions and Issues: Encourage users to contribute or report issues through GitHub's issue tracker and pull request system.
- License: Don't forget to include a license file or specify the license type in your README, as it informs users how they can legally use the project.
- Contact Information: Adding contact information helps users know how to reach out for more assistance or collaboration.
This README format offers a comprehensive guide to help anyone get started with your project quickly and understand its components and configurations.