Fixed: Match domain IP with server IPs

This commit is contained in:
B-andi-T
2022-12-26 20:59:10 +03:30
committed by GitHub
parent ed290d4f73
commit 1619aed3f0

View File

@@ -1481,10 +1481,8 @@ function newDomain() {
echo -n "Enter your Domain (Like example.com or sub.example.com): " echo -n "Enter your Domain (Like example.com or sub.example.com): "
read domainInput read domainInput
serverIPv4=$(hostname -I | awk '{print $1}')
domainIP=$(getent hosts $domainInput | awk '{ print $1 }') domainIP=$(getent hosts $domainInput | awk '{ print $1 }')
multiple_ip=$(hostname -I | awk '{print $1}' | grep -E $domainIP 2>/dev/null) serverIP_domainIP_match=$(hostname -I | grep -o $domainIP 2>/dev/null)
sd_match=$(getent hosts $domainInput | awk '{ print $1 }' | grep -E $serverIPv4 2>/dev/null)
if [[ -z $domainInput ]]; then if [[ -z $domainInput ]]; then
echo -e "${RED}Domain is required${EC}" echo -e "${RED}Domain is required${EC}"
newDomain newDomain
@@ -1494,12 +1492,12 @@ function newDomain() {
${CYAN}You may have entered the domain incorrectly or you may not have set the DNS record of the domain correctly from your domain panel.${EC}" ${CYAN}You may have entered the domain incorrectly or you may not have set the DNS record of the domain correctly from your domain panel.${EC}"
newDomain newDomain
else else
if ! [[ $domainIP == $sd_match ]] || ! [[ $domainIP == $multiple_ip ]]; then if ! [[ $domainIP == $serverIP_domainIP_match ]]; then
echo -e "${RED}The domain you entered does not match the IP of your server.${EC} echo -e "${RED}The domain you entered does not match the IP of your server.${EC}
${YELLOW}The IP of the Domain you entered: ${EC} ${YELLOW}The IP of the Domain you entered: ${EC}
$domainIP $domainIP
${YELLOW}Your Server IP: ${EC} ${YELLOW}Your Server IP: ${EC}
$serverIPv4 $(hostname -I)
${CYAN}You may have entered the domain incorrectly or you may not have set the DNS record of the domain correctly from your domain panel.${EC}" ${CYAN}You may have entered the domain incorrectly or you may not have set the DNS record of the domain correctly from your domain panel.${EC}"
newDomain newDomain
fi fi