Skip to content

Instantly share code, notes, and snippets.

@mig5
Last active August 29, 2015 14:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mig5/50bd258caf1cf8d2ced2 to your computer and use it in GitHub Desktop.
Save mig5/50bd258caf1cf8d2ced2 to your computer and use it in GitHub Desktop.
OSSEC quick install script
#!/bin/bash
#
# Written by mig5 2014
# Variables
VERSION=2.8.2
CHECKSUM="ossec-hids-${VERSION}-checksum.txt"
TARBALL="ossec-hids-${VERSION}.tar.gz"
echo "Downloading packages and checksums"
curl -o ${TARBALL} http://www.ossec.net/files/${TARBALL}
curl -o ${CHECKSUM} http://www.ossec.net/files/${CHECKSUM}
echo "These are the checksums from the file"
cat $CHECKSUM
OSSEC_MD5=$(md5sum $TARBALL | awk {'print $1'})
OSSEC_SHA=$(sha1sum $TARBALL | awk {'print $1'})
echo "checking for matching md5/sha sums"
grep $OSSEC_MD5 $CHECKSUM
if [ $? -eq 1 ]; then
echo "md5sum didn't match"!
exit 1
fi
grep $OSSEC_SHA $CHECKSUM
if [ $? -eq 1 ]; then
echo "sha1sum didn't match"!
exit 1
fi
# sums matched, extract and run install
tar zxfv $TARBALL
builtin cd ossec-hids-${VERSION}
sudo bash install.sh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment