mirror of
https://github.com/CISOfy/lynis.git
synced 2026-03-11 08:55:28 +00:00
Use 'ip' command when netstat is not found
This commit is contained in:
parent
a32c7d051e
commit
2c4b58d0b9
1 changed files with 8 additions and 2 deletions
|
|
@ -275,11 +275,17 @@
|
|||
# Test : NETW-3001
|
||||
# Description : Find default gateway (route)
|
||||
# More info : BSD: ^default Linux: 0.0.0.0
|
||||
if [ -n "${NETSTATBINARY}" ]; then PREQS_MET="YES"; else PREQS_MET="NO"; fi
|
||||
PREQS_MET="NO"
|
||||
if [ -n "${IPBINARY}" ]; then PREQS_MET="YES"; fi
|
||||
if [ -n "${NETSTATBINARY}" ]; then PREQS_MET="YES"; fi
|
||||
Register --test-no NETW-3001 --preqs-met ${PREQS_MET} --weight L --network NO --category security --description "Find default gateway (route)"
|
||||
if [ $SKIPTEST -eq 0 ]; then
|
||||
LogText "Test: Searching default gateway(s)"
|
||||
FIND=$(${NETSTATBINARY} -rn | ${GREPBINARY} -E "^0.0.0.0|default" | ${TRBINARY} -s ' ' | ${CUTBINARY} -d ' ' -f2)
|
||||
if [ -n "${IPBINARY}" ]; then
|
||||
FIND=$(${IPBINARY} route show default | ${TRBINARY} -s ' ' | ${CUTBINARY} -d ' ' -f3)
|
||||
else
|
||||
FIND=$(${NETSTATBINARY} -rn | ${GREPBINARY} -E "^0.0.0.0|default" | ${TRBINARY} -s ' ' | ${CUTBINARY} -d ' ' -f2)
|
||||
fi
|
||||
if [ -n "${FIND}" ]; then
|
||||
for I in ${FIND}; do
|
||||
LogText "Result: Found default gateway ${I}"
|
||||
|
|
|
|||
Loading…
Reference in a new issue