Added support for blog posts and articles to support suggestions

This commit is contained in:
Michael Boelen 2024-10-11 11:14:31 +00:00
parent 86aa1b3bcc
commit e5462afb15
No known key found for this signature in database
GPG Key ID: 26141F77A09D7F04
2 changed files with 13 additions and 3 deletions

4
db/control-links.db Normal file
View File

@ -0,0 +1,4 @@
# Links for controls pointing to informational pages. Note: only links managed by the project are allowed (cisofy.com / linux-audit.com)
# Format: Control;Text;Link;
BOOT-5264;blog;Systemd features to secure service files;https://linux-audit.com/systemd/systemd-features-to-secure-units-and-services/;
# EOF

View File

@ -161,7 +161,8 @@
for SUGGESTION in ${SUGGESTIONS}; do
SOLUTION=""
SHOWSUGGESTION=$(echo ${SUGGESTION} | sed 's/!space!/ /g' | sed 's/^.* Suggestion: //' | sed 's/\[details:\(.*\)\] \[solution:\(.*\)\]//' | sed 's/test://')
ADDLINK=$(echo ${SUGGESTION} | sed 's/!space!/ /g' | sed 's/^.* Suggestion: \(.*\)\[test://' | sed 's/\]\(.*\)]//' | ${AWKBINARY} -F: '{print $1}')
RELATED_CONTROL=$(echo ${SUGGESTION} | sed 's/!space!/ /g' | sed 's/^.* Suggestion: \(.*\)\[test://' | sed 's/\]\(.*\)]//' | ${AWKBINARY} -F: '{print $1}')
ADDLINK="${RELATED_CONTROL}"
DETAILS=$(echo ${SUGGESTION} | sed 's/!space!/ /g' | sed 's/^.* Suggestion: \(.*\)\[details://' | sed 's/\]\(.*\)]//')
SUGGESTION_PIECES=$(echo ${SUGGESTION} | sed 's/\[/ [/g')
for PIECE in ${SUGGESTION_PIECES}; do
@ -174,10 +175,15 @@
echo " ${YELLOW}*${NORMAL} ${SHOWSUGGESTION}"
if [ ! "${DETAILS}" = "-" -a -n "${DETAILS}" ]; then echo " - Details : ${CYAN}${DETAILS}${NORMAL}"; fi
if [ ${SHOW_REPORT_SOLUTION} -eq 1 -a ! "${SOLUTION}" = "-" ]; then echo " - Solution : ${SOLUTION}"; fi
# Show relevant articles if the database is available
if [ -f ${DBDIR}/control-links.db ]; then
echo " - Related resources:"
$AWKBINARY -F \; -v control=${RELATED_CONTROL} '{if($1==control && $2=="blog"){print " * Article - "$3": "$4}}' "${DBDIR}/control-links.db"
fi
if [ -z "${IS_CUSTOM}" ]; then
echo " ${GRAY}${CONTROL_URL_PROTOCOL}://${CONTROL_URL_PREPEND}${ADDLINK}${CONTROL_URL_APPEND}${NORMAL}"
echo " * Website - ${GRAY}${CONTROL_URL_PROTOCOL}://${CONTROL_URL_PREPEND}${ADDLINK}${CONTROL_URL_APPEND}${NORMAL}"
else
echo " ${GRAY}${CUSTOM_URL_PROTOCOL}://${CUSTOM_URL_PREPEND}${ADDLINK}${CUSTOM_URL_APPEND}${NORMAL}"
echo " * Details - ${GRAY}${CUSTOM_URL_PROTOCOL}://${CUSTOM_URL_PREPEND}${ADDLINK}${CUSTOM_URL_APPEND}${NORMAL}"
fi
echo ""
done