- Pull docker image
docker pull redis
- Create certificate for redis
openssl req -x509 -newkey rsa:4096 -keyout key.pem -out cert.pem -days 365 -nodes
- Build own docker image from
redisdocker build -t redis-ssl . - Start docker container
docker run -p 6380:6380 --name redis-ssl -v $(pwd)/redis.conf:/usr/local/etc/redis/redis.conf -v $(pwd)/cert.pem:/etc/ssl/cert.pem -v $(pwd)/key.pem:/etc/ssl/key.pem -e REDIS_PASSWORD=yourpass -d redis-ssl redis-server /usr/local/etc/redis/redis.conf --tls-port 6380 --tls-cert-file /etc/ssl/cert.pem --tls-key-file /etc/ssl/key.pem --tls-auth-clients no --requirepass yourpass
- Install redis-cli
- Import create certificate into cacerts
keytool -import -alias sample -file cert.pem -keystore /path/to/java/lib/security/cacerts
- Test with
redis-cliredis-cli --tls --cacert cert.pem -h localhost -p 6380 -a yourpass
- Build with maven
mvn clean install
- Make sure all properties are set correctly in
application.properties - Run java application