Merge pull request #11880 from pesintta/acme-user-scripts
(u)acme: add support for user-provided setup and cleanup scripts
This commit is contained in:
commit
3534c34864
6 changed files with 40 additions and 4 deletions
|
@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
|
||||||
|
|
||||||
PKG_NAME:=acme
|
PKG_NAME:=acme
|
||||||
PKG_VERSION:=2.8.5
|
PKG_VERSION:=2.8.5
|
||||||
PKG_RELEASE:=3
|
PKG_RELEASE:=4
|
||||||
|
|
||||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
||||||
PKG_SOURCE_URL:=https://codeload.github.com/Neilpang/acme.sh/tar.gz/$(PKG_VERSION)?
|
PKG_SOURCE_URL:=https://codeload.github.com/Neilpang/acme.sh/tar.gz/$(PKG_VERSION)?
|
||||||
|
|
|
@ -11,4 +11,6 @@ config cert 'example'
|
||||||
option update_nginx 1
|
option update_nginx 1
|
||||||
option webroot ""
|
option webroot ""
|
||||||
option dns ""
|
option dns ""
|
||||||
|
# option user_setup "path-to-custom-setup.script"
|
||||||
|
# option user_cleanup "path-to-custom-cleanup.script"
|
||||||
list domains example.org
|
list domains example.org
|
||||||
|
|
|
@ -20,6 +20,7 @@ DEBUG=0
|
||||||
NGINX_WEBSERVER=0
|
NGINX_WEBSERVER=0
|
||||||
UPDATE_NGINX=0
|
UPDATE_NGINX=0
|
||||||
UPDATE_UHTTPD=0
|
UPDATE_UHTTPD=0
|
||||||
|
USER_CLEANUP=
|
||||||
|
|
||||||
. /lib/functions.sh
|
. /lib/functions.sh
|
||||||
|
|
||||||
|
@ -148,6 +149,11 @@ post_checks()
|
||||||
NGINX_WEBSERVER=0
|
NGINX_WEBSERVER=0
|
||||||
/etc/init.d/nginx restart
|
/etc/init.d/nginx restart
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ -n "$USER_CLEANUP" ] && [ -f "$USER_CLEANUP" ]; then
|
||||||
|
log "Running user-provided cleanup script from $USER_CLEANUP."
|
||||||
|
"$USER_CLEANUP" || return 1
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
err_out()
|
err_out()
|
||||||
|
@ -190,6 +196,8 @@ issue_cert()
|
||||||
local failed_dir
|
local failed_dir
|
||||||
local webroot
|
local webroot
|
||||||
local dns
|
local dns
|
||||||
|
local user_setup
|
||||||
|
local user_cleanup
|
||||||
local ret
|
local ret
|
||||||
local domain_dir
|
local domain_dir
|
||||||
|
|
||||||
|
@ -201,9 +209,12 @@ issue_cert()
|
||||||
config_get keylength "$section" keylength
|
config_get keylength "$section" keylength
|
||||||
config_get webroot "$section" webroot
|
config_get webroot "$section" webroot
|
||||||
config_get dns "$section" dns
|
config_get dns "$section" dns
|
||||||
|
config_get user_setup "$section" user_setup
|
||||||
|
config_get user_cleanup "$section" user_cleanup
|
||||||
|
|
||||||
UPDATE_NGINX=$update_nginx
|
UPDATE_NGINX=$update_nginx
|
||||||
UPDATE_UHTTPD=$update_uhttpd
|
UPDATE_UHTTPD=$update_uhttpd
|
||||||
|
USER_CLEANUP=$user_cleanup
|
||||||
|
|
||||||
[ "$enabled" -eq "1" ] || return
|
[ "$enabled" -eq "1" ] || return
|
||||||
|
|
||||||
|
@ -212,7 +223,12 @@ issue_cert()
|
||||||
set -- $domains
|
set -- $domains
|
||||||
main_domain=$1
|
main_domain=$1
|
||||||
|
|
||||||
[ -n "$webroot" ] || [ -n "$dns" ] || pre_checks "$main_domain" || return 1
|
if [ -n "$user_setup" ] && [ -f "$user_setup" ]; then
|
||||||
|
log "Running user-provided setup script from $user_setup."
|
||||||
|
"$user_setup" "$main_domain" || return 1
|
||||||
|
else
|
||||||
|
[ -n "$webroot" ] || [ -n "$dns" ] || pre_checks "$main_domain" || return 1
|
||||||
|
fi
|
||||||
|
|
||||||
if echo $keylength | grep -q "^ec-"; then
|
if echo $keylength | grep -q "^ec-"; then
|
||||||
domain_dir="$STATE_DIR/${main_domain}_ecc"
|
domain_dir="$STATE_DIR/${main_domain}_ecc"
|
||||||
|
|
|
@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
|
||||||
|
|
||||||
PKG_NAME:=uacme
|
PKG_NAME:=uacme
|
||||||
PKG_VERSION:=1.2.1
|
PKG_VERSION:=1.2.1
|
||||||
PKG_RELEASE:=1
|
PKG_RELEASE:=2
|
||||||
|
|
||||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
||||||
PKG_SOURCE_URL:=https://codeload.github.com/ndilieto/uacme/tar.gz/upstream/$(PKG_VERSION)?
|
PKG_SOURCE_URL:=https://codeload.github.com/ndilieto/uacme/tar.gz/upstream/$(PKG_VERSION)?
|
||||||
|
|
|
@ -11,4 +11,6 @@ config cert 'example'
|
||||||
option update_nginx 1
|
option update_nginx 1
|
||||||
option update_haproxy 1
|
option update_haproxy 1
|
||||||
option webroot "/www/.well-known/acme-challenge"
|
option webroot "/www/.well-known/acme-challenge"
|
||||||
|
# option user_setup "path-to-custom-setup.script"
|
||||||
|
# option user_cleanup "path-to-custom-cleanup.script"
|
||||||
list domains example.org
|
list domains example.org
|
||||||
|
|
|
@ -37,6 +37,7 @@ NGINX_WEBSERVER=0
|
||||||
UPDATE_NGINX=0
|
UPDATE_NGINX=0
|
||||||
UPDATE_UHTTPD=0
|
UPDATE_UHTTPD=0
|
||||||
UPDATE_HAPROXY=0
|
UPDATE_HAPROXY=0
|
||||||
|
USER_CLEANUP=
|
||||||
|
|
||||||
. /lib/functions.sh
|
. /lib/functions.sh
|
||||||
|
|
||||||
|
@ -168,6 +169,11 @@ post_checks()
|
||||||
/etc/init.d/haproxy restart
|
/etc/init.d/haproxy restart
|
||||||
log "Restarting haproxy..."
|
log "Restarting haproxy..."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ -n "$USER_CLEANUP" ] && [ -f "$USER_CLEANUP" ]; then
|
||||||
|
log "Running user-provided cleanup script from $USER_CLEANUP."
|
||||||
|
"$USER_CLEANUP" || return 1
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
err_out()
|
err_out()
|
||||||
|
@ -207,6 +213,8 @@ issue_cert()
|
||||||
local failed_dir
|
local failed_dir
|
||||||
local webroot
|
local webroot
|
||||||
local dns
|
local dns
|
||||||
|
local user_setup
|
||||||
|
local user_cleanup
|
||||||
local ret
|
local ret
|
||||||
local staging=
|
local staging=
|
||||||
local HOOK=
|
local HOOK=
|
||||||
|
@ -220,10 +228,13 @@ issue_cert()
|
||||||
config_get keylength "$section" keylength
|
config_get keylength "$section" keylength
|
||||||
config_get webroot "$section" webroot
|
config_get webroot "$section" webroot
|
||||||
config_get dns "$section" dns
|
config_get dns "$section" dns
|
||||||
|
config_get user_setup "$section" user_setup
|
||||||
|
config_get user_cleanup "$section" user_cleanup
|
||||||
|
|
||||||
UPDATE_NGINX=$update_nginx
|
UPDATE_NGINX=$update_nginx
|
||||||
UPDATE_UHTTPD=$update_uhttpd
|
UPDATE_UHTTPD=$update_uhttpd
|
||||||
UPDATE_HAPROXY=$update_haproxy
|
UPDATE_HAPROXY=$update_haproxy
|
||||||
|
USER_CLEANUP=$user_cleanup
|
||||||
|
|
||||||
[ "$enabled" -eq "1" ] || return
|
[ "$enabled" -eq "1" ] || return
|
||||||
|
|
||||||
|
@ -237,7 +248,12 @@ issue_cert()
|
||||||
set -- $domains
|
set -- $domains
|
||||||
main_domain=$1
|
main_domain=$1
|
||||||
|
|
||||||
[ -n "$webroot" ] || [ -n "$dns" ] || pre_checks "$main_domain" || return 1
|
if [ -n "$user_setup" ] && [ -f "$user_setup" ]; then
|
||||||
|
log "Running user-provided setup script from $user_setup."
|
||||||
|
"$user_setup" "$main_domain" || return 1
|
||||||
|
else
|
||||||
|
[ -n "$webroot" ] || [ -n "$dns" ] || pre_checks "$main_domain" || return 1
|
||||||
|
fi
|
||||||
|
|
||||||
log "Running $APP for $main_domain"
|
log "Running $APP for $main_domain"
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue