Created
November 12, 2016 15:54
-
-
Save NegativeMjark/b06a85be064640a578c5169dac0d96de to your computer and use it in GitHub Desktop.
Update my lets encrypt certificate.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #! /bin/bash | |
| set -eu | |
| DATE="$(date +"%Y-%m-%d")" | |
| HOST=negativecurvature.net | |
| CERT="$HOST.$DATE.crt" | |
| COMBINED="$HOST.$DATE.combined.crt" | |
| WITHKEY="$HOST.$DATE.withkey.crt" | |
| test -f "$CERT" || python /root/acme-tiny/acme_tiny.py \ | |
| --account-key ./account.key \ | |
| --csr ./$HOST.csr \ | |
| --acme-dir /srv/www/$HOST/public_html/.well-known/acme-challenge/ \ | |
| > "$CERT" | |
| touch "$WITHKEY" | |
| chmod o-r "$WITHKEY" | |
| cat "$CERT" chain.pem > "$COMBINED" | |
| cat "$COMBINED" "$HOST.key" > "$WITHKEY" | |
| chown root:ssl "$CERT" | |
| chown root:ssl "$COMBINED" | |
| chown root:ssl "$WITHKEY" | |
| ln -sf "$(pwd)/$CERT" "../$HOST.crt" | |
| ln -sf "$(pwd)/$COMBINED" "../$HOST.combined.crt" | |
| ln -sf "$(pwd)/$WITHKEY" "../$HOST.withkey.crt" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment