My domain is: https://quantum-equities.com
I ran this command: # certbot certonly --csr /etc/letsencrypt/csr-quantum-equities.com.csr --fullchain-path /etc/pki/tls/chains/quantum-equities.com_fullchain-2018-02-19.pem --chain-path /etc/pki/tls/chains/quantum-equities.com_chain-2018-02-19.pem --cert-path /etc/pki/tls/certs/quantum-equities.com_cert-2018-02-19.pem
It produced this output: Failed authorization procedure. mail.quantum-equities.com (tls-sni-01): urn:acme:error:connection :: The server could not connect to the client to verify the domain :: Timeout
My web server is (include version): Apache 2.4.6 67.el7.centos.6
The operating system my web server runs on is (include version): CentOS 7.4
I can login to a root shell on my machine (yes or no, or I don’t know): Yes
I’m using a control panel to manage my site: No
I’ve made a script to do automatic renewals (below) which did not work on this first round. Manually entering the command (above) produced an error that certbot could not confirm any of my sites. It is a mystery why, as the old cert is still valid and my mail sites ping. (I have ping turned off for web)
Obviously mail.quantum-equities.com is alive and well.
As an aside, it seems pretty clear at this point that RHEL’s SELinux implementation is very broken with certbot, so I just turn it off in the script. I see plenty of SELinux errors when certbot attempts to run, to wit:
type=AVC msg=audit(1519075254.297:146): avc: denied { write } for pid=2185 comm=“httpd” path="/var/lib/letsencrypt/.certbot.lock" dev=“dm-0” ino=33818389 scontext=unconfined_u:system_r:httpd_t:s0 tcontext=unconfined_u:object_r:var_lib_t:s0 tclass=file permissive=0
type=AVC msg=audit(1519075254.297:146): avc: denied { write } for pid=2185 comm=“httpd” path="/var/log/letsencrypt/.certbot.lock" dev=“dm-0” ino=407083 scontext=unconfined_u:system_r:httpd_t:s0 tcontext=unconfined_u:object_r:var_log_t:s0 tclass=file permissive=0
type=AVC msg=audit(1519075254.297:146): avc: denied { write } for pid=2185 comm=“httpd” path="/etc/letsencrypt/.certbot.lock" dev=“dm-0” ino=16839603 scontext=unconfined_u:system_r:httpd_t:s0 tcontext=unconfined_u:object_r:etc_t:s0 tclass=file permissive=0
type=AVC msg=audit(1519075254.354:147): avc: denied { write } for pid=2188 comm=“httpd” path="/var/lib/letsencrypt/.certbot.lock" dev=“dm-0” ino=33818389 scontext=unconfined_u:system_r:httpd_t:s0 tcontext=unconfined_u:object_r:var_lib_t:s0 tclass=file permissive=0
type=AVC msg=audit(1519075254.354:147): avc: denied { write } for pid=2188 comm=“httpd” path="/var/log/letsencrypt/.certbot.lock" dev=“dm-0” ino=407083 scontext=unconfined_u:system_r:httpd_t:s0 tcontext=unconfined_u:object_r:var_log_t:s0 tclass=file permissive=0
type=AVC msg=audit(1519075254.354:147): avc: denied { write } for pid=2188 comm=“httpd” path="/etc/letsencrypt/.certbot.lock" dev=“dm-0” ino=16839603 scontext=unconfined_u:system_r:httpd_t:s0 tcontext=unconfined_u:object_r:etc_t:s0 tclass=file permissive=0
So with all the problems to sort through I just turn off SELinux during the cert renewal script. But it still can not complete. This will be an emergency soon.
/usr/local/bin/letsencrypt-renew
#!/bin/sh
DATE=$(date +%Y-%m-%d)
DIR=/etc/pki/tls
setenforce 0
certbot handling
first it cannot replace certs, so ensure new locations (date suffix)
each time mean the certificate is unique each time. Next, it’s
really chatty, so the only way to tell if there was a failure is to
check whether the certificates got updated and then get cron to
email the log
Quantum-Equities.com
DIR2=/etc/letsencrypt/live/quantum-equities.com
CERT="${DIR}/certs/quantum-equities.com_cert-${DATE}.pem"
FULLCHAIN="${DIR}/chains/quantum-equities.com_fullchain-${DATE}.pem"
CHAIN="${DIR}/chains/quantum-equities.com_chain-${DATE}.pem"
CSR=/etc/letsencrypt/csr-quantum-equities.com.csr
OUT=/tmp/certbot-QE.out
certbot certonly --csr ${CSR} --fullchain-path ${FULLCHAIN} --chain-path ${CHAIN} --cert-path ${CERT} --apache > ${OUT} 2>&1
if [ ! -f ${FULLCHAIN} -o ! -f ${CHAIN} -o ! -f ${CERT} ]; then
cat /tmp/certbot-QE.out | mail -s “TLS Cert Update Fail for quantum-equities.com” postmaster@quantum-equities.com
fi
link into place
cert only (apache needs)
ln -sf ${CERT} ${DIR2}/cert.pem
cert with chain (stunnel needs)
ln -sf ${FULL} ${DIR2}/fullchain.pem
chain only (apache needs)
ln -sf ${CHAIN} ${DIR}/chain.pem
Quantum-Sci.com
DIR2=/etc/letsencrypt/live/quantum-sci.com
CERT="${DIR}/certs/quantum-sci.com_cert-${DATE}.pem"
FULLCHAIN="${DIR}/chains/quantum-sci.com_fullchain-${DATE}.pem"
CHAIN="${DIR}/chains/quantum-sci.com_chain-${DATE}.pem"
CSR=/etc/letsencrypt/csr-quantum-sci.com.csr
OUT=/tmp/certbot-QS.out
certbot certonly --csr ${CSR} --fullchain-path ${FULLCHAIN} --chain-path ${CHAIN} --cert-path ${CERT} --apache > ${OUT} 2>&1
if [ ! -f ${FULLCHAIN} -o ! -f ${CHAIN} -o ! -f ${CERT} ]; then
cat ${OUT} | mail -s “TLS Cert Update Fail for quantum-sci.com” postmaster@quantum-sci.com
fi
link into place
cert only (apache needs)
ln -sf ${CERT} ${DIR2}/cert.pem
cert with chain (stunnel needs)
ln -sf ${FULL} ${DIR2}/fullchain.pem
chain only (apache needs)
Quantum-Sci.com
DIR2=/etc/letsencrypt/live/quantum-sci.com
CERT="${DIR}/certs/quantum-sci.com_cert-${DATE}.pem"
FULLCHAIN="${DIR}/chains/quantum-sci.com_fullchain-${DATE}.pem"
CHAIN="${DIR}/chains/quantum-sci.com_chain-${DATE}.pem"
CSR=/etc/letsencrypt/csr-quantum-sci.com.csr
OUT=/tmp/certbot-QS.out
certbot certonly --csr ${CSR} --fullchain-path ${FULLCHAIN} --chain-path ${CHAIN} --cert-path ${CERT} --apache > ${OUT} 2>&1
if [ ! -f ${FULLCHAIN} -o ! -f ${CHAIN} -o ! -f ${CERT} ]; then
cat ${OUT} | mail -s “TLS Cert Update Fail for quantum-sci.com” postmaster@quantum-sci.com
fi
link into place
cert only (apache needs)
ln -sf ${CERT} ${DIR2}/cert.pem
cert with chain (stunnel needs)
ln -sf ${FULL} ${DIR2}/fullchain.pem
chain only (apache needs)
ln -sf ${CHAIN} ${DIR}/chain.pem
Delphi-Real-Estate.com
DIR2=/etc/letsencrypt/live/delphi-real-estate.com
CERT="${DIR}/certs/delphi-real-estate.com_cert-${DATE}.pem"
FULLCHAIN="${DIR}/chains/delphi-real-estate.com_fullchain-${DATE}.pem"
CHAIN="${DIR}/chains/delphi-real-estate.com_chain-${DATE}.pem"
CSR=/etc/letsencrypt/csr-delphi-real-estate.com.csr
OUT=/tmp/certbot-DRE.out
certbot certonly --csr ${CSR} --fullchain-path ${FULLCHAIN} --chain-path ${CHAIN} --cert-path ${CERT} --apache > ${OUT} 2>&1
if [ ! -f ${FULLCHAIN} -o ! -f ${CHAIN} -o ! -f ${CERT} ]; then
cat ${OUT} | mail -s “TLS Cert Update Fail for delphi-real-estate.com” postmaster@delphi-real-estate.com
fi
link into place
cert only (apache needs)
ln -sf ${CERT} ${DIR2}/cert.pem
cert with chain (stunnel needs)
ln -sf ${FULL} ${DIR2}/fullchain.pem
chain only (apache needs)
ln -sf ${CHAIN} ${DIR}/chain.pem
setenforce 1
reload the services
systemctl reload httpd
#systemctl restart stunnel4