Browse Source

Merge pull request #2842 from jaapmarcus/fix/2838-block-cname-on-root

Fix #2838 Prevent users adding CNAME for @ record
Raphael 3 years ago
parent
commit
708a447dc5
2 changed files with 8 additions and 0 deletions
  1. 4 0
      bin/v-add-dns-record
  2. 4 0
      bin/v-change-dns-record

+ 4 - 0
bin/v-add-dns-record

@@ -73,6 +73,10 @@ if [ "$rtype" != "CAA" ]; then
     fi
 fi
 
+if [ "$record" = "@" ] && [ "$rtype" = "CNAME" ]; then
+    check_result $E_INVALID "CNAME on root is not allowed"
+fi
+
 # Additional argument formatting
 format_domain
 format_domain_idn

+ 4 - 0
bin/v-change-dns-record

@@ -58,6 +58,10 @@ check_hestia_demo_mode
 #                       Action                             #
 #----------------------------------------------------------#
 
+if [ "$record" = "@" ] && [ "$rtype" = "CNAME" ]; then
+    check_result $E_INVALID "CNAME on root is not allowed"
+fi
+
 # Make sure the variable for the optional parameter TTL is empty before parsing
 # We depend on that later on
 unset TTL