Skip to content
This repository has been archived by the owner on Apr 12, 2021. It is now read-only.

Sat6: forward/reverse DNS record #38

Open
jhutar opened this issue Nov 3, 2016 · 0 comments
Open

Sat6: forward/reverse DNS record #38

jhutar opened this issue Nov 3, 2016 · 0 comments

Comments

@jhutar
Copy link
Collaborator

jhutar commented Nov 3, 2016

https://github.com/boogiespook/sat6_healthCheck/blob/master/sat6_healthCheck.sh#L189-L221

function checkDNS {
    host=$1
    echo -e "
     + Checking DNS entries for $host"

    ## Check the forward DNS record.
    forwardDNS=$(nslookup $host |  grep ^Name -A1 | awk '/^Address:/ {print $2}')
    if [[ ! -z $forwardDNS ]]
    then
      printOK "Forward DNS resolves to $forwardDNS"
    else
      printError "Forward DNS does not resolve"

    fi

    ## Check the reverse DNS record.
    reverseDNS=$(nslookup $forwardDNS | awk '/name/ {print $NF}' | rev | cut -c2- | rev)
    if [[ ! -z $reverseDNS ]]
    then
      printOK "Reverse DNS resolves to $reverseDNS"
    else
      printError "Reverse DNS not resolvable for $forwardDNS"
    fi

    ## Check the forward and reverse records match.
    if [[ $host == $reverseDNS ]]
    then
      printOK "Forward and reverse DNS match"
    else
      printError "Forward and reverse DNS do not match for $host / $reverseDNS"
    fi
    echo
}
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant