Просмотр исходного кода

Merge pull request #1037 from kmark/fix-letsenc-errors

Let's Encrypt fixes for #979 (invalid response) and #1008 (/tmp/*/domain.tld.crt file not found)
System Void 9 лет назад
Родитель
Сommit
605dae8774
2 измененных файлов с 5 добавлено и 1 удалено
  1. 4 0
      bin/v-check-letsencrypt-domain
  2. 1 1
      web/edit/web/index.php

+ 4 - 0
bin/v-check-letsencrypt-domain

@@ -89,12 +89,16 @@ uri=$(echo "$answer" |grep -A 3 http-01 |grep uri |cut -f 4 -d \")
 # Adding location wrapper for request challenge
 # Adding location wrapper for request challenge
 if [ "$WEB_SYSTEM" = 'nginx' ] || [ "$PROXY_SYSTEM" = 'nginx' ]; then
 if [ "$WEB_SYSTEM" = 'nginx' ] || [ "$PROXY_SYSTEM" = 'nginx' ]; then
     conf="$HOMEDIR/$user/conf/web/nginx.$r_domain.conf_letsencrypt"
     conf="$HOMEDIR/$user/conf/web/nginx.$r_domain.conf_letsencrypt"
+    sconf="$HOMEDIR/$user/conf/web/snginx.$r_domain.conf_letsencrypt"
     if [ ! -e "$conf" ]; then
     if [ ! -e "$conf" ]; then
         echo 'location ~ "^/\.well-known/acme-challenge/(.*)$" {' > $conf
         echo 'location ~ "^/\.well-known/acme-challenge/(.*)$" {' > $conf
         echo '    default_type text/plain;' >> $conf
         echo '    default_type text/plain;' >> $conf
         echo '    return 200 "$1.'$thumb'";' >> $conf
         echo '    return 200 "$1.'$thumb'";' >> $conf
         echo '}' >> $conf
         echo '}' >> $conf
     fi
     fi
+    if [ ! -e "$sconf" ]; then
+        ln -s "$conf" "$sconf"
+    fi
 else
 else
     acme="$HOMEDIR/$user/web/$r_domain/public_html/.well-known/acme-challenge"
     acme="$HOMEDIR/$user/web/$r_domain/public_html/.well-known/acme-challenge"
     if [ ! -d "$acme" ]; then
     if [ ! -d "$acme" ]; then

+ 1 - 1
web/edit/web/index.php

@@ -279,7 +279,7 @@ if (!empty($_POST['save'])) {
     }
     }
 
 
     // Change SSL certificate
     // Change SSL certificate
-    if (( $v_letsencrypt == 'no' ) && ( $v_ssl == 'yes' ) && (!empty($_POST['v_ssl'])) && (empty($_SESSION['error_msg']))) {
+    if (( $v_letsencrypt == 'no' ) && (empty($_POST['v_letsencrypt'])) && ( $v_ssl == 'yes' ) && (!empty($_POST['v_ssl'])) && (empty($_SESSION['error_msg']))) {
         if (( $v_ssl_crt != str_replace("\r\n", "\n",  $_POST['v_ssl_crt'])) || ( $v_ssl_key != str_replace("\r\n", "\n",  $_POST['v_ssl_key'])) || ( $v_ssl_ca != str_replace("\r\n", "\n",  $_POST['v_ssl_ca']))) {
         if (( $v_ssl_crt != str_replace("\r\n", "\n",  $_POST['v_ssl_crt'])) || ( $v_ssl_key != str_replace("\r\n", "\n",  $_POST['v_ssl_key'])) || ( $v_ssl_ca != str_replace("\r\n", "\n",  $_POST['v_ssl_ca']))) {
             exec ('mktemp -d', $mktemp_output, $return_var);
             exec ('mktemp -d', $mktemp_output, $return_var);
             $tmpdir = $mktemp_output[0];
             $tmpdir = $mktemp_output[0];