From 286c64a9a729bef4412e6f743c49adbbc28593fb Mon Sep 17 00:00:00 2001 From: James Meyer Date: Mon, 23 Mar 2009 12:52:48 -0500 Subject: LinHES-config: Add logic to account for "helpful" DNS returning results for hostnames that do not exisit. --- abs/core-testing/LinHES-config/PKGBUILD | 2 +- abs/core-testing/LinHES-config/install_proxy.sh | 29 +++++++++++++++++++++---- 2 files changed, 26 insertions(+), 5 deletions(-) diff --git a/abs/core-testing/LinHES-config/PKGBUILD b/abs/core-testing/LinHES-config/PKGBUILD index ef2fa4d..cabc674 100644 --- a/abs/core-testing/LinHES-config/PKGBUILD +++ b/abs/core-testing/LinHES-config/PKGBUILD @@ -1,6 +1,6 @@ pkgname=LinHES-config pkgver=1.0 -pkgrel=343 +pkgrel=344 conflicts=(MythVantage-config MythVantage-config-dev LinHES-config-dev ) pkgdesc="Install and configure your system" depends=(bc libstatgrab mysql-python expect curl dnsutils parted sg3_utils nmbscan system-templates ) diff --git a/abs/core-testing/LinHES-config/install_proxy.sh b/abs/core-testing/LinHES-config/install_proxy.sh index 824c76e..c73b860 100755 --- a/abs/core-testing/LinHES-config/install_proxy.sh +++ b/abs/core-testing/LinHES-config/install_proxy.sh @@ -647,8 +647,17 @@ echo "-----------------------------------------------------------------------3-- #if host is found, then check to see if it's online #if hoip matchs my ip assume it's ok echo "network check my hostname $hostname" - hout=`host $hostname` + hout=`host $hostname|head -n1` status=$? + hoip=`echo $hout|awk '{print $4}'` + if [ $hoip = found: ] + then + status=1 + fi + + unkownhost=`host unkown.linhes.org |head -n1 ` + unkownhostip=`echo $unkownhost |awk '{print $4}'` + #found host, now grab the ip if [ $status = 0 ] then @@ -656,11 +665,23 @@ echo "-----------------------------------------------------------------------3-- /sbin/ifconfig -a |grep -q $hoip if [ $? = 0 ] then - echo "DNS ip matches on of my ips" + echo "DNS ip matches on of my ips $hoip" status=0 else - echo "IP in DNS but doesn't match mine, hostname is not safe to use" - status=7 + if [ $unkownhostip = $hoip ] + then + echo "Bad DNS returning false hits" + echo "Assuming hostname is OK" + echo "DNS unknown: $unkownhostip" + echo " HOSTDNS: $hoip " + /sbin/ifconfig -a |grep "inet addr" + else + echo "IP in DNS but doesn't match mine, hostname is not safe to use" + echo "DNS:$hoip" + echo "HOST: " + /sbin/ifconfig -a |grep "inet addr" + status=7 + fi fi else echo "Couldn't find hostname in DNS, must be safe to use" -- cgit v0.12