aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xbin/porticron38
1 files changed, 38 insertions, 0 deletions
diff --git a/bin/porticron b/bin/porticron
index 3a1c0bb..3761e30 100755
--- a/bin/porticron
+++ b/bin/porticron
@@ -82,3 +82,41 @@ ${DIFF_MSG}${UPGRADE_MSG}
--
${SCRIPT_NAME}
EOF
+
+
+# GLSA check
+GLSA_AFFECTED=$(/usr/bin/glsa-check --test --verbose affected 2>/dev/null)
+GLSA_UPGRADES=$(/usr/bin/glsa-check --pretend affected | grep '^ ')
+
+if [[ -n ${GLSA_AFFECTED} ]]; then
+ GLSA_MSG="
+${SCRIPT_NAME} has detected that this system is affected by the following GLSAs:
+
+$(echo "${GLSA_AFFECTED}" | sed 's/^20/ 20/')
+
+========================================================================
+
+The following updates should be performed for these GLSAs:
+
+${GLSA_UPGRADES}
+"
+fi
+
+
+# send mail
+if [[ -z ${GLSA_MSG} ]]; then
+ exit 0
+fi
+
+cat <<EOF | ${SENDMAIL:-/usr/sbin/sendmail} -t
+To: ${RCPT:-root@${FQDN}}
+From: root@${FQDN}
+Subject: WARNING: Gentoo security updates on ${FQDN} [ ${IP} ]
+Date: ${DATE}
+
+porticron report [${DATE}]
+========================================================================
+${GLSA_MSG}
+--
+${SCRIPT_NAME}
+EOF