Compare commits
62 Commits
fix/build-
...
3c377566a1
| Author | SHA1 | Date | |
|---|---|---|---|
| 3c377566a1 | |||
| 32039f54d7 | |||
| 98194ed52c | |||
| 47ca53287e | |||
|
f93f798cde
|
|||
| 452413c3d1 | |||
| 798f82c110 | |||
| b3aa822da3 | |||
|
c12eb0b381
|
|||
| 48f1281ba6 | |||
| 1d5a66a385 | |||
| df3fc81a9d | |||
| 2a41f240a3 | |||
| 1b8831b888 | |||
| 295c554933 | |||
| d02cf72bbc | |||
| 5d3eed683d | |||
| 0157a462ed | |||
| 63f586768f | |||
| 5863d5b808 | |||
| c42462b4e1 | |||
| 3db15537e8 | |||
| 9465157295 | |||
| 8d36f0c117 | |||
| b574ae146e | |||
| 0eeb08f4d8 | |||
| 639120e46d | |||
| 75488a4009 | |||
| b962b65145 | |||
| 0614aa0565 | |||
| 83f8c39e48 | |||
| 961f218621 | |||
| 6134b05328 | |||
| ada326f2d8 | |||
| 5d14d166eb | |||
| 3a6466612b | |||
| 36b71a0ebb | |||
| e0da513893 | |||
| df56fcf997 | |||
| 3c3cc47d32 | |||
| 053cef4c31 | |||
| b6d93c1164 | |||
| a41c409f9d | |||
| e859aa7218 | |||
| a4b59c360e | |||
| e7bd87d5bd | |||
| 6ef0abfd6b | |||
| 868eb4eb59 | |||
| 578284bb10 | |||
| e10bdd741d | |||
| 0aa35c3ef6 | |||
| 90f5095eef | |||
| 3daee369ca | |||
| 6a27c9232c | |||
| e130fc041e | |||
| 591e35c91a | |||
| 375cf5da74 | |||
| 09eb18adda | |||
| d09988c241 | |||
| 6d696dd4b2 | |||
| c23657ce01 | |||
| 634f0cac4a |
@ -12,12 +12,9 @@ jobs:
|
|||||||
"Validate Image":
|
"Validate Image":
|
||||||
runs-on: [ubuntu-docker-latest, linux/amd64]
|
runs-on: [ubuntu-docker-latest, linux/amd64]
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
- name: Build locally
|
- name: Build locally
|
||||||
uses: docker/build-push-action@v5
|
uses: docker/build-push-action@v5
|
||||||
with:
|
with:
|
||||||
context: .
|
|
||||||
load: true
|
load: true
|
||||||
tags: ${{ env.TEST_TAG }}
|
tags: ${{ env.TEST_TAG }}
|
||||||
provenance: false
|
provenance: false
|
||||||
|
|||||||
@ -55,7 +55,7 @@ jobs:
|
|||||||
- name: Set up Go
|
- name: Set up Go
|
||||||
uses: actions/setup-go@v4
|
uses: actions/setup-go@v4
|
||||||
with:
|
with:
|
||||||
go-version: 1.24.1
|
go-version: 1.22.2
|
||||||
- name: Run GoReleaser
|
- name: Run GoReleaser
|
||||||
uses: goreleaser/goreleaser-action@v5
|
uses: goreleaser/goreleaser-action@v5
|
||||||
with:
|
with:
|
||||||
|
|||||||
17
Dockerfile
17
Dockerfile
@ -1,4 +1,4 @@
|
|||||||
FROM alpine:3.21.3 AS base
|
FROM alpine:3.20.0 as base
|
||||||
ARG TARGETARCH
|
ARG TARGETARCH
|
||||||
|
|
||||||
FROM base AS base-amd64
|
FROM base AS base-amd64
|
||||||
@ -9,7 +9,7 @@ ENV S6_OVERLAY_ARCH=aarch64
|
|||||||
|
|
||||||
FROM base-${TARGETARCH}${TARGETVARIANT}
|
FROM base-${TARGETARCH}${TARGETVARIANT}
|
||||||
|
|
||||||
ARG S6_OVERLAY_VERSION="3.2.0.2"
|
ARG S6_OVERLAY_VERSION="3.1.6.2"
|
||||||
|
|
||||||
# Core variables
|
# Core variables
|
||||||
ENV PUID=1000
|
ENV PUID=1000
|
||||||
@ -18,9 +18,6 @@ ENV TZ=UTC
|
|||||||
ENV GENERATE_DHPARAM=true
|
ENV GENERATE_DHPARAM=true
|
||||||
ENV INTERVAL="0 */6 * * *"
|
ENV INTERVAL="0 */6 * * *"
|
||||||
ENV ONE_SHOT=false
|
ENV ONE_SHOT=false
|
||||||
ENV APPRISE_URL=
|
|
||||||
ENV NOTIFY_ON_FAILURE=false
|
|
||||||
ENV NOTIFY_ON_SUCCESS=false
|
|
||||||
|
|
||||||
# Single domain
|
# Single domain
|
||||||
ENV DOMAINS=
|
ENV DOMAINS=
|
||||||
@ -40,7 +37,7 @@ ENV CLOUDFLARE_TOKEN=
|
|||||||
ENV CERT_COUNT=1
|
ENV CERT_COUNT=1
|
||||||
|
|
||||||
#Get required packages
|
#Get required packages
|
||||||
RUN apk update && apk add curl bash python3 py3-virtualenv procps tzdata nano shadow xz busybox-suid openssl logrotate
|
RUN apk update && apk add curl bash python3 py3-virtualenv procps tzdata nano shadow xz busybox-suid openssl
|
||||||
|
|
||||||
#Make folders
|
#Make folders
|
||||||
RUN mkdir /config && \
|
RUN mkdir /config && \
|
||||||
@ -65,13 +62,15 @@ RUN apk add --no-cache --virtual .deps gcc python3-dev libc-dev libffi-dev && \
|
|||||||
/app/certbot/bin/pip install wheel setuptools && \
|
/app/certbot/bin/pip install wheel setuptools && \
|
||||||
/app/certbot/bin/pip install "Cython<3.0" pyyaml --no-build-isolation && \
|
/app/certbot/bin/pip install "Cython<3.0" pyyaml --no-build-isolation && \
|
||||||
/app/certbot/bin/pip install -r /app/certbot/requirements.txt && \
|
/app/certbot/bin/pip install -r /app/certbot/requirements.txt && \
|
||||||
ln -s /app/certbot/bin/certbot /usr/bin/certbot && \
|
ln -s /app/certbot/bin/certbot /usr/bin/certbot &&\
|
||||||
ln -s /app/certbot/bin/apprise /usr/bin/apprise && \
|
|
||||||
apk del .deps
|
apk del .deps
|
||||||
|
|
||||||
COPY root /
|
COPY root /
|
||||||
|
|
||||||
RUN chmod +x /container-init.sh /certbot-prepare.sh /check-one-shot.sh /renew-function.sh && \
|
RUN chmod +x /container-init.sh && \
|
||||||
|
chmod +x /certbot-prepare.sh && \
|
||||||
|
chmod +x /certbot-renew.sh && \
|
||||||
|
chmod +x /check-one-shot.sh && \
|
||||||
chown -R ${PUID}:${PGID} /app /config
|
chown -R ${PUID}:${PGID} /app /config
|
||||||
|
|
||||||
ENTRYPOINT [ "/init" ]
|
ENTRYPOINT [ "/init" ]
|
||||||
|
|||||||
@ -53,9 +53,6 @@ Core options to the container
|
|||||||
| GENERATE_DHPARAM | true (case-sensitive) | Generate Diffie-Hellman keys in /config/letsencrypt/keys |
|
| GENERATE_DHPARAM | true (case-sensitive) | Generate Diffie-Hellman keys in /config/letsencrypt/keys |
|
||||||
| INTERVAL | 0 */6 * * * | How often certbot attempts to renew the certificate. Cron syntax |
|
| INTERVAL | 0 */6 * * * | How often certbot attempts to renew the certificate. Cron syntax |
|
||||||
| CERT_COUNT | 1 | How many certificates certbot will try to issue. [Details here](https://git.mrmeeb.stream/MrMeeb/certbot-cron-docker#multiple-certificates) |
|
| CERT_COUNT | 1 | How many certificates certbot will try to issue. [Details here](https://git.mrmeeb.stream/MrMeeb/certbot-cron-docker#multiple-certificates) |
|
||||||
| APPRISE_URL | None | URL for Apprise notifications. [Syntax](https://github.com/caronc/apprise?tab=readme-ov-file#supported-notifications)
|
|
||||||
| NOTIFY_ON_SUCCESS | false | Notify on a successful renewal attempt. Note that this isn't just when the cert is renewed, but on every renewal attempt. |
|
|
||||||
| NOTIFY_ON_FAILURE | false | Notify on a failed renewal attempt.
|
|
||||||
|
|
||||||
### Certificate Options
|
### Certificate Options
|
||||||
|
|
||||||
|
|||||||
@ -4,7 +4,6 @@
|
|||||||
"major": {
|
"major": {
|
||||||
"dependencyDashboardApproval": true
|
"dependencyDashboardApproval": true
|
||||||
},
|
},
|
||||||
"minimumReleaseAge": "7 days",
|
|
||||||
"customManagers": [
|
"customManagers": [
|
||||||
{
|
{
|
||||||
"customType": "regex",
|
"customType": "regex",
|
||||||
|
|||||||
@ -1,5 +1,4 @@
|
|||||||
# For pinning Python packages to then be parsed by Renovate
|
# For pinning Certbot packages to then be parsed by Renovate
|
||||||
|
|
||||||
certbot ==3.3.0
|
certbot ==2.10.0
|
||||||
certbot-dns-cloudflare ==3.3.0
|
certbot-dns-cloudflare ==2.10.0
|
||||||
apprise ==1.9.2
|
|
||||||
@ -46,22 +46,9 @@ function better_exit {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Check APPRISE_URL is set if either NOTIFY_ON_SUCCESS or NOTIFY_ON_FAILURE are set
|
|
||||||
if [ "${NOTIFY_ON_SUCCESS}" = "true" ] || [ "${NOTIFY_ON_FAILURE}" = "true" ] && [ -z "${APPRISE_URL}" ]; then
|
|
||||||
|
|
||||||
echo "You have notifications enabled but have not set APPRISE_URL. Please set APPRISE_URL and restart the container."
|
|
||||||
better_exit
|
|
||||||
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Cleanup renew list and create it fresh, ready for commands to be run and added
|
# Cleanup renew list and create it fresh, ready for commands to be run and added
|
||||||
echo "#!/command/with-contenv bash
|
echo "#!/command/with-contenv bash" > /config/.renew-list.sh
|
||||||
|
echo "" >> /config/.renew-list.sh
|
||||||
date
|
|
||||||
echo \"Attempting to renew certificates\"
|
|
||||||
source /renew-function.sh
|
|
||||||
" > /config/.renew-list.sh
|
|
||||||
chmod +x /config/.renew-list.sh
|
|
||||||
|
|
||||||
# Create original config file to track changes to environmental variables
|
# Create original config file to track changes to environmental variables
|
||||||
if [ ! -f /config/.donoteditthisfile ]
|
if [ ! -f /config/.donoteditthisfile ]
|
||||||
@ -319,14 +306,14 @@ function single_domain {
|
|||||||
echo "Using staging endpoint - THIS SHOULD BE USED FOR TESTING ONLY"
|
echo "Using staging endpoint - THIS SHOULD BE USED FOR TESTING ONLY"
|
||||||
${BASE_COMMAND[@]} --dns-cloudflare --dns-cloudflare-propagation-seconds $PROPOGATION_TIME --dns-cloudflare-credentials /config/.secrets/cloudflare.ini --staging
|
${BASE_COMMAND[@]} --dns-cloudflare --dns-cloudflare-propagation-seconds $PROPOGATION_TIME --dns-cloudflare-credentials /config/.secrets/cloudflare.ini --staging
|
||||||
# Add to renewal list
|
# Add to renewal list
|
||||||
echo "renew \"REQUESTS_CA_BUNDLE=$CUSTOM_CA_PATH ${BASE_COMMAND[@]} --dns-cloudflare --dns-cloudflare-propagation-seconds $PROPOGATION_TIME --dns-cloudflare-credentials /config/.secrets/cloudflare.ini --staging\"" >> /config/.renew-list.sh
|
echo "REQUESTS_CA_BUNDLE=$CUSTOM_CA_PATH ${BASE_COMMAND[@]} --dns-cloudflare --dns-cloudflare-propagation-seconds $PROPOGATION_TIME --dns-cloudflare-credentials /config/.secrets/cloudflare.ini --staging" >> /config/.renew-list.sh
|
||||||
echo "Creation/renewal attempt complete"
|
echo "Creation/renewal attempt complete"
|
||||||
elif [ $STAGING = false ]
|
elif [ $STAGING = false ]
|
||||||
then
|
then
|
||||||
echo "Using production endpoint"
|
echo "Using production endpoint"
|
||||||
${BASE_COMMAND[@]} --dns-cloudflare --dns-cloudflare-propagation-seconds $PROPOGATION_TIME --dns-cloudflare-credentials /config/.secrets/cloudflare.ini
|
${BASE_COMMAND[@]} --dns-cloudflare --dns-cloudflare-propagation-seconds $PROPOGATION_TIME --dns-cloudflare-credentials /config/.secrets/cloudflare.ini
|
||||||
# Add to renewal list
|
# Add to renewal list
|
||||||
echo "renew \"REQUESTS_CA_BUNDLE=$CUSTOM_CA_PATH ${BASE_COMMAND[@]} --dns-cloudflare --dns-cloudflare-propagation-seconds $PROPOGATION_TIME --dns-cloudflare-credentials /config/.secrets/cloudflare.ini\"" >> /config/.renew-list.sh
|
echo "REQUESTS_CA_BUNDLE=$CUSTOM_CA_PATH ${BASE_COMMAND[@]} --dns-cloudflare --dns-cloudflare-propagation-seconds $PROPOGATION_TIME --dns-cloudflare-credentials /config/.secrets/cloudflare.ini" >> /config/.renew-list.sh
|
||||||
echo "Creation/renewal attempt complete"
|
echo "Creation/renewal attempt complete"
|
||||||
else
|
else
|
||||||
echo "Unrecognised option for STAGING variable - check your configuration"
|
echo "Unrecognised option for STAGING variable - check your configuration"
|
||||||
@ -345,14 +332,14 @@ function single_domain {
|
|||||||
echo "Using staging endpoint - THIS SHOULD BE USED FOR TESTING ONLY"
|
echo "Using staging endpoint - THIS SHOULD BE USED FOR TESTING ONLY"
|
||||||
REQUESTS_CA_BUNDLE=$CUSTOM_CA_PATH ${BASE_COMMAND[@]} --standalone --staging
|
REQUESTS_CA_BUNDLE=$CUSTOM_CA_PATH ${BASE_COMMAND[@]} --standalone --staging
|
||||||
# Add to renewal list
|
# Add to renewal list
|
||||||
echo "renew \"REQUESTS_CA_BUNDLE=$CUSTOM_CA_PATH ${BASE_COMMAND[@]} --standalone --staging\"" >> /config/.renew-list.sh
|
echo "REQUESTS_CA_BUNDLE=$CUSTOM_CA_PATH ${BASE_COMMAND[@]} --standalone --staging" >> /config/.renew-list.sh
|
||||||
echo "Creation/renewal attempt complete"
|
echo "Creation/renewal attempt complete"
|
||||||
elif [ $STAGING = false ]
|
elif [ $STAGING = false ]
|
||||||
then
|
then
|
||||||
echo "Using production endpoint"
|
echo "Using production endpoint"
|
||||||
REQUESTS_CA_BUNDLE=$CUSTOM_CA_PATH ${BASE_COMMAND[@]} --standalone
|
REQUESTS_CA_BUNDLE=$CUSTOM_CA_PATH ${BASE_COMMAND[@]} --standalone
|
||||||
# Add to renewal list
|
# Add to renewal list
|
||||||
echo "renew \"REQUESTS_CA_BUNDLE=$CUSTOM_CA_PATH ${BASE_COMMAND[@]} --standalone\"" >> /config/.renew-list.sh
|
echo "REQUESTS_CA_BUNDLE=$CUSTOM_CA_PATH ${BASE_COMMAND[@]} --standalone" >> /config/.renew-list.sh
|
||||||
echo "Creation/renewal attempt complete"
|
echo "Creation/renewal attempt complete"
|
||||||
else
|
else
|
||||||
echo "Unrecognised option for STAGING variable - check your configuration"
|
echo "Unrecognised option for STAGING variable - check your configuration"
|
||||||
@ -371,14 +358,14 @@ function single_domain {
|
|||||||
echo "Using staging endpoint - THIS SHOULD BE USED FOR TESTING ONLY"
|
echo "Using staging endpoint - THIS SHOULD BE USED FOR TESTING ONLY"
|
||||||
REQUESTS_CA_BUNDLE=$CUSTOM_CA_PATH ${BASE_COMMAND[@]} --webroot --webroot-path /config/webroot --staging
|
REQUESTS_CA_BUNDLE=$CUSTOM_CA_PATH ${BASE_COMMAND[@]} --webroot --webroot-path /config/webroot --staging
|
||||||
# Add to renewal list
|
# Add to renewal list
|
||||||
echo "renew \"REQUESTS_CA_BUNDLE=$CUSTOM_CA_PATH ${BASE_COMMAND[@]} --webroot --webroot-path /config/webroot --staging\"" >> /config/.renew-list.sh
|
echo "REQUESTS_CA_BUNDLE=$CUSTOM_CA_PATH ${BASE_COMMAND[@]} --webroot --webroot-path /config/webroot --staging" >> /config/.renew-list.sh
|
||||||
echo "Creation/renewal attempt complete"
|
echo "Creation/renewal attempt complete"
|
||||||
elif [ $STAGING = false ]
|
elif [ $STAGING = false ]
|
||||||
then
|
then
|
||||||
echo "Using production endpoint"
|
echo "Using production endpoint"
|
||||||
REQUESTS_CA_BUNDLE=$CUSTOM_CA_PATH ${BASE_COMMAND[@]} --webroot --webroot-path /config/webroot
|
REQUESTS_CA_BUNDLE=$CUSTOM_CA_PATH ${BASE_COMMAND[@]} --webroot --webroot-path /config/webroot
|
||||||
# Add to renewal list
|
# Add to renewal list
|
||||||
echo "renew \"REQUESTS_CA_BUNDLE=$CUSTOM_CA_PATH ${BASE_COMMAND[@]} --webroot --webroot-path /config/webroot\"" >> /config/.renew-list.sh
|
echo "REQUESTS_CA_BUNDLE=$CUSTOM_CA_PATH ${BASE_COMMAND[@]} --webroot --webroot-path /config/webroot" >> /config/.renew-list.sh
|
||||||
echo "Creation/renewal attempt complete"
|
echo "Creation/renewal attempt complete"
|
||||||
else
|
else
|
||||||
echo "Unrecognised option for STAGING variable - check your configuration"
|
echo "Unrecognised option for STAGING variable - check your configuration"
|
||||||
@ -644,7 +631,7 @@ echo \
|
|||||||
${BASE_COMMAND[@]} --dns-cloudflare --dns-cloudflare-propagation-seconds ${PROPOGATION_TIME_MULTI} --dns-cloudflare-credentials /config/.secrets/cloudflare.ini --staging
|
${BASE_COMMAND[@]} --dns-cloudflare --dns-cloudflare-propagation-seconds ${PROPOGATION_TIME_MULTI} --dns-cloudflare-credentials /config/.secrets/cloudflare.ini --staging
|
||||||
# Add to renewal list
|
# Add to renewal list
|
||||||
echo "## Certificate ${x}" >> /config/.renew-list.sh
|
echo "## Certificate ${x}" >> /config/.renew-list.sh
|
||||||
echo "renew \"${BASE_COMMAND[@]} --dns-cloudflare --dns-cloudflare-propagation-seconds ${PROPOGATION_TIME_MULTI} --dns-cloudflare-credentials /config/.secrets/cloudflare.ini --staging\"" >> /config/.renew-list.sh
|
echo "${BASE_COMMAND[@]} --dns-cloudflare --dns-cloudflare-propagation-seconds ${PROPOGATION_TIME_MULTI} --dns-cloudflare-credentials /config/.secrets/cloudflare.ini --staging" >> /config/.renew-list.sh
|
||||||
echo "" >> /config/.renew-list.sh
|
echo "" >> /config/.renew-list.sh
|
||||||
echo "Creation/renewal attempt complete"
|
echo "Creation/renewal attempt complete"
|
||||||
elif [ ${STAGING_MULTI} = false ]
|
elif [ ${STAGING_MULTI} = false ]
|
||||||
@ -653,7 +640,7 @@ echo \
|
|||||||
${BASE_COMMAND[@]} --dns-cloudflare --dns-cloudflare-propagation-seconds ${PROPOGATION_TIME_MULTI} --dns-cloudflare-credentials /config/.secrets/cloudflare.ini
|
${BASE_COMMAND[@]} --dns-cloudflare --dns-cloudflare-propagation-seconds ${PROPOGATION_TIME_MULTI} --dns-cloudflare-credentials /config/.secrets/cloudflare.ini
|
||||||
# Add to renewal list
|
# Add to renewal list
|
||||||
echo "## Certificate ${x}" >> /config/.renew-list.sh
|
echo "## Certificate ${x}" >> /config/.renew-list.sh
|
||||||
echo "renew \"REQUESTS_CA_BUNDLE=$CUSTOM_CA_PATH ${BASE_COMMAND[@]} --dns-cloudflare --dns-cloudflare-propagation-seconds ${PROPOGATION_TIME_MULTI} --dns-cloudflare-credentials /config/.secrets/cloudflare.ini\"" >> /config/.renew-list.sh
|
echo "REQUESTS_CA_BUNDLE=$CUSTOM_CA_PATH ${BASE_COMMAND[@]} --dns-cloudflare --dns-cloudflare-propagation-seconds ${PROPOGATION_TIME_MULTI} --dns-cloudflare-credentials /config/.secrets/cloudflare.ini" >> /config/.renew-list.sh
|
||||||
echo "" >> /config/.renew-list.sh
|
echo "" >> /config/.renew-list.sh
|
||||||
echo "Creation/renewal attempt complete"
|
echo "Creation/renewal attempt complete"
|
||||||
else
|
else
|
||||||
@ -674,7 +661,7 @@ echo \
|
|||||||
REQUESTS_CA_BUNDLE=${CUSTOM_CA_PATH_MULTI} ${BASE_COMMAND[@]} --standalone --staging
|
REQUESTS_CA_BUNDLE=${CUSTOM_CA_PATH_MULTI} ${BASE_COMMAND[@]} --standalone --staging
|
||||||
# Add to renewal list
|
# Add to renewal list
|
||||||
echo "## Certificate ${x}" >> /config/.renew-list.sh
|
echo "## Certificate ${x}" >> /config/.renew-list.sh
|
||||||
echo "renew \"REQUESTS_CA_BUNDLE=${CUSTOM_CA_PATH_MULTI} ${BASE_COMMAND[@]} --standalone --staging\"" >> /config/.renew-list.sh
|
echo "REQUESTS_CA_BUNDLE=${CUSTOM_CA_PATH_MULTI} ${BASE_COMMAND[@]} --standalone --staging" >> /config/.renew-list.sh
|
||||||
echo "" >> /config/.renew-list.sh
|
echo "" >> /config/.renew-list.sh
|
||||||
echo "Creation/renewal attempt complete"
|
echo "Creation/renewal attempt complete"
|
||||||
elif [ ${STAGING_MULTI} = false ]
|
elif [ ${STAGING_MULTI} = false ]
|
||||||
@ -683,7 +670,7 @@ echo \
|
|||||||
REQUESTS_CA_BUNDLE=${CUSTOM_CA_PATH_MULTI} ${BASE_COMMAND[@]} --standalone
|
REQUESTS_CA_BUNDLE=${CUSTOM_CA_PATH_MULTI} ${BASE_COMMAND[@]} --standalone
|
||||||
# Add to renewal list
|
# Add to renewal list
|
||||||
echo "## Certificate ${x}" >> /config/.renew-list.sh
|
echo "## Certificate ${x}" >> /config/.renew-list.sh
|
||||||
echo "renew \"REQUESTS_CA_BUNDLE=${CUSTOM_CA_PATH_MULTI} ${BASE_COMMAND[@]} --standalone\"" >> /config/.renew-list.sh
|
echo "REQUESTS_CA_BUNDLE=${CUSTOM_CA_PATH_MULTI} ${BASE_COMMAND[@]} --standalone" >> /config/.renew-list.sh
|
||||||
echo "" >> /config/.renew-list.sh
|
echo "" >> /config/.renew-list.sh
|
||||||
echo "Creation/renewal attempt complete"
|
echo "Creation/renewal attempt complete"
|
||||||
else
|
else
|
||||||
@ -704,7 +691,7 @@ echo \
|
|||||||
REQUESTS_CA_BUNDLE=${CUSTOM_CA_PATH_MULTI} ${BASE_COMMAND[@]} --webroot --webroot-path /config/webroot --staging
|
REQUESTS_CA_BUNDLE=${CUSTOM_CA_PATH_MULTI} ${BASE_COMMAND[@]} --webroot --webroot-path /config/webroot --staging
|
||||||
# Add to renewal list
|
# Add to renewal list
|
||||||
echo "## Certificate ${x}" >> /config/.renew-list.sh
|
echo "## Certificate ${x}" >> /config/.renew-list.sh
|
||||||
echo "renew \"REQUESTS_CA_BUNDLE=${CUSTOM_CA_PATH_MULTI} ${BASE_COMMAND[@]} --webroot --webroot-path /config/webroot --staging\"" >> /config/.renew-list.sh
|
echo "REQUESTS_CA_BUNDLE=${CUSTOM_CA_PATH_MULTI} ${BASE_COMMAND[@]} --webroot --webroot-path /config/webroot --staging" >> /config/.renew-list.sh
|
||||||
echo "" >> /config/.renew-list.sh
|
echo "" >> /config/.renew-list.sh
|
||||||
echo "Creation/renewal attempt complete"
|
echo "Creation/renewal attempt complete"
|
||||||
elif [ ${STAGING_MULTI} = false ]
|
elif [ ${STAGING_MULTI} = false ]
|
||||||
@ -713,7 +700,7 @@ echo \
|
|||||||
REQUESTS_CA_BUNDLE=${CUSTOM_CA_PATH_MULTI} ${BASE_COMMAND[@]} --webroot --webroot-path /config/webroot
|
REQUESTS_CA_BUNDLE=${CUSTOM_CA_PATH_MULTI} ${BASE_COMMAND[@]} --webroot --webroot-path /config/webroot
|
||||||
# Add to renewal list
|
# Add to renewal list
|
||||||
echo "## Certificate ${x}" >> /config/.renew-list.sh
|
echo "## Certificate ${x}" >> /config/.renew-list.sh
|
||||||
echo "renew \"REQUESTS_CA_BUNDLE=${CUSTOM_CA_PATH_MULTI} ${BASE_COMMAND[@]} --webroot --webroot-path /config/webroot\"" >> /config/.renew-list.sh
|
echo "REQUESTS_CA_BUNDLE=${CUSTOM_CA_PATH_MULTI} ${BASE_COMMAND[@]} --webroot --webroot-path /config/webroot" >> /config/.renew-list.sh
|
||||||
echo "" >> /config/.renew-list.sh
|
echo "" >> /config/.renew-list.sh
|
||||||
echo "Creation/renewal attempt complete"
|
echo "Creation/renewal attempt complete"
|
||||||
else
|
else
|
||||||
@ -767,10 +754,6 @@ else
|
|||||||
echo "CERT_COUNT varaible not recognised. It needs to be a value of 1 or greater."
|
echo "CERT_COUNT varaible not recognised. It needs to be a value of 1 or greater."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Finish /config/.renew-list.sh now all certs have been added
|
|
||||||
echo "
|
|
||||||
echo \"Renewal attempts complete\"" >> /config/.renew-list.sh
|
|
||||||
|
|
||||||
if [ $GENERATE_DHPARAM = true ] && [ ! -s /config/letsencrypt/keys/ssl-dhparams.pem ]
|
if [ $GENERATE_DHPARAM = true ] && [ ! -s /config/letsencrypt/keys/ssl-dhparams.pem ]
|
||||||
then
|
then
|
||||||
echo ""
|
echo ""
|
||||||
@ -786,8 +769,7 @@ if [ $ONE_SHOT == "true" ]; then
|
|||||||
|
|
||||||
elif [ $ONE_SHOT == "false" ]; then
|
elif [ $ONE_SHOT == "false" ]; then
|
||||||
|
|
||||||
echo "$INTERVAL /config/.renew-list.sh >> /config/logs/renew.log
|
echo "$INTERVAL /certbot-renew.sh >> /config/logs/renew.log" > /config/.crontab.txt
|
||||||
0 0 * * * logrotate -v --state /config/logs/logrotate.status /logrotate.conf" > /config/.crontab.txt
|
|
||||||
|
|
||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
|
|||||||
6
root/certbot-renew.sh
Normal file
6
root/certbot-renew.sh
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
#!/command/with-contenv bash
|
||||||
|
# shellcheck shell=bash
|
||||||
|
echo ''
|
||||||
|
date
|
||||||
|
echo "Attempting to renew certificates"
|
||||||
|
bash /config/.renew-list.sh
|
||||||
@ -4,7 +4,6 @@
|
|||||||
if [ $ONE_SHOT == "true" ]; then
|
if [ $ONE_SHOT == "true" ]; then
|
||||||
|
|
||||||
# Cleanly kill container by sending kill signal to supervisor process
|
# Cleanly kill container by sending kill signal to supervisor process
|
||||||
echo 0 > /run/s6-linux-init-container-results/exitcode
|
kill 1
|
||||||
/run/s6/basedir/bin/halt
|
|
||||||
|
|
||||||
fi
|
fi
|
||||||
@ -31,13 +31,7 @@ TZ=${TZ}
|
|||||||
ONE_SHOT=${ONE_SHOT}
|
ONE_SHOT=${ONE_SHOT}
|
||||||
INTERVAL=${INTERVAL}
|
INTERVAL=${INTERVAL}
|
||||||
GENERATE_DHPARAM=${GENERATE_DHPARAM}
|
GENERATE_DHPARAM=${GENERATE_DHPARAM}
|
||||||
CERT_COUNT=${CERT_COUNT}
|
CERT_COUNT=${CERT_COUNT}"
|
||||||
NOTIFY_ON_SUCCESS=${NOTIFY_ON_SUCCESS}
|
|
||||||
NOTIFY_ON_FAILURE=${NOTIFY_ON_FAILURE}"
|
|
||||||
if [ ! -z ${APPRISE_URL} ]; then
|
|
||||||
echo \
|
|
||||||
"APPRISE_URL=[hidden]"
|
|
||||||
fi
|
|
||||||
## Send extra detail to logs if single certificate config
|
## Send extra detail to logs if single certificate config
|
||||||
if [ ${CERT_COUNT} == 1 ]; then
|
if [ ${CERT_COUNT} == 1 ]; then
|
||||||
echo \
|
echo \
|
||||||
|
|||||||
@ -1,9 +1 @@
|
|||||||
#!/command/with-contenv bash
|
echo "$e" > /run/s6-linux-init-container-results/exitcode
|
||||||
# shellcheck shell=bash
|
|
||||||
|
|
||||||
if [ $ONE_SHOT == "false" ]; then
|
|
||||||
|
|
||||||
# Export exit code if not a ONE_SHOT
|
|
||||||
echo "$e" > /run/s6-linux-init-container-results/exitcode
|
|
||||||
|
|
||||||
fi
|
|
||||||
@ -1,9 +1 @@
|
|||||||
#!/command/with-contenv bash
|
echo "$e" > /run/s6-linux-init-container-results/exitcode
|
||||||
# shellcheck shell=bash
|
|
||||||
|
|
||||||
if [ $ONE_SHOT == "false" ]; then
|
|
||||||
|
|
||||||
# Export exit code if not a ONE_SHOT
|
|
||||||
echo "$e" > /run/s6-linux-init-container-results/exitcode
|
|
||||||
|
|
||||||
fi
|
|
||||||
@ -1,15 +0,0 @@
|
|||||||
missingok
|
|
||||||
|
|
||||||
/config/logs/letsencrypt.log {
|
|
||||||
daily
|
|
||||||
rotate 10
|
|
||||||
postrotate
|
|
||||||
find /config/logs -type f -regex '.*letsencrypt\.log\.\(.[2-9]\|[2-9].\|[1-9][0-9]\{2,\}\).*' -delete
|
|
||||||
endscript
|
|
||||||
}
|
|
||||||
|
|
||||||
/config/logs/renew.log {
|
|
||||||
rotate 5
|
|
||||||
size 100k
|
|
||||||
compress
|
|
||||||
}
|
|
||||||
@ -1,27 +0,0 @@
|
|||||||
function renew() {
|
|
||||||
|
|
||||||
#Variables:
|
|
||||||
|
|
||||||
#$1 = Certbot command
|
|
||||||
|
|
||||||
RENEWAL_DOMAINS=$(echo $1 | sed -r 's/.*\s-d\s(\S*).*/\1/')
|
|
||||||
CUSTOM_CA_PATH=$(echo $1 | sed -r 's/REQUESTS_CA_BUNDLE=(\S*)\s(.*)/\1/')
|
|
||||||
CERTBOT_COMMAND=$(echo $1 | sed -r 's/REQUESTS_CA_BUNDLE=(\S*)\s(.*)/\2/')
|
|
||||||
|
|
||||||
echo "Renewing certificate for ${RENEWAL_DOMAINS}"
|
|
||||||
|
|
||||||
echo "REQUESTS_CA_BUNDLE=${CUSTOM_CA_PATH} ${CERTBOT_COMMAND}" | bash
|
|
||||||
|
|
||||||
if [ $? = 0 ]; then
|
|
||||||
echo "Renewal attempt of certificate for ${RENEWAL_DOMAINS} succeeded"
|
|
||||||
if [ "${NOTIFY_ON_SUCCESS}" = "true" ]; then
|
|
||||||
apprise -b "Renewal of certificate for ${RENEWAL_DOMAINS} succeeded" ${APPRISE_URL}
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
echo "Renewal attempt of certificate for ${RENEWAL_DOMAINS} failed"
|
|
||||||
if [ "${NOTIFY_ON_FAILURE}" = "true" ]; then
|
|
||||||
apprise -b "Renewal of certificate for ${RENEWAL_DOMAINS} failed" ${APPRISE_URL}
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user