Skip to content

Instantly share code, notes, and snippets.

@lazerl0rd
Created October 9, 2023 23:00
Show Gist options
  • Save lazerl0rd/01e30cc2fecde39a9ab966cc7856833c to your computer and use it in GitHub Desktop.
Save lazerl0rd/01e30cc2fecde39a9ab966cc7856833c to your computer and use it in GitHub Desktop.
#! /usr/bin/env bash
domainArg=""
for domain in "${@}"; do
[[ $domainArg != "" ]] && domainArg+=" "
domainArg+="-d $domain"
done
if [[ $domainArg != "" ]]; then
podman run -i --network "host2certbot" --rm -t \
-v certbot:/var/lib/letsencrypt \
-v /etc/letsencrypt:/etc/letsencrypt \
-v /root/.secrets/certbot/cloudflare.ini:/root/.secrets/certbot/cloudflare.ini:ro \
--uidmap "0:$(stat -c '%u' "$(podman mount "certbot")"):60000" \
--gidmap "0:$(stat -c '%u' "$(podman mount "certbot")"):60000" \
certbot/dns-cloudflare:latest certonly \
--dns-cloudflare \
--dns-cloudflare-credentials "/root/.secrets/certbot/cloudflare.ini" \
--dns-cloudflare-propagation-seconds 60 \
"$domainArg"
fi
chmod 755 "/etc/letsencrypt/"{"archive","live"}
chmod 644 "/etc/letsencrypt/archive/"*"/"*".pem"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment