mirror of https://github.com/CISOfy/lynis.git
fix: Detect HOSTNAME on OpenWrt
OpenWrt can be run on devices with little resource, so it can miss some BusyBox commands (eg. hostname). The standard way of gathering info about OpenWrt is by the `uci` command, see: <https://openwrt.org/docs/guide-user/base-system/uci>.
This commit is contained in:
parent
f907c320a2
commit
b8f5b41b98
17
lynis
17
lynis
|
@ -520,12 +520,17 @@ ${NORMAL}
|
|||
HP-UX)
|
||||
HOSTNAME=$(hostname) ;;
|
||||
Linux)
|
||||
HOSTNAME=$(hostname -s 2> /dev/null)
|
||||
if [ -z "${HOSTNAME}" ]; then
|
||||
HOSTNAME="${FQDN:-no-hostname}"
|
||||
fi
|
||||
if [ "${HOSTNAME}" = "${FQDN}" ]; then
|
||||
FQDN=$(hostname -f 2> /dev/null)
|
||||
if [ "${LINUX_VERSION}" = "OpenWrt" ]; then
|
||||
HOSTNAME=$(uname -n)
|
||||
FQDN="${HOSTNAME:+$HOSTNAME.}$(uci -q get dhcp.@dnsmasq[0].domain)"
|
||||
else
|
||||
HOSTNAME=$(hostname -s 2> /dev/null)
|
||||
if [ -z "${HOSTNAME}" ]; then
|
||||
HOSTNAME="${FQDN:-no-hostname}"
|
||||
fi
|
||||
if [ "${HOSTNAME}" = "${FQDN}" ]; then
|
||||
FQDN=$(hostname -f 2> /dev/null)
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
Solaris)
|
||||
|
|
Loading…
Reference in New Issue