Last active
September 19, 2018 17:13
-
-
Save proffalken/08e9649ee7083fc3c5bd to your computer and use it in GitHub Desktop.
Checks for GHOST vulnerability - See https://bugzilla.redhat.com/show_bug.cgi?id=CVE-2015-0235 AND http://people.canonical.com/~ubuntu-security/cve/2015/CVE-2015-0235.html FOR MORE DETAILS ON AFFECTED VERSIONS
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
## Thanks to https://gist.github.com/xurizaemon for sorting this version out for me! :) | |
DEB_OR_UBU=$(lsb_release -ds | cut -d " " -f 1) | |
INSTALLED_VERSION=$(dpkg -s libc6 | grep Version | awk '{ print $2 }') | |
FIXED_VERSION="" | |
if [ "$DEB_OR_UBU" == "Ubuntu" ]; then | |
UBUNTU_RELEASE=$(lsb_release -sr | cut -d '.' -f 1) | |
case $UBUNTU_RELEASE in | |
10) | |
FIXED_VERSION=2.11.1-0ubuntu7.20 ;; | |
12) | |
FIXED_VERSION=2.15-0ubuntu10.10 ;; | |
14) | |
FIXED_VERSION=2.19-0ubuntu6 ;; | |
esac | |
else | |
DEBIAN_RELEASE=$(lsb_release -sr | cut -c 1) | |
case $DEBIAN_RELEASE in | |
6) | |
FIXED_VERSION=2.11.3-4+deb6u4 ;; | |
7) | |
FIXED_VERSION=2.13-38+deb7u7 ;; | |
8) | |
FIXED_VERSION=2.19-13 ;; | |
esac | |
fi | |
dpkg --compare-versions $INSTALLED_VERSION gt $FIXED_VERSION | |
if [ ! $? -eq 0 ] ; then | |
echo Installed is $INSTALLED_VERSION, should be $FIXED_VERSION | |
exit 2 | |
else | |
echo Installed is $INSTALLED_VERSION, looks OK. | |
exit 0 | |
fi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
RH_VER=$(cat /etc/redhat-release | cut -d " " -f 3 | cut -d "." -f 1 ) | |
if [ "$RH_VER" == "5" ]; then | |
GOOD_VER="glibc-2.5-123.el5_11.1" | |
fi | |
if [ "$RH_VER" == "6" ] || [ "$RH_VER" == "7" ]; then | |
GOOD_VER="glibc-2.12-1.149.el6_6.5" | |
fi | |
CURRENT_VERSION=$(rpm -qa | grep glibc-2 | cut -d "." -f -5) | |
if [ "$CURRENT_VERSION" != "$GOOD_VER" ]; then | |
echo "CURRENT VERSION IS $CURRENT_VERSION - SHOULD BE $GOOD_VER" | |
exit 2 | |
else | |
echo "CURRENT VERSION ( $CURRENT_VERSION ) IS OK" | |
exit 0 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks - I couldn't work out how to merge it back, so I've just copied your version here :)