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:
authorMichael Boelen <michael.boelen@cisofy.com>2016-10-14 09:49:00 +0300
committerMichael Boelen <michael.boelen@cisofy.com>2016-10-14 09:49:00 +0300
commitc87e4231968928c85cbac93f1e7ee60f759554d4 (patch)
tree5e5bd292fe16ddd241a196d0f60c00ff13bb0644 /include
parent063f50f39cd0038bd19dd0c502cd2297ef17c21f (diff)
Added HOSTID2 for macOS platform
Diffstat (limited to 'include')
-rw-r--r--include/functions19
1 files changed, 16 insertions, 3 deletions
diff --git a/include/functions b/include/functions
index 495f084e..db0d40ae 100644
--- a/include/functions
+++ b/include/functions
@@ -881,12 +881,25 @@
;;
"MacOS")
- FIND=`${IFCONFIGBINARY} en0 | grep ether | head -1 | awk '{ print $2 }' | tr '[:upper:]' '[:lower:]'`
+ FIND=$(${IFCONFIGBINARY} en0 | grep ether | head -1 | awk '{ print $2 }' | tr '[:upper:]' '[:lower:]')
if [ ! "${FIND}" = "" ]; then
- HOSTID=`echo ${FIND} | shasum | awk '{ print $1 }'`
+ HOSTID=$(echo ${FIND} | shasum | awk '{ print $1 }')
else
ReportException "GetHostID" "No MAC address returned on Mac OS"
fi
+ LYNIS_HOSTID2_PART1=$(hostname -s)
+ if [ ! -z "${LYNIS_HOSTID2_PART1}" ]; then
+ LogText "Info: using hostname ${LYNIS_HOSTID2_PART1}"
+ LYNIS_HOSTID2_PART2=$(sysctl -n kern.uuid 2> /dev/null)
+ if [ ! -z "${LYNIS_HOSTID2_PART2}" ]; then
+ LogText "Info: using UUID ${LYNIS_HOSTID2_PART2}"
+ else
+ LogText "Info: could not create HOSTID2 as kern.uuid sysctl key is missing"
+ fi
+ HOSTID2=$(echo "${LYNIS_HOSTID2_PART1}${LYNIS_HOSTID2_PART2}" | shasum -a 256 | awk '{ print $1 }')
+ else
+ LogText "Info: could not create HOSTID2 as hostname is missing"
+ fi
;;
"NetBSD")
@@ -2078,7 +2091,7 @@
################################################################################
Report() {
- echo "$1" >> ${REPORTFILE}
+ if [ ${CREATE_REPORT_FILE} -eq 1 ]; then echo "$1" >> ${REPORTFILE}; fi
}