-
-
Notifications
You must be signed in to change notification settings - Fork 277
Renewal hooks #161
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
Renewal hooks #161
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -49,11 +49,11 @@ cap_add_param_vars: | |
| # optional container parameters | ||
| opt_param_usage_include_env: true | ||
| opt_param_env_vars: | ||
| - { env_var: "SUBDOMAINS", env_value: "www,", desc: "Subdomains you'd like the cert to cover (comma separated, no spaces) ie. `www,ftp,cloud`. For a wildcard cert, set this _exactly_ to `wildcard` (wildcard cert is available via `dns` and `duckdns` validation only)" } | ||
| - { env_var: "SUBDOMAINS", env_value: "www,", desc: "Subdomains you'd like the cert to cover (comma separated, no spaces) ie. `www,ftp,cloud`. For a wildcard cert, set this *exactly* to `wildcard` (wildcard cert is available via `dns` and `duckdns` validation only)" } | ||
| - { env_var: "CERTPROVIDER", env_value: "", desc: "Optionally define the cert provider. Set to `zerossl` for ZeroSSL certs (requires existing [ZeroSSL account](https://app.zerossl.com/signup) and the e-mail address entered in `EMAIL` env var). Otherwise defaults to Let's Encrypt." } | ||
| - { env_var: "DNSPLUGIN", env_value: "cloudflare", desc: "Required if `VALIDATION` is set to `dns`. Options are `acmedns`, `aliyun`, `azure`, `cloudflare`, `cloudxns`, `cpanel`, `desec`, `digitalocean`, `directadmin`, `dnsimple`, `dnsmadeeasy`, `dnspod`, `do`, `domeneshop`, `dynu`, `gandi`, `gehirn`, `godaddy`, `google`, `he`, `hetzner`, `infomaniak`, `inwx`, `ionos`, `linode`, `loopia`, `luadns`, `netcup`, `njalla`, `nsone`, `ovh`, `porkbun`, `rfc2136`, `route53`, `sakuracloud`, `standalone`, `transip`, and `vultr`. Also need to enter the credentials into the corresponding ini (or json for some plugins) file under `/config/dns-conf`." } | ||
| - { env_var: "PROPAGATION", env_value: "", desc: "Optionally override (in seconds) the default propagation time for the dns plugins." } | ||
| - { env_var: "DUCKDNSTOKEN", env_value: "", desc: "Required if `VALIDATION` is set to `duckdns`. Retrieve your token from https://www.duckdns.org" } | ||
| - { env_var: "DUCKDNSTOKEN", env_value: "", desc: "Required if `VALIDATION` is set to `duckdns`. Retrieve your token from <https://www.duckdns.org>" } | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. markdownlint change |
||
| - { env_var: "EMAIL", env_value: "", desc: "Optional e-mail address used for cert expiration notifications (Required for ZeroSSL)." } | ||
| - { env_var: "ONLY_SUBDOMAINS", env_value: "false", desc: "If you wish to get certs only for certain subdomains, but not the main domain (main domain may be hosted on another machine and cannot be validated), set this to `true`" } | ||
| - { env_var: "EXTRA_DOMAINS", env_value: "", desc: "Additional fully qualified domain names (comma separated, no spaces) ie. `extradomain.com,subdomain.anotherdomain.org,*.anotherdomain.org`" } | ||
|
|
@@ -131,7 +131,7 @@ app_setup_block: | | |
| * You can check which jails are active via `docker exec -it swag fail2ban-client status` | ||
| * You can check the status of a specific jail via `docker exec -it swag fail2ban-client status <jail name>` | ||
| * You can unban an IP via `docker exec -it swag fail2ban-client set <jail name> unbanip <IP>` | ||
| * A list of commands can be found here: https://www.fail2ban.org/wiki/index.php/Commands | ||
| * A list of commands can be found here: <https://www.fail2ban.org/wiki/index.php/Commands> | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. markdownlint change |
||
|
|
||
| ### Updating configs | ||
|
|
||
|
|
@@ -148,13 +148,15 @@ app_setup_block: | | |
| * You can check the new sample and adjust your active config as needed. | ||
|
|
||
| ### Migration from the old `linuxserver/letsencrypt` image | ||
|
|
||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. markdownlint change |
||
| Please follow the instructions [on this blog post](https://www.linuxserver.io/blog/2020-08-21-introducing-swag#migrate). | ||
|
|
||
| app_setup_nginx_reverse_proxy_snippet: false | ||
| app_setup_nginx_reverse_proxy_block: "" | ||
|
|
||
| # changelog | ||
| changelogs: | ||
| - { date: "05.10.22:", desc: "Use certbot file hooks instead of command line hooks" } | ||
| - { date: "04.10.22:", desc: "Add godaddy and porkbun dns plugins." } | ||
| - { date: "03.10.22:", desc: "Add default_server back to default site conf's https listen." } | ||
| - { date: "22.09.22:", desc: "Added support for DO DNS validation." } | ||
|
|
@@ -171,7 +173,7 @@ changelogs: | |
| - { date: "22.11.21:", desc: "Added support for Infomaniak DNS for certificate generation." } | ||
| - { date: "20.11.21:", desc: "Added support for dnspod validation." } | ||
| - { date: "15.11.21:", desc: "Added support for deSEC DNS for wildcard certificate generation." } | ||
| - { date: "26.10.21:", desc: "[Existing users should update:](https://github.com/linuxserver/docker-swag/blob/master/README.md#updating-configs) proxy.conf - Mitigate https://httpoxy.org/ vulnerabilities. Ref: https://www.nginx.com/blog/mitigating-the-httpoxy-vulnerability-with-nginx#Defeating-the-Attack-using-NGINX-and-NGINX-Plus" } | ||
| - { date: "26.10.21:", desc: "[Existing users should update:](https://github.com/linuxserver/docker-swag/blob/master/README.md#updating-configs) proxy.conf - Mitigate <https://httpoxy.org/> vulnerabilities. Ref: <https://www.nginx.com/blog/mitigating-the-httpoxy-vulnerability-with-nginx#Defeating-the-Attack-using-NGINX-and-NGINX-Plus>" } | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. markdownlint change |
||
| - { date: "23.10.21:", desc: "Fix Hurricane Electric (HE) DNS validation." } | ||
| - { date: "12.10.21:", desc: "Fix deprecated LE root cert check to fix failures when using `STAGING=true`, and failures in revoking." } | ||
| - { date: "06.10.21:", desc: "Added support for Hurricane Electric (HE) DNS validation. Added lxml build deps." } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,27 +1,8 @@ | ||
| #!/usr/bin/with-contenv bash | ||
|
|
||
| . /config/.donoteditthisfile.conf | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These variables are no longer used in this file (they are used in the hooks). |
||
|
|
||
| echo "<------------------------------------------------->" | ||
| echo | ||
| echo "<------------------------------------------------->" | ||
| echo "cronjob running on "$(date) | ||
| echo "cronjob running on $(date)" | ||
| echo "Running certbot renew" | ||
| if [ "$ORIGVALIDATION" = "dns" ] || [ "$ORIGVALIDATION" = "duckdns" ]; then | ||
| certbot -n renew \ | ||
| --post-hook "if ps aux | grep [n]ginx: > /dev/null; then s6-svc -h /var/run/s6/services/nginx; fi; \ | ||
| cd /config/keys/letsencrypt && \ | ||
| openssl pkcs12 -export -out privkey.pfx -inkey privkey.pem -in cert.pem -certfile chain.pem -passout pass: && \ | ||
| sleep 1 && \ | ||
| cat privkey.pem fullchain.pem > priv-fullchain-bundle.pem && \ | ||
| chown -R abc:abc /config/etc/letsencrypt" | ||
| else | ||
| certbot -n renew \ | ||
| --pre-hook "if ps aux | grep [n]ginx: > /dev/null; then s6-svc -d /var/run/s6/services/nginx; fi" \ | ||
| --post-hook "if ps aux | grep 's6-supervise nginx' | grep -v grep > /dev/null; then s6-svc -u /var/run/s6/services/nginx; fi; \ | ||
| cd /config/keys/letsencrypt && \ | ||
| openssl pkcs12 -export -out privkey.pfx -inkey privkey.pem -in cert.pem -certfile chain.pem -passout pass: && \ | ||
| sleep 1 && \ | ||
| cat privkey.pem fullchain.pem > priv-fullchain-bundle.pem && \ | ||
| chown -R abc:abc /config/etc/letsencrypt" | ||
| fi | ||
| certbot renew --non-interactive | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| #!/usr/bin/with-contenv bash | ||
|
|
||
| cd /config/keys/letsencrypt || exit 1 | ||
| openssl pkcs12 -export -out privkey.pfx -inkey privkey.pem -in cert.pem -certfile chain.pem -passout pass: | ||
| sleep 1 | ||
| cat {privkey,fullchain}.pem >priv-fullchain-bundle.pem | ||
| chown -R abc:abc /config/etc/letsencrypt |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| #!/usr/bin/with-contenv bash | ||
|
|
||
| . /config/.donoteditthisfile.conf | ||
|
|
||
| if [ ! "$ORIGVALIDATION" = "dns" ] && [ ! "$ORIGVALIDATION" = "duckdns" ]; then | ||
| if ps aux | grep 's6-supervise nginx' | grep -v grep >/dev/null; then | ||
| s6-svc -u /run/service/nginx | ||
| fi | ||
| else | ||
| if ps aux | grep [n]ginx: >/dev/null; then | ||
| s6-svc -h /run/service/nginx | ||
| fi | ||
| fi |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| #!/usr/bin/with-contenv bash | ||
|
|
||
| . /config/.donoteditthisfile.conf | ||
|
|
||
| if [ ! "$ORIGVALIDATION" = "dns" ] && [ ! "$ORIGVALIDATION" = "duckdns" ]; then | ||
| if ps aux | grep [n]ginx: >/dev/null; then | ||
| s6-svc -d /run/service/nginx | ||
| fi | ||
| fi |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
markdownlint change