Skip to content
This repository has been archived by the owner on May 16, 2023. It is now read-only.

Commit

Permalink
Don't mount in the current directory when generating certs
Browse files Browse the repository at this point in the history
This gets really tricky when you are doing docker in docker because the
host path of the host doesn't match up properly with the host of the
local machine.
  • Loading branch information
Crazybus committed Jul 8, 2019
1 parent dd84f33 commit 0f2a564
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion elasticsearch/examples/security/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,14 @@ secrets:
rm -f elastic-certificates.p12 elastic-certificate.pem elastic-stack-ca.p12 || true && \
kubectl delete secrets elastic-credentials elastic-certificates elastic-certificate-pem || true && \
password=$$([ ! -z "$$ELASTIC_PASSWORD" ] && echo $$ELASTIC_PASSWORD || echo $$(docker run --rm docker.elastic.co/elasticsearch/elasticsearch:$(STACK_VERSION) /bin/sh -c "< /dev/urandom tr -dc _A-Z-a-z-0-9 | head -c20")) && \
docker run --rm -i -v $$(pwd):/app -w /app \
docker run --name helm-charts-certs -i -w /app \
--user $$(id -u):$$(id -g) \
docker.elastic.co/elasticsearch/elasticsearch:$(STACK_VERSION) \
/bin/sh -c " \
elasticsearch-certutil ca --out /app/elastic-stack-ca.p12 --pass '' && \
elasticsearch-certutil cert --ca /app/elastic-stack-ca.p12 --pass '' --ca-pass '' --out /app/elastic-certificates.p12" && \
docker cp helm-charts-certs:/app/elastic-certificates.p12 ./ && \
docker rm -f helm-charts-certs && \
openssl pkcs12 -nodes -passin pass:'' -in elastic-certificates.p12 -out elastic-certificate.pem && \
kubectl create secret generic elastic-certificates --from-file=elastic-certificates.p12 && \
kubectl create secret generic elastic-certificate-pem --from-file=elastic-certificate.pem && \
Expand Down

0 comments on commit 0f2a564

Please sign in to comment.