From fb02c18853dd2004ed936c77afabd310d7f115dd Mon Sep 17 00:00:00 2001 From: jjohnson2 Date: Fri, 20 Mar 2015 10:58:26 -0400 Subject: [PATCH] Fix erroneous 'noping' in various circumstances nmap's raw IP facility is prone to mistakes in various environments. Disable the raw IP handling by telling nmap to run as if it didn't have privilege --- xCAT-client/bin/pping | 2 +- xCAT-server/lib/xcat/plugins/nodestat.pm | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/xCAT-client/bin/pping b/xCAT-client/bin/pping index 66f5f6231..731a1f9f2 100755 --- a/xCAT-client/bin/pping +++ b/xCAT-client/bin/pping @@ -179,7 +179,7 @@ sub nmap_pping { my @nmap_options = xCAT::TableUtils->get_site_attribute("nmapoptions"); my $more_options = $nmap_options[0]; - open (FPING, "nmap -PE --system-dns --send-ip -sP $more_options ".join(' ',@$nodes). " 2> /dev/null|") or die("Cannot open nmap pipe: $!"); + open (FPING, "nmap -PE --unprivileged --system-dns --send-ip -sP $more_options ".join(' ',@$nodes). " 2> /dev/null|") or die("Cannot open nmap pipe: $!"); my $node; while () { if (/Host (.*) \(.*\) appears to be up/) { diff --git a/xCAT-server/lib/xcat/plugins/nodestat.pm b/xCAT-server/lib/xcat/plugins/nodestat.pm index e8f04b181..957ecf170 100644 --- a/xCAT-server/lib/xcat/plugins/nodestat.pm +++ b/xCAT-server/lib/xcat/plugins/nodestat.pm @@ -641,9 +641,9 @@ sub process_request_nmap { foreach my $ip6 (0,1) { #first pass, ipv4, second pass ipv6 if ($ip6 and scalar(@ip6s)) { - open($fping,"nmap -6 -PS$ports,3001 -n --send-ip -p $ports,3001 $more_options ".join(' ',@ip6s). " 2> /dev/null|") or die("Can't start nmap: $!"); + open($fping,"nmap --unprivileged -6 -PS$ports,3001 -n --send-ip -p $ports,3001 $more_options ".join(' ',@ip6s). " 2> /dev/null|") or die("Can't start nmap: $!"); } elsif (not $ip6 and scalar(@ips)) { - open($fping,"nmap -PE -n --send-ip -p $ports,3001 $more_options ".join(' ',@ips). " 2> /dev/null|") or die("Can't start nmap: $!"); + open($fping,"nmap --unprivileged -PE -n --send-ip -p $ports,3001 $more_options ".join(' ',@ips). " 2> /dev/null|") or die("Can't start nmap: $!"); } else { next; } while (<$fping>) { if (/Interesting ports on ([^ ]*)[: ]/ or /Nmap scan report for ([^ ]*)/) {