浏览代码

Exit if certificate check fails

Bob Mottram 7 年前
父节点
当前提交
978f848350
共有 4 个文件被更改,包括 8 次插入1 次删除
  1. 1
    0
      src/freedombone-app-irc
  2. 1
    0
      src/freedombone-app-xmpp
  3. 1
    0
      src/freedombone-base-email
  4. 5
    1
      src/freedombone-utils-web

+ 1
- 0
src/freedombone-app-irc 查看文件

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

+ 1
- 0
src/freedombone-app-xmpp 查看文件

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

+ 1
- 0
src/freedombone-base-email 查看文件

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

+ 5
- 1
src/freedombone-utils-web 查看文件

@@ -184,7 +184,8 @@ function test_domain_name {
184 184
 # Checks whether certificates were generated for the given hostname
185 185
 function check_certificates {
186 186
     if [ ! "$1" ]; then
187
-        return
187
+        echo $'No certificate name provided'
188
+        exit 3568736585683
188 189
     fi
189 190
     USE_LETSENCRYPT='no'
190 191
     if [ "$2" ]; then
@@ -259,6 +260,7 @@ function create_letsencrypt_cert {
259 260
             echo $"Lets Encrypt failed for ${SITE_DOMAIN_NAME}, so try making a self-signed cert"
260 261
             "${PROJECT_NAME}-addcert" -h "${SITE_DOMAIN_NAME}" --dhkey "${DH_KEYLENGTH}"
261 262
             function_check check_certificates
263
+            CHECK_HOSTNAME="${SITE_DOMAIN_NAME}"
262 264
             check_certificates "${SITE_DOMAIN_NAME}"
263 265
         else
264 266
             echo $"Lets Encrypt failed for $SITE_DOMAIN_NAME"
@@ -272,6 +274,7 @@ function create_letsencrypt_cert {
272 274
     fi
273 275
 
274 276
     function_check check_certificates
277
+    CHECK_HOSTNAME="${SITE_DOMAIN_NAME}"
275 278
     check_certificates "${SITE_DOMAIN_NAME}" 'yes'
276 279
 }
277 280
 
@@ -1013,6 +1016,7 @@ function email_install_tls {
1013 1016
     fi
1014 1017
     if [ ! -f /etc/ssl/certs/exim.dhparam ]; then
1015 1018
         "${PROJECT_NAME}-addcert" -h exim --dhkey "$DH_KEYLENGTH"
1019
+        CHECK_HOSTNAME=exim
1016 1020
         check_certificates exim
1017 1021
         cp /etc/ssl/certs/exim.dhparam /etc/exim4
1018 1022
         chown root:Debian-exim /etc/exim4/exim.dhparam