Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/CISOfy/lynis.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormboelen <michael@cisofy.com>2014-09-19 18:28:53 +0400
committermboelen <michael@cisofy.com>2014-09-19 18:28:53 +0400
commitf5dcb5e7f197f95e0acbd4576119726e3d5cde8a (patch)
tree75c03e34fb7d7ebf962db1e03fc0414d38ce1c75
parent1b881ec957d92d4ded95fb7600aa006be31c1cd3 (diff)
Added usage of ip to NETW-3006 and NETW-3008
-rw-r--r--include/tests_networking19
1 files changed, 16 insertions, 3 deletions
diff --git a/include/tests_networking b/include/tests_networking
index 7170947d..7fa4293b 100644
--- a/include/tests_networking
+++ b/include/tests_networking
@@ -151,13 +151,18 @@
FIND=`lscfg -vl ent* | fgrep "Network Address" | cut -d"." -f14 | awk '{ ctr=1; i=1; while (ctr <= 6) { d[ctr++]=substr($0,i,2);i=i+2 } printf("%s:%s:%s:%s:%s:%s\n",d[1],d[2],d[3],d[4],d[5],d[6]) }'`
;;
DragonFly|FreeBSD)
- FIND=`${IFCONFIGBINARY} -a | awk '{ if ($1=="ether") print $2 }' | sort | uniq`
+ FIND=`${IFCONFIGBINARY} -a | ${AWKBINARY} '{ if ($1=="ether") print $2 }' | sort | uniq`
;;
Linux)
if [ ! "${IFCONFIGBINARY}" = "" ]; then
- FIND=`${IFCONFIGBINARY} -a | grep "HWaddr" | awk '{ if ($4=="HWaddr") print $5 }' | sort | uniq`
+ FIND=`${IFCONFIGBINARY} -a | ${GREPBINARY} "HWaddr" | awk '{ if ($4=="HWaddr") print $5 }' | sort | uniq`
else
- ReportException "${TEST_NO}:2" "Due to missing ifconfig no method to collect hardware address (MAC)"
+ if [ ! "${IPBINARY}" = "" ]; then
+ logtext "Test: Using ip binary to gather hardware addresses"
+ FIND=`${IPBINARY} link | ${GREPBINARY} "link/ether" | ${AWKBINARY} '{ print $2 }'`
+ else
+ ReportException "${TEST_NO}:2" "Missing ifconfig or ip command to collect hardware address (MAC)"
+ fi
fi
;;
MacOS)
@@ -207,6 +212,14 @@
# Version which works for multiple types of ifconfig (e.g. Slackware)
FIND2=`${IFCONFIGBINARY} -a | awk '{ if ($1=="inet6" && $2=="addr:") { print $3 } else { if ($1=="inet6" && $3=="prefixlen") { print $2 } } }'`
else
+ if [ ! "${IPBINARY}" = "" ]; then
+ logtext "Test: Using ip binary to gather IP addresses"
+ FIND=`${IPBINARY} addr | ${AWKBINARY} '{ if ($1=="inet") { print $2 }}' | sed 's/\/.*//'`
+ FIND2=`${IPBINARY} addr | ${AWKBINARY} '{ if ($1=="inet6") { print $2 }}' | sed 's/\/.*//'`
+ else
+ ReportException "${TEST_NO}:2" "Missing ifconfig or ip command to collect hardware address (MAC)"
+ fi
+
ReportException "${TEST_NO}:2" "Due to missing ifconfig no method to collect hardware address (ip address)"
fi
;;