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

Check if dns records are present, thanks to @ioannidesalex!

Raphael Schneeberger 6 лет назад
Родитель
Сommit
d2122f851e
1 измененных файлов с 9 добавлено и 0 удалено
  1. 9 0
      bin/v-add-letsencrypt-domain

+ 9 - 0
bin/v-add-letsencrypt-domain

@@ -113,6 +113,15 @@ else
     proto="http-01"
     proto="http-01"
 fi
 fi
 
 
+# Check if dns records exist for requested domain/aliases
+if [ "$proto" = "http-01"]; then
+    for identifier in $(echo $domain,$aliases |tr ',' '\n' |sort -u); do
+        if ! nslookup "${identifier}" >/dev/null 2>&1 ; then
+            check_result $E_NOTEXIST "DNS record for $identifier doesn't exist"
+        fi
+    done
+fi
+
 # Requesting nonce / STEP 1
 # Requesting nonce / STEP 1
 answer=$(curl -s -I "$LE_API/directory")
 answer=$(curl -s -I "$LE_API/directory")
 nonce=$(echo "$answer" |grep Nonce |cut -f2 -d \ |tr -d '\r\n')
 nonce=$(echo "$answer" |grep Nonce |cut -f2 -d \ |tr -d '\r\n')