diff --git a/Import-from-official-letsencrypt-client.md b/Import-from-official-letsencrypt-client.md index 08a84a3..b174264 100644 --- a/Import-from-official-letsencrypt-client.md +++ b/Import-from-official-letsencrypt-client.md @@ -47,7 +47,7 @@ for certdir in "${LETSENCRYPT}/live/"*; do continue fi - # Check if private-key, certificate and fullchain exist + # Check if private-key, certificate, chain and fullchain exist if [[ ! -e "${certdir}/privkey.pem" ]]; then echo " + Skipping: Private key is missing." continue @@ -56,10 +56,14 @@ for certdir in "${LETSENCRYPT}/live/"*; do echo " + Skipping: Certificate is missing." continue fi - if [[ ! -e "${certdir}/fullchain.pem" ]]; then + if [[ ! -e "${certdir}/chain.pem" ]]; then echo " + Skipping: Chain is missing." continue fi + if [[ ! -e "${certdir}/fullchain.pem" ]]; then + echo " + Skipping: Fullchain is missing." + continue + fi # Check if certificate still valid if ! openssl x509 -checkend 0 -noout -in "${certdir}/cert.pem" >/dev/null 2>&1; then @@ -93,6 +97,10 @@ for certdir in "${LETSENCRYPT}/live/"*; do ln -s "cert-${timestamp}.pem" "${BASEDIR}/certs/${domain}/cert.pem" echo " + Importing chain" + cat "${certdir}/chain.pem" > "${BASEDIR}/certs/${domain}/chain-${timestamp}.pem" + ln -s "chain-${timestamp}.pem" "${BASEDIR}/certs/${domain}/chain.pem" + + echo " + Importing fullchain" cat "${certdir}/fullchain.pem" > "${BASEDIR}/certs/${domain}/fullchain-${timestamp}.pem" ln -s "fullchain-${timestamp}.pem" "${BASEDIR}/certs/${domain}/fullchain.pem" done