From e613af5262f58c1cb86534db53630da28710e109 Mon Sep 17 00:00:00 2001 From: root Date: Wed, 21 Jun 2017 12:41:15 +0200 Subject: [PATCH] - Add output for error 'too many certificates already issued'. - Fix error on output if http request failed. --- install_dehydrated.sh | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/install_dehydrated.sh b/install_dehydrated.sh index 43d759c..befb26a 100755 --- a/install_dehydrated.sh +++ b/install_dehydrated.sh @@ -9,6 +9,9 @@ STR_PROCESSED="marked to be validated" STR_SUCCESS="Certificate has been produced" STR_INVALID_CHALLENGE="Error: Invalid Challenge" STR_HTTP_REQUEST_FAILED="Error: HTTP-Request failed" +STR_TOO_MANY_CERTIFICATES="too many certificates already issued for" + +ERR_MSG_TOO_MANY_CERTS="too many certificates already issued" # ------------- # --- Some functions @@ -1548,6 +1551,9 @@ _hosts_processed="\$(cat \$_logfile | grep "$STR_PROCESSED" 2> /dev/null | awk ' _successfully_created_hosts="\$(cat \$_logfile | grep "$STR_SUCCESS" 2> /dev/null | awk '{print\$3}')" _invalid_challenge="\$(cat \$_logfile | grep "$STR_INVALID_CHALLENGE" 2> /dev/null | awk '{print\$3}')" _http_request_failed="\$(cat \$_logfile | grep "$STR_HTTP_REQUEST_FAILED" 2> /dev/null | awk '{print\$3}')" +if grep -i -q "$ERR_MSG_TOO_MANY_CERTS" \$_logfile 2> /dev/null ; then + _too_many_certs_err_msg="\$(grep -i "$ERR_MSG_TOO_MANY_CERTS" \$_logfile 2> /dev/null)" +fi if [[ -n "\$_hosts_processed" ]] ; then certs_processed=true fi @@ -2128,15 +2134,25 @@ if [[ -n "\$_http_request_failed" ]] ; then echo "====================================================" echo "" - for _hostname in \$__http_request_failed ; do + for _hostname in \$_http_request_failed ; do echo " \$_hostname" done echo "" fi +if [[ -n "\$_too_many_certs_err_msg" ]] ; then + echo "" + echo "" + echo "Creating NEW Certificates failed - too many certificates already issued" + echo "========================================================================" + echo "" + echo -e "\$_too_many_certs_err_msg" + echo "" +fi -if grep -i "error:" \$_logfile > /dev/null 2>&1 > /dev/null 2>&1; then + +if grep -i "error:" \$_logfile > /dev/null 2>&1 || grep -i "$ERR_MSG_TOO_MANY_CERTS" \$_logfile > /dev/null 2>&1 ; then cp -a \$_logfile /var/log/ > /dev/null 2>&1