From 1619aed3f0b959bc2600b30d59bdbeaa5dc372e3 Mon Sep 17 00:00:00 2001 From: B-andi-T <118496203+B-andi-T@users.noreply.github.com> Date: Mon, 26 Dec 2022 20:59:10 +0330 Subject: [PATCH] Fixed: Match domain IP with server IPs --- Ocserv-Installer.sh | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/Ocserv-Installer.sh b/Ocserv-Installer.sh index 62c3be7..d1f8403 100644 --- a/Ocserv-Installer.sh +++ b/Ocserv-Installer.sh @@ -1481,10 +1481,8 @@ function newDomain() { echo -n "Enter your Domain (Like example.com or sub.example.com): " read domainInput - serverIPv4=$(hostname -I | awk '{print $1}') domainIP=$(getent hosts $domainInput | awk '{ print $1 }') - multiple_ip=$(hostname -I | awk '{print $1}' | grep -E $domainIP 2>/dev/null) - sd_match=$(getent hosts $domainInput | awk '{ print $1 }' | grep -E $serverIPv4 2>/dev/null) + serverIP_domainIP_match=$(hostname -I | grep -o $domainIP 2>/dev/null) if [[ -z $domainInput ]]; then echo -e "${RED}Domain is required${EC}" 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}" newDomain 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} ${YELLOW}The IP of the Domain you entered: ${EC} $domainIP ${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}" newDomain fi