forked from ISTI-ansible-roles/ansible-roles
Try to fix a problem with acme.sh when we ask for a certificate for the first time.
This commit is contained in:
parent
6bd05fe9cc
commit
1c0a42cdd8
|
@ -13,10 +13,26 @@ else
|
||||||
fi
|
fi
|
||||||
RETVAL=
|
RETVAL=
|
||||||
|
|
||||||
|
if [ ! -f "$ACME_SH_CONFIG_HOME/ok_certificate_issued" ] ; then
|
||||||
|
# First request. Try to shut down all the services running on port 80
|
||||||
|
if [ -x /bin/systemctl ] ; then
|
||||||
|
/bin/systemctl stop nginx >/dev/null 2>&1
|
||||||
|
/bin/systemctl stop apache2 >/dev/null 2>&1
|
||||||
|
/bin/systemctl stop httpd >/dev/null 2>&1
|
||||||
|
else
|
||||||
|
service nginx stop
|
||||||
|
service apache2 stop
|
||||||
|
service httpd stop
|
||||||
|
fi
|
||||||
|
$ACME_SH_BIN $ACME_SH_FIRST_CERT_REQUEST > "$ACME_SH_ISSUE_LOG_FILE" 2>&1
|
||||||
|
RETVAL=$?
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
$ACME_SH_BIN $ACME_SH_ISSUE_CERT_REQUEST > "$ACME_SH_ISSUE_LOG_FILE" 2>&1
|
$ACME_SH_BIN $ACME_SH_ISSUE_CERT_REQUEST > "$ACME_SH_ISSUE_LOG_FILE" 2>&1
|
||||||
RETVAL=$?
|
RETVAL=$?
|
||||||
|
|
||||||
if [ $RETVAL -ne 0 ] ; then
|
if [ $RETVAL -eq 0 ] ; then
|
||||||
touch "$ACME_SH_CONFIG_HOME/ok_certificate_issued"
|
touch "$ACME_SH_CONFIG_HOME/ok_certificate_issued"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
|
@ -39,9 +39,15 @@ ACME_SH_ISSUE_CERT_REQUEST="$ACME_SH_ISSUE_CERT_REQUEST --test"
|
||||||
|
|
||||||
ACME_SH_ISSUE_CERT_DOMAINS="{% for dom in letsencrypt_acme_sh_domains %} -d {{ dom.domain }} {% if dom.dns_provider is defined %} --dns {{ dom.dns_provider }} {% if dom.dns_alias_challenge is defined %} --challenge-alias {{ dom.dns_alias_challenge }} {% endif %} {% endif %} {% if dom.standalone is defined %} --standalone --httpport {{ letsencrypt_acme_standalone_port }} {% endif %} {% endfor %}"
|
ACME_SH_ISSUE_CERT_DOMAINS="{% for dom in letsencrypt_acme_sh_domains %} -d {{ dom.domain }} {% if dom.dns_provider is defined %} --dns {{ dom.dns_provider }} {% if dom.dns_alias_challenge is defined %} --challenge-alias {{ dom.dns_alias_challenge }} {% endif %} {% endif %} {% if dom.standalone is defined %} --standalone --httpport {{ letsencrypt_acme_standalone_port }} {% endif %} {% endfor %}"
|
||||||
|
|
||||||
|
ACME_SH_FIRST_REQUEST_CERT_DOMAINS="{% for dom in letsencrypt_acme_sh_domains %} -d {{ dom.domain }} {% if dom.dns_provider is defined %} --dns {{ dom.dns_provider }} {% if dom.dns_alias_challenge is defined %} --challenge-alias {{ dom.dns_alias_challenge }} {% endif %} {% endif %} {% if dom.standalone is defined %} --standalone --httpport 80 {% endif %} {% endfor %}"
|
||||||
|
|
||||||
# The complete command line to issue a certificate
|
# The complete command line to issue a certificate
|
||||||
ACME_SH_ISSUE_CERT_REQUEST="$ACME_SH_ISSUE_CERT_REQUEST $ACME_SH_ISSUE_CERT_DOMAINS"
|
ACME_SH_ISSUE_CERT_REQUEST="$ACME_SH_ISSUE_CERT_REQUEST $ACME_SH_ISSUE_CERT_DOMAINS"
|
||||||
|
|
||||||
|
# The complete command line to issue a certificate. The first time we have to use port 80 when not using the dns protocol
|
||||||
|
ACME_SH_FIRST_CERT_REQUEST="$ACME_SH_ISSUE_CERT_REQUEST $ACME_SH_FIRST_REQUEST_CERT_DOMAINS"
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Certificate install options
|
# Certificate install options
|
||||||
#
|
#
|
||||||
|
|
Loading…
Reference in New Issue