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>2015-03-18 17:35:37 +0300
committermboelen <michael@cisofy.com>2015-03-18 17:35:37 +0300
commit0e321e1c6bad173df82b6cbb029d520bf89e9390 (patch)
tree9ea222ce037c22e2606c8968382e95a2562de314
parente1a3d59f8dc951030576bd7c6a4123e6f23cb461 (diff)
Improved host ID generation on AIX systems
-rw-r--r--include/functions30
1 files changed, 23 insertions, 7 deletions
diff --git a/include/functions b/include/functions
index 3d20adc6..120c2bfd 100644
--- a/include/functions
+++ b/include/functions
@@ -350,17 +350,31 @@
{
HOSTID="-"
FIND=""
- if [ ! "${SHA1SUMBINARY}" = "" -a ! "${OPENSSLBINARY}" = "" ]; then
+ if [ ! "${SHA1SUMBINARY}" = "" -a ! "${OPENSSLBINARY}" = "" -a ! "${CSUMBINARY}" = "" ]; then
case "${OS}" in
"AIX")
- FIND=`entstat en0 2>/dev/null | grep "Hardware Address" | awk -F ": " '{ print $2 }'`
- if [ ! "${FIND}" = "" ]; then
- HOSTID=`echo ${FIND} | ${SHA1SUMBINARY} | awk '{ print $1 }'`
- else
- ReportException "GetHostID" "No MAC address returned on AIX"
- fi
+ # Common interfaces: en0 en1 en2, ent0 ent1 ent2
+ FIND=`entstat en0 2>/dev/null | grep "Hardware Address" | awk -F ": " '{ print $2 }'`
+ if [ "${FIND}" = "" ]; then
+ FIND=`entstat ent0 2>/dev/null | grep "Hardware Address" | awk -F ": " '{ print $2 }'`
+ fi
+ if [ ! "${FIND}" = "" ]; then
+ # We have a MAC address, now hashing it
+ if [ ! "${SHA1SUMBINARY}" = "" ]; then
+ HOSTID=`echo ${FIND} | ${SHA1SUMBINARY} | awk '{ print $1 }'`
+ elif [ ! "${CSUMBINARY}" = "" ]; then
+ HOSTID=`echo ${FIND} | ${CSUMBINARY} -h SHA1 - | awk '{ print $1 }'`
+ elif [ ! "${OPENSSLBINARY}" = "" ]; then
+ HOSTID=`echo ${FIND} | ${OPENSSLBINARY} sha -sha1 | awk '{ print $2 }'`
+ else
+ ReportException "GetHostID" "No sha1, sha1sum, csum or openssl binary available on AIX"
+ fi
+ else
+ ReportException "GetHostID" "No output from entstat on interfaces: en0, ent0"
+ fi
+
;;
"DragonFly" | "FreeBSD")
@@ -487,6 +501,8 @@
ReportException "GetHostID" "Can't create HOSTID as OS is not supported yet by this function"
;;
esac
+ else
+ ReportException "GetHostID" "Can't create HOSTID as there is no SHA1 hash tool available (sha1, sha1sum, openssl)"
fi
# Search machine ID