Exit if certificate check fails

This commit is contained in:
Bob Mottram 2018-03-03 22:36:56 +00:00
parent 5db74ee7df
commit 978f848350
4 changed files with 8 additions and 1 deletions

View File

@ -523,6 +523,7 @@ function install_irc_server {
if [[ "$(cert_exists "${DEFAULT_DOMAIN_NAME}")" == "0" ]]; then
"${PROJECT_NAME}-addcert" -h ngircd --dhkey "${DH_KEYLENGTH}"
function_check check_certificates
CHECK_HOSTNAME=ngircd
check_certificates ngircd
fi

View File

@ -973,6 +973,7 @@ function install_xmpp {
if [ ! -f "/etc/ssl/certs/${DEFAULT_DOMAIN_NAME}.pem" ]; then
if [ ! -f /etc/ssl/certs/xmpp.crt ]; then
"${PROJECT_NAME}-addcert" -h xmpp --dhkey "${DH_KEYLENGTH}"
CHECK_HOSTNAME=xmpp
check_certificates xmpp
if [ ! -f /etc/ssl/certs/xmpp.crt ]; then
echo $'Failed to create xmpp certificate'

View File

@ -1068,6 +1068,7 @@ function configure_imap {
if [[ "$(cert_exists dovecot)" == "0" ]]; then
"${PROJECT_NAME}-addcert" -h dovecot --dhkey "$DH_KEYLENGTH"
CHECK_HOSTNAME=dovecot
check_certificates dovecot
fi

View File

@ -184,7 +184,8 @@ function test_domain_name {
# Checks whether certificates were generated for the given hostname
function check_certificates {
if [ ! "$1" ]; then
return
echo $'No certificate name provided'
exit 3568736585683
fi
USE_LETSENCRYPT='no'
if [ "$2" ]; then
@ -259,6 +260,7 @@ function create_letsencrypt_cert {
echo $"Lets Encrypt failed for ${SITE_DOMAIN_NAME}, so try making a self-signed cert"
"${PROJECT_NAME}-addcert" -h "${SITE_DOMAIN_NAME}" --dhkey "${DH_KEYLENGTH}"
function_check check_certificates
CHECK_HOSTNAME="${SITE_DOMAIN_NAME}"
check_certificates "${SITE_DOMAIN_NAME}"
else
echo $"Lets Encrypt failed for $SITE_DOMAIN_NAME"
@ -272,6 +274,7 @@ function create_letsencrypt_cert {
fi
function_check check_certificates
CHECK_HOSTNAME="${SITE_DOMAIN_NAME}"
check_certificates "${SITE_DOMAIN_NAME}" 'yes'
}
@ -1013,6 +1016,7 @@ function email_install_tls {
fi
if [ ! -f /etc/ssl/certs/exim.dhparam ]; then
"${PROJECT_NAME}-addcert" -h exim --dhkey "$DH_KEYLENGTH"
CHECK_HOSTNAME=exim
check_certificates exim
cp /etc/ssl/certs/exim.dhparam /etc/exim4
chown root:Debian-exim /etc/exim4/exim.dhparam