Skip to content

Commit 0d4f96c

Browse files
committed
Update renew with force flag.
Clean old certificates in volumes on start.
1 parent f7154a9 commit 0d4f96c

File tree

3 files changed

+14
-12
lines changed

3 files changed

+14
-12
lines changed

examples/docker/Makefile

+3-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ binaries:
55
GOOS=linux go build -o renewer/step github.com/smallstep/cli/cmd/step
66

77
build: build-nginx build-ca build-renewer
8-
98
build-nginx:
109
docker build -t nginx-test:latest nginx
1110
build-ca:
@@ -21,3 +20,6 @@ down:
2120

2221
inspect:
2322
step certificate inspect https://localhost:4443 --insecure
23+
24+
.PHONY: all binaries up down inspect
25+
.PHONY: build build-nginx build-ca build-renewer

examples/docker/renewer/crontab

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
# min hour day month weekday command
2-
* * * * * 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
2+
* * * * * step ca renew --force /var/local/step/site.crt /var/local/step/site.key

examples/docker/renewer/entrypoint.sh

+10-10
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,16 @@
33
# Wait for CA
44
sleep 5
55

6-
if [ ! -f /var/local/step/root_ca.crt ]; then
7-
# Donwload the root certificate
8-
step ca root /var/local/step/root_ca.crt
9-
fi
6+
# Clean old certificates
7+
rm -f /var/local/step/root_ca.crt
8+
rm -f /var/local/step/site.crt /var/local/step/site.key
109

11-
if [ ! -f /var/local/step/site.crt ]; then
12-
# Get token
13-
STEP_TOKEN=$(step ca token $COMMON_NAME)
14-
# Donwload the root certificate
15-
step ca certificate --token $STEP_TOKEN $COMMON_NAME /var/local/step/site.crt /var/local/step/site.key
16-
fi
10+
# Donwload the root certificate
11+
step ca root /var/local/step/root_ca.crt
12+
13+
# Get token
14+
STEP_TOKEN=$(step ca token $COMMON_NAME)
15+
# Donwload the root certificate
16+
step ca certificate --token $STEP_TOKEN $COMMON_NAME /var/local/step/site.crt /var/local/step/site.key
1717

1818
exec "$@"

0 commit comments

Comments
 (0)