mirror of https://github.com/CISOfy/lynis.git
Minor cleaning up and improved comment
This commit is contained in:
parent
a9966ac4ba
commit
fc27379452
|
@ -391,19 +391,16 @@
|
||||||
Register --test-no HTTP-6704 --preqs-met ${PREQS_MET} --weight L --network NO --description "Check nginx configuration file"
|
Register --test-no HTTP-6704 --preqs-met ${PREQS_MET} --weight L --network NO --description "Check nginx configuration file"
|
||||||
if [ ${SKIPTEST} -eq 0 ]; then
|
if [ ${SKIPTEST} -eq 0 ]; then
|
||||||
logtext "Test: searching nginx configuration file"
|
logtext "Test: searching nginx configuration file"
|
||||||
#YYY warning if multiple nginx.conf files are found
|
|
||||||
for I in ${NGINX_CONF_LOCS}; do
|
for I in ${NGINX_CONF_LOCS}; do
|
||||||
if [ -f ${I}/nginx.conf ]; then
|
if [ -f ${I}/nginx.conf ]; then
|
||||||
NGINX_CONF_LOCATION="${I}/nginx.conf"
|
NGINX_CONF_LOCATION="${I}/nginx.conf"
|
||||||
logtext "Found file ${NGINX_CONF_LOCATION}"
|
logtext "Found file ${NGINX_CONF_LOCATION}"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
#YYY strings /usr/sbin/nginx | grep "conf$"
|
|
||||||
if [ ! "${NGINX_CONF_LOCATION}" = "" ]; then
|
if [ ! "${NGINX_CONF_LOCATION}" = "" ]; then
|
||||||
logtext "Result: found nginx configuration file"
|
logtext "Result: found nginx configuration file"
|
||||||
report "nginx_main_conf_file=${NGINX_CONF_LOCATION}"
|
report "nginx_main_conf_file=${NGINX_CONF_LOCATION}"
|
||||||
Display --indent 4 --text "- Searching nginx configuration file" --result FOUND --color GREEN
|
Display --indent 4 --text "- Searching nginx configuration file" --result FOUND --color GREEN
|
||||||
#FIND=`cat ${NGINX_CONF_LOCATION} | sed -e 's/^[ \t]*//' | grep -v "^#" | grep -v "^$" | sed 's/[\t]/ /g' | sed 's/ / /g' | sed 's/ / /g' >> ${TMPFILE2}`
|
|
||||||
else
|
else
|
||||||
logtext "Result: no nginx configuration file found"
|
logtext "Result: no nginx configuration file found"
|
||||||
Display --indent 2 --text "- Searching nginx configuration file" --result "NOT FOUND" --color WHITE
|
Display --indent 2 --text "- Searching nginx configuration file" --result "NOT FOUND" --color WHITE
|
||||||
|
@ -415,7 +412,7 @@
|
||||||
# Test : HTTP-6706
|
# Test : HTTP-6706
|
||||||
# Description : Search for includes within nginx configuration file
|
# Description : Search for includes within nginx configuration file
|
||||||
# Notes : Daemon nginx should be running, nginx.conf should be found
|
# Notes : Daemon nginx should be running, nginx.conf should be found
|
||||||
if [ ${NGINX_RUNNING} -eq 1 -a "${NGINX_CONF_LOCATION}" != "" ]; then PREQS_MET="YES"; else PREQS_MET="NO"; fi
|
if [ ${NGINX_RUNNING} -eq 1 -a ! "${NGINX_CONF_LOCATION}" = "" ]; then PREQS_MET="YES"; else PREQS_MET="NO"; fi
|
||||||
Register --test-no HTTP-6706 --preqs-met ${PREQS_MET} --weight L --network NO --description "Check for additional nginx configuration files"
|
Register --test-no HTTP-6706 --preqs-met ${PREQS_MET} --weight L --network NO --description "Check for additional nginx configuration files"
|
||||||
if [ ${SKIPTEST} -eq 0 ]; then
|
if [ ${SKIPTEST} -eq 0 ]; then
|
||||||
# Remove temp file
|
# Remove temp file
|
||||||
|
@ -426,14 +423,14 @@
|
||||||
for I in ${FIND}; do
|
for I in ${FIND}; do
|
||||||
FIND2=`${LSBINARY} ${I} 2>/dev/null`
|
FIND2=`${LSBINARY} ${I} 2>/dev/null`
|
||||||
for J in ${FIND2}; do
|
for J in ${FIND2}; do
|
||||||
# Double check if we are dealing with a file
|
# Ensure that we are parsing normal files
|
||||||
if [ -f ${J} ]; then
|
if [ -f ${J} ]; then
|
||||||
N=`expr ${N} + 1`
|
N=`expr ${N} + 1`
|
||||||
logtext "Result: found Nginx configuration file ${J}"
|
logtext "Result: found Nginx configuration file ${J}"
|
||||||
report "nginx_sub_conf_file=${J}"
|
report "nginx_sub_conf_file=${J}"
|
||||||
FileIsReadable ${J}
|
FileIsReadable ${J}
|
||||||
if [ ${CANREAD} -eq 1 ]; then
|
if [ ${CANREAD} -eq 1 ]; then
|
||||||
FIND3=`cat ${J} | sed -e 's/^[ \t]*//' | grep -v "^#" | grep -v "^$" | sed 's/[\t]/ /g' | sed 's/ / /g' | sed 's/ / /g' >> ${TMPFILE2}`
|
FIND3=`cat ${J} | sed -e 's/^[ \t]*//' | grep -v "^#" | grep -v "^$" | sed 's/[\t]/ /g' | sed 's/ / /g' | sed 's/ / /g' >> ${TMPFILE}`
|
||||||
else
|
else
|
||||||
ReportException "${TEST_NO}:1" "Can not parse file ${J}, as it is not readable"
|
ReportException "${TEST_NO}:1" "Can not parse file ${J}, as it is not readable"
|
||||||
fi
|
fi
|
||||||
|
@ -442,14 +439,14 @@
|
||||||
done
|
done
|
||||||
|
|
||||||
# Sort all discovered configuration lines and store unique ones. Also strip out the mime types configured in nginx
|
# Sort all discovered configuration lines and store unique ones. Also strip out the mime types configured in nginx
|
||||||
SORTFILE=`cat ${TMPFILE2} | sort | uniq | sed 's/ /:space:/g' | egrep -v "(application|audio|image|text|video)/" | egrep -v "({|})"`
|
SORTFILE=`cat ${TMPFILE} | sort | uniq | sed 's/ /:space:/g' | egrep -v "(application|audio|image|text|video)/" | egrep -v "({|})"`
|
||||||
for I in ${SORTFILE}; do
|
for I in ${SORTFILE}; do
|
||||||
I=`echo ${I} | sed 's/:space:/ /g'`
|
I=`echo ${I} | sed 's/:space:/ /g'`
|
||||||
report "nginx_config_option=${I}";
|
report "nginx_config_option=${I}";
|
||||||
done
|
done
|
||||||
|
|
||||||
# Remove unsorted file for next tests
|
# Remove unsorted file for next tests
|
||||||
if [ -f ${TMPFILE2} ]; then rm -f ${TMPFILE2}; fi
|
if [ -f ${TMPFILE} ]; then rm -f ${TMPFILE}; fi
|
||||||
|
|
||||||
if [ ${N} -eq 0 ]; then
|
if [ ${N} -eq 0 ]; then
|
||||||
logtext "Result: no nginx include statements found"
|
logtext "Result: no nginx include statements found"
|
||||||
|
|
Loading…
Reference in New Issue