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-16 18:07:34 +0300
committerMichael Boelen <michael.boelen@cisofy.com>2016-10-16 18:07:34 +0300
commit20ec79d4e231bf0576b2a7962aae07c724fd216b (patch)
treeb2603b4279cdad4660baa35e3e6a21522e58439b
parent404bd9ad4cffd5767543cb53e39dee1b8218901a (diff)
Extend hostname information for systems that show errors while running hostname command
-rwxr-xr-xlynis14
1 files changed, 9 insertions, 5 deletions
diff --git a/lynis b/lynis
index e9e5fc10..4475de70 100755
--- a/lynis
+++ b/lynis
@@ -462,15 +462,19 @@ ${NORMAL}
# Check hostname
case ${OS} in
HP-UX)
- HOSTNAME=`hostname` ;;
+ HOSTNAME=$(hostname) ;;
Solaris)
- HOSTNAME=`uname -n` ;;
+ HOSTNAME=$(uname -n) ;;
*)
- HOSTNAME=`hostname -s 2> /dev/null` ;;
+ HOSTNAME=$(hostname -s 2> /dev/null) ;;
esac
- FQDN=`hostname 2> /dev/null`
+ if [ -z "${HOSTNAME}" ]; then
+ HOSTNAME=$(hostname 2> /dev/null)
+ if [ -z "${HOSTNAME}" ]; then HOSTNAME="no-hostname"; fi
+ fi
+ FQDN=$(hostname 2> /dev/null)
if [ "${OS}" = "Linux" -a "${HOSTNAME}" = "${FQDN}" ]; then
- FQDN=`hostname -f 2> /dev/null`
+ FQDN=$(hostname -f 2> /dev/null)
fi
#
#################################################################################