forked from TrueCloudLab/certificates
Update renew with force flag.
Clean old certificates in volumes on start.
This commit is contained in:
parent
f7154a9ba3
commit
0d4f96c1d9
3 changed files with 14 additions and 12 deletions
|
@ -5,7 +5,6 @@ binaries:
|
|||
GOOS=linux go build -o renewer/step github.com/smallstep/cli/cmd/step
|
||||
|
||||
build: build-nginx build-ca build-renewer
|
||||
|
||||
build-nginx:
|
||||
docker build -t nginx-test:latest nginx
|
||||
build-ca:
|
||||
|
@ -21,3 +20,6 @@ down:
|
|||
|
||||
inspect:
|
||||
step certificate inspect https://localhost:4443 --insecure
|
||||
|
||||
.PHONY: all binaries up down inspect
|
||||
.PHONY: build build-nginx build-ca build-renewer
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
# min hour day month weekday command
|
||||
* * * * * rm -f /var/local/step/site-new.crt && step ca renew --out /var/local/step/site-new.crt /var/local/step/site.crt /var/local/step/site.key && mv /var/local/step/site-new.crt /var/local/step/site.crt
|
||||
* * * * * step ca renew --force /var/local/step/site.crt /var/local/step/site.key
|
||||
|
|
|
@ -3,16 +3,16 @@
|
|||
# Wait for CA
|
||||
sleep 5
|
||||
|
||||
if [ ! -f /var/local/step/root_ca.crt ]; then
|
||||
# Clean old certificates
|
||||
rm -f /var/local/step/root_ca.crt
|
||||
rm -f /var/local/step/site.crt /var/local/step/site.key
|
||||
|
||||
# Donwload the root certificate
|
||||
step ca root /var/local/step/root_ca.crt
|
||||
fi
|
||||
|
||||
if [ ! -f /var/local/step/site.crt ]; then
|
||||
# Get token
|
||||
STEP_TOKEN=$(step ca token $COMMON_NAME)
|
||||
# Donwload the root certificate
|
||||
step ca certificate --token $STEP_TOKEN $COMMON_NAME /var/local/step/site.crt /var/local/step/site.key
|
||||
fi
|
||||
|
||||
exec "$@"
|
Loading…
Reference in a new issue