From 107687cd710f7c29fedfc1b6e9405f92c49ab5d1 Mon Sep 17 00:00:00 2001 From: CantonBolo Date: Thu, 14 Mar 2019 10:36:58 +0800 Subject: [PATCH 1/4] add nuster support (https://github.com/jiangwenyuan/nuster) --- deploy/nuster.sh | 58 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 deploy/nuster.sh diff --git a/deploy/nuster.sh b/deploy/nuster.sh new file mode 100644 index 00000000..8ba5c226 --- /dev/null +++ b/deploy/nuster.sh @@ -0,0 +1,58 @@ +#!/usr/bin/env sh + +#Here is a script to deploy cert to nuster server. + +#returns 0 means success, otherwise error. + +######## Public functions ##################### + +#domain keyfile certfile cafile fullchain +nuster_deploy() { + _cdomain="$1" + _ckey="$2" + _ccert="$3" + _cca="$4" + _cfullchain="$5" + + _debug _cdomain "$_cdomain" + _debug _ckey "$_ckey" + _debug _ccert "$_ccert" + _debug _cca "$_cca" + _debug _cfullchain "$_cfullchain" + + # handle reload preference + DEFAULT_NUSTER_RELOAD="/usr/sbin/service nuster restart" + if [ -z "${DEPLOY_NUSTER_RELOAD}" ]; then + _reload="${DEFAULT_NUSTER_RELOAD}" + _cleardomainconf DEPLOY_NUSTER_RELOAD + else + _reload="${DEPLOY_NUSTER_RELOAD}" + _savedomainconf DEPLOY_NUSTER_RELOAD "$DEPLOY_NUSTER_RELOAD" + fi + _savedomainconf DEPLOY_NUSTER_PEM_PATH "$DEPLOY_NUSTER_PEM_PATH" + + # work out the path where the PEM file should go + _pem_path="${DEPLOY_NUSTER_PEM_PATH}" + if [ -z "$_pem_path" ]; then + _err "Path to save PEM file not found. Please define DEPLOY_NUSTER_PEM_PATH." + return 1 + fi + _pem_full_path="$_pem_path/$_cdomain.pem" + _info "Full path to PEM $_pem_full_path" + + # combine the key and fullchain into a single pem and install + cat "$_cfullchain" "$_ckey" >"$_pem_full_path" + chmod 600 "$_pem_full_path" + _info "Certificate successfully deployed" + + # restart HAProxy + _info "Run reload: $_reload" + if eval "$_reload"; then + _info "Reload success!" + return 0 + else + _err "Reload error" + return 1 + fi + +} From ae78a1afc83eab593a05f34fe97c1a31f8169cd0 Mon Sep 17 00:00:00 2001 From: CantonBolo Date: Mon, 18 Mar 2019 10:20:22 +0800 Subject: [PATCH 2/4] add nuster support (https://github.com/jiangwenyuan/nuster) --- deploy/README.md | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/deploy/README.md b/deploy/README.md index 44d53225..818df03b 100644 --- a/deploy/README.md +++ b/deploy/README.md @@ -391,3 +391,23 @@ acme.sh --deploy --deploy-hook mydevil -d example.com ``` That will remove old certificate and install new one. + +## 15. Deploy the cert to nuster + +You must specify the path where you want the concatenated key and certificate chain written. +```sh +export DEPLOY_NUSTER_PEM_PATH=/etc/nuster +``` + +You may optionally define the command to reload nuster. The value shown below will be used as the default if you don't set this environment variable. + +```sh +export DEPLOY_NUSTER_RELOAD="/usr/sbin/service nuster restart" +``` + +You can then deploy the certificate as follows +```sh +acme.sh --deploy -d nuster.example.com --deploy-hook nuster +``` + +The path for the PEM file will be stored with the domain configuration and will be available when renewing, so that deploy will happen automatically when renewed. From 4f45d0dafbd2455e97d46ddde7992b58d67c89f3 Mon Sep 17 00:00:00 2001 From: CantonBolo Date: Thu, 14 Mar 2019 10:36:58 +0800 Subject: [PATCH 3/4] add nuster support (https://github.com/jiangwenyuan/nuster) --- deploy/nuster.sh | 58 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 deploy/nuster.sh diff --git a/deploy/nuster.sh b/deploy/nuster.sh new file mode 100644 index 00000000..8ba5c226 --- /dev/null +++ b/deploy/nuster.sh @@ -0,0 +1,58 @@ +#!/usr/bin/env sh + +#Here is a script to deploy cert to nuster server. + +#returns 0 means success, otherwise error. + +######## Public functions ##################### + +#domain keyfile certfile cafile fullchain +nuster_deploy() { + _cdomain="$1" + _ckey="$2" + _ccert="$3" + _cca="$4" + _cfullchain="$5" + + _debug _cdomain "$_cdomain" + _debug _ckey "$_ckey" + _debug _ccert "$_ccert" + _debug _cca "$_cca" + _debug _cfullchain "$_cfullchain" + + # handle reload preference + DEFAULT_NUSTER_RELOAD="/usr/sbin/service nuster restart" + if [ -z "${DEPLOY_NUSTER_RELOAD}" ]; then + _reload="${DEFAULT_NUSTER_RELOAD}" + _cleardomainconf DEPLOY_NUSTER_RELOAD + else + _reload="${DEPLOY_NUSTER_RELOAD}" + _savedomainconf DEPLOY_NUSTER_RELOAD "$DEPLOY_NUSTER_RELOAD" + fi + _savedomainconf DEPLOY_NUSTER_PEM_PATH "$DEPLOY_NUSTER_PEM_PATH" + + # work out the path where the PEM file should go + _pem_path="${DEPLOY_NUSTER_PEM_PATH}" + if [ -z "$_pem_path" ]; then + _err "Path to save PEM file not found. Please define DEPLOY_NUSTER_PEM_PATH." + return 1 + fi + _pem_full_path="$_pem_path/$_cdomain.pem" + _info "Full path to PEM $_pem_full_path" + + # combine the key and fullchain into a single pem and install + cat "$_cfullchain" "$_ckey" >"$_pem_full_path" + chmod 600 "$_pem_full_path" + _info "Certificate successfully deployed" + + # restart HAProxy + _info "Run reload: $_reload" + if eval "$_reload"; then + _info "Reload success!" + return 0 + else + _err "Reload error" + return 1 + fi + +} From 7aaf523fb56cfb53cbd49670be64d2b718540b37 Mon Sep 17 00:00:00 2001 From: CantonBolo Date: Mon, 18 Mar 2019 10:20:22 +0800 Subject: [PATCH 4/4] add nuster support (https://github.com/jiangwenyuan/nuster) --- deploy/README.md | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/deploy/README.md b/deploy/README.md index 44d53225..818df03b 100644 --- a/deploy/README.md +++ b/deploy/README.md @@ -391,3 +391,23 @@ acme.sh --deploy --deploy-hook mydevil -d example.com ``` That will remove old certificate and install new one. + +## 15. Deploy the cert to nuster + +You must specify the path where you want the concatenated key and certificate chain written. +```sh +export DEPLOY_NUSTER_PEM_PATH=/etc/nuster +``` + +You may optionally define the command to reload nuster. The value shown below will be used as the default if you don't set this environment variable. + +```sh +export DEPLOY_NUSTER_RELOAD="/usr/sbin/service nuster restart" +``` + +You can then deploy the certificate as follows +```sh +acme.sh --deploy -d nuster.example.com --deploy-hook nuster +``` + +The path for the PEM file will be stored with the domain configuration and will be available when renewing, so that deploy will happen automatically when renewed.