Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for P12 and PEM formats in bootstrapper and renewer #294

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions bootstrapper/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ FROM smallstep/step-cli:0.26.0
USER root
ENV CRT="/var/run/autocert.step.sm/site.crt"
ENV KEY="/var/run/autocert.step.sm/site.key"
ENV P12="/var/run/autocert.step.sm/site.p12"
ENV PEM="/var/run/autocert.step.sm/site.pem"
ENV STEP_ROOT="/var/run/autocert.step.sm/root.crt"

COPY bootstrapper/bootstrapper.sh /home/step/
Expand Down
13 changes: 7 additions & 6 deletions bootstrapper/bootstrapper.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,25 @@ then
fi

# Download the root certificate and set permissions
step ca root $STEP_ROOT

if [ "$DURATION" == "" ];
then
step ca certificate $COMMON_NAME $CRT $KEY
else
step ca certificate --not-after $DURATION $COMMON_NAME $CRT $KEY
fi

step ca root $STEP_ROOT
cat $CRT $KEY > $PEM
step certificate p12 $P12 $CRT $KEY --no-password --insecure --force

if [ -n "$OWNER" ]
then
chown "$OWNER" $CRT $KEY $STEP_ROOT
chown "$OWNER" $CRT $KEY $STEP_ROOT $P12 $PEM
fi

if [ -n "$MODE" ]
then
chmod "$MODE" $CRT $KEY $STEP_ROOT
chmod "$MODE" $CRT $KEY $STEP_ROOT $P12 $PEM
else
chmod 644 $CRT $KEY $STEP_ROOT
chmod 644 $CRT $KEY $STEP_ROOT $P12 $PEM
fi

7 changes: 6 additions & 1 deletion renewer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@ FROM smallstep/step-cli:0.26.0
USER root
ENV CRT="/var/run/autocert.step.sm/site.crt"
ENV KEY="/var/run/autocert.step.sm/site.key"
ENV P12="/var/run/autocert.step.sm/site.p12"
ENV PEM="/var/run/autocert.step.sm/site.pem"
ENV STEP_ROOT="/var/run/autocert.step.sm/root.crt"

ENTRYPOINT ["/bin/bash", "-c", "step ca renew --daemon $CRT $KEY"]
COPY renewer/renewerexec.sh /home/step/
RUN chmod +x /home/step/renewerexec.sh

ENTRYPOINT ["/bin/bash", "-c", "step ca renew --daemon --exec /home/step/renewerexec.sh $CRT $KEY"]
3 changes: 3 additions & 0 deletions renewer/renewerexec.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/sh
cat $CRT $KEY > $PEM
step certificate p12 $P12 $CRT $KEY --no-password --insecure --force