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
5
lynis
5
lynis
|
@ -520,6 +520,10 @@ ${NORMAL}
|
|||
HP-UX)
|
||||
HOSTNAME=$(hostname) ;;
|
||||
Linux)
|
||||
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}"
|
||||
|
@ -527,6 +531,7 @@ ${NORMAL}
|
|||
if [ "${HOSTNAME}" = "${FQDN}" ]; then
|
||||
FQDN=$(hostname -f 2> /dev/null)
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
Solaris)
|
||||
HOSTNAME=$(uname -n) ;;
|
||||
|
|
Loading…
Reference in New Issue