Show permission warning while allowing users to continue

This commit is contained in:
mboelen 2016-03-16 20:29:05 +01:00
parent 69c3816115
commit af31202091

21
lynis
View File

@ -137,37 +137,38 @@
echo "[!] Change ownership of ${INCLUDEDIR}/${FILE} to 'root' or similar (found: ${OWNER} with UID ${OWNERID})." echo "[!] Change ownership of ${INCLUDEDIR}/${FILE} to 'root' or similar (found: ${OWNER} with UID ${OWNERID})."
echo "" echo ""
echo " Command:" echo " Command:"
echo " # chown root:root ${INCLUDEDIR}/${FILE}" echo " # chown 0:0 ${INCLUDEDIR}/${FILE}"
echo "" echo ""
echo " Note: on some systems the default group might be 'wheel'. Use 'chown root:wheel' instead on the files."
echo "" echo ""
fi fi
if [ ${ISSUE} -eq 0 ]; then # Now if there is an issue with permissions, show it to the user and let them decide how to continue.
. ${INCLUDEDIR}/consts if [ ${ISSUE} -eq 1 ]; then
. ${INCLUDEDIR}/functions
else
echo ""; echo ""; echo ""; echo "";
echo "[X] Security check failed: See action above, to correct this issue." echo "[X] Security check failed: See action above, to correct this issue."
echo "" echo ""
echo " Why do I see this error?" echo " Why do I see this error?"
echo " -------------------------------" echo " -------------------------------"
echo " This is a protection mechanism, to prevent the root user from executing user created files." echo " This is a protection mechanism to prevent the root user from executing user created files."
echo ""; echo "" echo ""; echo ""
echo " What can I do?" echo " What can I do?"
echo " ---------------------" echo " ---------------------"
echo " 1) Check if a trusted user created the files (e.g. you, by using Git, Homebrew or similar)" echo " 1) Check if a trusted user created the files, by using Git, Homebrew or similar"
echo "" echo ""
echo " 2) Change ownership and permissions of the related files (or full directory)." echo " 2) Change ownership and permissions of the related files (or full directory)."
echo "" echo ""
echo " Commands (full directory):" echo " Commands (full directory):"
echo " # cd .." echo " # cd .."
echo " # chown -R root:<GROUP TO WHICH ROOT BELONGS> lynis" echo " # chown -R 0:0 lynis"
echo "" echo ""
echo " 3) Start Lynis again (cd lynis && ./lynis)." echo " 3) Start Lynis again (cd lynis && ./lynis)."
echo ""; echo ""; echo ""; echo "";
exit 1 echo "[ Press ENTER to continue, or CTRL+C to cancel ]"
read DUMMY
fi fi
. ${INCLUDEDIR}/consts
. ${INCLUDEDIR}/functions
# #
################################################################################# #################################################################################
# #